# Classification using harmonic functions

In this tutorial, you'll learn how to use harmonic.pl to classify a set of 30 samples of the one-vs-two dataset, handwritten digits, from Prof. Xiaojin Zhu's PhD thesis (http://www-2.cs.cmu.edu/~zhuxj/pub/semisuperviseddata/handwrittendigits/). Each digit is a 16x16 gray scale image. The distance between two digits are pixel-wise L2 distance, i.e. d(x,y) = \sqrt( \sum_{i=1}^256 (x_i - y_i)^2 ). A graph is created out of the set where each node is a digit and the graph is fully connected. The weight of each edge is the pixel-wise distance between its end nodes. Each node is labeled ('1' or '2'). To test how the harmonic functions will help in labeling any unlabeled node, we split set of digits into labeled (training) set and unlabeled (testing) set. The graph file in edge list format, the labels if each digit in (line: node label) format, and the set of labeled (traning) nodes in (line: node) format are tar'ed and available for download here

To run harmonic.pl on this set, use the following command

harmonic.pl --graph one_vs_two.graph --labels one_vs_two.labels --split one_vs_two.split --output one_vs_two.output --method relaxation


The labels for all the nodes computed by the relaxation method will be written to the one_vs_two.output file.

If you like to use the Monte Carlo method instead, change the value of the (--method) argument to "montecarlo".