Classifier
¶
A model for classification tasks.
Parent type: SupervisedModel
Inheritors:
AdaBoostClassifier
DecisionTreeClassifier
GradientBoostingClassifier
KNearestNeighborsClassifier
LogisticClassifier
RandomForestClassifier
SupportVectorClassifier
Stub code in Classifier.sdsstub
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
isFitted
¶
Whether the model is fitted.
Type: Boolean
accuracy
¶
Compute the accuracy of the classifier on the given data.
The accuracy is the proportion of predicted target values that were correct. The higher the accuracy, the better. Results range from 0.0 to 1.0.
Note: The model must be fitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
validationOrTestSet |
union<Table, TabularDataset> |
The validation or test set. | - |
Results:
Name | Type | Description |
---|---|---|
accuracy |
Float |
The classifier's accuracy. |
Stub code in Classifier.sdsstub
f1Score
¶
Compute the classifier's F₁ score on the given data.
The F₁ score is the harmonic mean of precision and recall. The higher the F₁ score, the better the classifier. Results range from 0.0 to 1.0.
Note: The model must be fitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
validationOrTestSet |
union<Table, TabularDataset> |
The validation or test set. | - |
positiveClass |
Any |
The class to be considered positive. All other classes are considered negative. | - |
Results:
Name | Type | Description |
---|---|---|
f1Score |
Float |
The classifier's F₁ score. |
Stub code in Classifier.sdsstub
fit
¶
Create a copy of this model and fit it with the given training data.
Note: This model is not modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainingSet |
TabularDataset |
The training data containing the features and target. | - |
Results:
Name | Type | Description |
---|---|---|
fittedModel |
Classifier |
The fitted model. |
Stub code in Classifier.sdsstub
getFeatureNames
¶
Return the names of the feature columns.
Note: The model must be fitted.
Results:
Name | Type | Description |
---|---|---|
featureNames |
List<String> |
The names of the feature columns. |
Stub code in SupervisedModel.sdsstub
getFeaturesSchema
¶
Return the schema of the feature columns.
Note: The model must be fitted.
Results:
Name | Type | Description |
---|---|---|
featureSchema |
Schema |
The schema of the feature columns. |
Stub code in SupervisedModel.sdsstub
getTargetName
¶
Return the name of the target column.
Note: The model must be fitted.
Results:
Name | Type | Description |
---|---|---|
targetName |
String |
The name of the target column. |
Stub code in SupervisedModel.sdsstub
getTargetType
¶
Return the type of the target column.
Note: The model must be fitted.
Results:
Name | Type | Description |
---|---|---|
targetType |
ColumnType |
The type of the target column. |
Stub code in SupervisedModel.sdsstub
precision
¶
Compute the classifier's precision on the given data.
The precision is the proportion of positive predictions that were correct. The higher the precision, the better the classifier. Results range from 0.0 to 1.0.
Note: The model must be fitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
validationOrTestSet |
union<Table, TabularDataset> |
The validation or test set. | - |
positiveClass |
Any |
The class to be considered positive. All other classes are considered negative. | - |
Results:
Name | Type | Description |
---|---|---|
precision |
Float |
The classifier's precision. |
Stub code in Classifier.sdsstub
predict
¶
Predict the target values on the given dataset.
Note: The model must be fitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
union<Table, TabularDataset> |
The dataset containing at least the features. | - |
Results:
Name | Type | Description |
---|---|---|
prediction |
TabularDataset |
The given dataset with an additional column for the predicted target values. |
Stub code in SupervisedModel.sdsstub
recall
¶
Compute the classifier's recall on the given data.
The recall is the proportion of actual positives that were predicted correctly. The higher the recall, the better the classifier. Results range from 0.0 to 1.0.
Note: The model must be fitted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
validationOrTestSet |
union<Table, TabularDataset> |
The validation or test set. | - |
positiveClass |
Any |
The class to be considered positive. All other classes are considered negative. | - |
Results:
Name | Type | Description |
---|---|---|
recall |
Float |
The classifier's recall. |
Stub code in Classifier.sdsstub
summarizeMetrics
¶
Summarize the classifier's metrics on the given data.
Note: The model must be fitted.
API Stability
Do not rely on the exact output of this method. In future versions, we may change the displayed metrics without prior notice.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
validationOrTestSet |
union<Table, TabularDataset> |
The validation or test set. | - |
positiveClass |
Any |
The class to be considered positive. All other classes are considered negative. | - |
Results:
Name | Type | Description |
---|---|---|
metrics |
Table |
A table containing the classifier's metrics. |