Commit 86651228 authored by Davis King's avatar Davis King

Fixed the code so that it doesn't assume sparse vectors are of std::map type.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402962
parent f30c36e5
...@@ -884,7 +884,7 @@ namespace dlib ...@@ -884,7 +884,7 @@ namespace dlib
{ {
temp.b = squared_norm(); temp.b = squared_norm();
temp.support_vectors.set_size(1); temp.support_vectors.set_size(1);
temp.support_vectors(0) = w; temp.support_vectors(0) = sample_type(w.begin(), w.end());
temp.alpha.set_size(1); temp.alpha.set_size(1);
temp.alpha(0) = alpha; temp.alpha(0) = alpha;
} }
...@@ -1222,7 +1222,7 @@ namespace dlib ...@@ -1222,7 +1222,7 @@ namespace dlib
scale = (x_extra/w_extra); scale = (x_extra/w_extra);
temp.support_vectors.set_size(1); temp.support_vectors.set_size(1);
temp.alpha.set_size(1); temp.alpha.set_size(1);
temp.support_vectors(0) = w; temp.support_vectors(0) = sample_type(w.begin(), w.end());
sparse_vector::scale_by(temp.support_vectors(0), scale); sparse_vector::scale_by(temp.support_vectors(0), scale);
temp.alpha(0) = alpha/scale; temp.alpha(0) = alpha/scale;
} }
...@@ -1232,10 +1232,10 @@ namespace dlib ...@@ -1232,10 +1232,10 @@ namespace dlib
// thing in the output support vector set is by using two vectors // thing in the output support vector set is by using two vectors
temp.support_vectors.set_size(2); temp.support_vectors.set_size(2);
temp.alpha.set_size(2); temp.alpha.set_size(2);
temp.support_vectors(0) = w; temp.support_vectors(0) = sample_type(w.begin(), w.end());
sparse_vector::scale_by(temp.support_vectors(0), 2); sparse_vector::scale_by(temp.support_vectors(0), 2);
temp.alpha(0) = alpha; temp.alpha(0) = alpha;
temp.support_vectors(1) = w; temp.support_vectors(1) = sample_type(w.begin(), w.end());
temp.alpha(1) = -alpha; temp.alpha(1) = -alpha;
} }
...@@ -1292,7 +1292,7 @@ namespace dlib ...@@ -1292,7 +1292,7 @@ namespace dlib
kernel_type kernel; kernel_type kernel;
sample_type w; std::map<long,scalar_type> w;
scalar_type alpha; scalar_type alpha;
scalar_type w_extra; scalar_type w_extra;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment