Skip to content

Commit

Permalink
clean up knn example
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnapf authored and vigsterkr committed Mar 10, 2016
1 parent 6a6fd05 commit 78f2aca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/cookbook/source/examples/classifier/knn.rst
Expand Up @@ -18,9 +18,9 @@ See :sgissue:`2996` for known issues.
Example
-------

Load some training and test data.
Imagine we have files with training and test data. We create :sgclass:`CDenseFeatures` (here 64 bit floats aka RealFeatures) and :sgclass:`CMulticlassLabels` as

.. sgexample:: knn.sg:load_data
.. sgexample:: knn.sg:create_features

In order to run :sgclass:`CKNN`, we need to choose a distance, for example :sgclass:`CEuclideanDistance`, or other sub-classes of :sgclass:`CDistance`. The distance is initialized with the data we want to classify.

Expand Down
4 changes: 2 additions & 2 deletions examples/meta/src/classifier/knn.sg
@@ -1,15 +1,15 @@
#![load_data]
CSVFile f_feats_train("../data/classifier_4class_2d_linear_features_train.dat")
CSVFile f_feats_test("../data/classifier_4class_2d_linear_features_test.dat")
CSVFile f_labels_train("../data/classifier_4class_2d_linear_labels_train.dat")
CSVFile f_labels_test("../data/classifier_4class_2d_linear_labels_test.dat")

#![create_features]
RealFeatures features_train(f_feats_train)
RealFeatures features_test(f_feats_test)
MulticlassLabels labels_train(f_labels_train)
MulticlassLabels labels_test(f_labels_test)
#![create_features]

#![load_data]

#![choose_distance]
EuclideanDistance distance(features_train, features_test)
Expand Down

0 comments on commit 78f2aca

Please sign in to comment.