Added some comments and cleaned up code slightly.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403420
This commit is contained in:
Davis King 2010-01-29 00:31:39 +00:00
parent 0350895dc7
commit 5c5bc58026
2 changed files with 5 additions and 2 deletions

View File

@ -94,8 +94,9 @@ int main()
m(0) = -1.5; m(1) = sinc(m(0))+0.9; cout << " " << test(m) << " is " << rs.scale(test(m)) << " standard deviations from sinc." << endl; m(0) = -1.5; m(1) = sinc(m(0))+0.9; cout << " " << test(m) << " is " << rs.scale(test(m)) << " standard deviations from sinc." << endl;
m(0) = -0.5; m(1) = sinc(m(0))+1; cout << " " << test(m) << " is " << rs.scale(test(m)) << " standard deviations from sinc." << endl; m(0) = -0.5; m(1) = sinc(m(0))+1; cout << " " << test(m) << " is " << rs.scale(test(m)) << " standard deviations from sinc." << endl;
// And finally print out the mean and standard deviation of points that are actually from sinc().
cout << "\nmean: " << rs.mean() << endl; cout << "\nmean: " << rs.mean() << endl;
cout << "standard deviation: " << sqrt(rs.variance()) << endl; cout << "standard deviation: " << rs.stddev() << endl;
// The output is as follows: // The output is as follows:
/* /*

View File

@ -100,7 +100,9 @@ int main()
// The radial_basis_kernel has a parameter called gamma that we need to set. Generally, // The radial_basis_kernel has a parameter called gamma that we need to set. Generally,
// you should try the same gamma that you are using for training. But if you don't // you should try the same gamma that you are using for training. But if you don't
// have a particular gamma in mind then you can use the following function to // have a particular gamma in mind then you can use the following function to
// find a reasonable default gamma for your data. // find a reasonable default gamma for your data. Another reasonable way to pick a gamma
// is often to use 1.0/compute_mean_squared_distance(samples). This second way has the
// bonus of being quite fast.
const double gamma = verbose_find_gamma_with_big_centroid_gap(samples, labels); const double gamma = verbose_find_gamma_with_big_centroid_gap(samples, labels);
// Next we declare an instance of the kcentroid object. It is used by rank_features() // Next we declare an instance of the kcentroid object. It is used by rank_features()