Commit 81205791 authored by Davis King's avatar Davis King

Improved example a little.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403631
parent 5c057975
...@@ -214,10 +214,8 @@ void test_empirical_kernel_map ( ...@@ -214,10 +214,8 @@ void test_empirical_kernel_map (
// Now lets do something more interesting. The following loop finds the centroids // Now lets do something more interesting. The following loop finds the centroids
// of the two classes of data. // of the two classes of data.
sample_type class1_center(ekm.out_vector_size()); sample_type class1_center;
sample_type class2_center(ekm.out_vector_size()); sample_type class2_center;
class1_center = 0;
class2_center = 0;
for (unsigned long i = 0; i < projected_samples.size(); ++i) for (unsigned long i = 0; i < projected_samples.size(); ++i)
{ {
if (labels[i] == 1) if (labels[i] == 1)
...@@ -234,9 +232,8 @@ void test_empirical_kernel_map ( ...@@ -234,9 +232,8 @@ void test_empirical_kernel_map (
// Now classify points by which center they are nearest. Recall that the data // Now classify points by which center they are nearest. Recall that the data
// is made up of two concentric circles. Normally you can't separate two concentric // is made up of two concentric circles. Normally you can't separate two concentric
// circles by checking which points are nearest to each center since they have the same // circles by checking which points are nearest to each center since they have the same
// centers. All the points would just associate to the smallest circle. However, // centers. However, the kernel trick makes the data separable and the loop below will
// the kernel trick makes the data separable and the loop below will perfectly // perfectly classify each data point.
// classify each data point.
for (unsigned long i = 0; i < projected_samples.size(); ++i) for (unsigned long i = 0; i < projected_samples.size(); ++i)
{ {
double distance_to_class1 = length(projected_samples[i] - class1_center); double distance_to_class1 = length(projected_samples[i] - class1_center);
......
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