Java Reference
In-Depth Information
metrics named in lines 14 to 16. We can further specify in the Classifi-
cationTestTask which metrics to compute. Here we specify lift (line
18), confusion matrix (line 21), and ROC (line 25). Then the task is
saved, executed, and monitored for success.
When the task completes, the results are obtained, as shown in
lines 35 to 38.
The same class TestMetricsDisplayer is used for classification and
regression but the graphical dialog layout is different for each. The
creator of the TestMetricsDisplayer used at line 42 will look at the class
of the argument lTestMetrics to select one of two proper layouts: (1) If
the class is ClassificationTestMetrics, a layout based on three panes (or
tabs), each of them leading to a table displayer, will be used; (2) if the
class is RegressionTestMetrics, a very simple layout showing five sca-
lar metrics values will be used.
A TestMetricsDisplayer has several member variables to store test
metrics information:
JLabel mTestAccuracy used to store the model accuracy to be
JLabel mTestNumberQuantile used to store the number of
quantiles used to display the lift and ROC
Lift mLift used to store the JDM lift structure obtained from
the test metrics
ReceiverOperatingCharacterics mROC used to store the JDM
ROC structure obtained from the test metrics
ConfusionMatrix mConfusionMatrix used to store the confu-
sion matrix elements
Object[] mConfusionMatrixCategories used to store the catego-
ries associated with the confusion matrix
Regression models produce five scalar values that can be
displayed without needing to manage complex structures such as
curves or a confusion matrix.
When a TestMetricsDisplayer is created with a ClassificationTest-
Metrics object , the following code is executed:
1. public TestMetricsDisplayer(ClassificationTestMetrics iTestMetrics) {
mLift iTestMetrics.getLift();
mROC iTestMetrics.getROC();
Search WWH ::

Custom Search