Java Reference
In-Depth Information
entries and the box.test file consists of 30 entries. These files can be downloaded from
www.packtpub.com . The first line of the box.train file follows here. The category is
small; its height, width, and length are 2.34, 1.60, and 1.50, respectively:
small 2.34 1.60 1.50
The code to create the classifier is shown here. An instance of the ColumnDataClas-
sifier class is created using the properties file as the constructor's argument. An in-
stance of the Classifier interface is returned by the makeClassifier method.
This interface supports three methods, two of which we will demonstrate. The
readTrainingExamples method reads the training data from the training file:
ColumnDataClassifier cdc =
new ColumnDataClassifier("box.prop");
Classifier<String, String> classifier =
cdc.makeClassifier(cdc.readTrainingExamples("box.train"));
When executed, we get extensive output. We will discuss the more relevant parts here.
The first part of the output repeats parts of the property file:
3.realValued = true
testFile = .box.test
...
trainFile = .box.train
The next part displays the number of datasets read along with various features' informa-
tion, as shown here:
Reading dataset from box.train ... done [0.1s, 60 items].
numDatums: 60
numLabels: 3 [small, medium, large]
...
AVEIMPROVE The average improvement / current value
EVALSCORE The last available eval score
Iter ## evals ## <SCALING> [LINESEARCH] VALUE TIME |GNORM|
{RELNORM} AVEIMPROVE EVALSCORE
The classifier then iterates over the data to create the classifier:
Search WWH ::




Custom Search