Record Class ClassificationModel
java.lang.Object
java.lang.Record
smile.model.ClassificationModel
- Record Components:
algorithm- the algorithm name.schema- the schema of input data (without response variable).formula- the model formula.classifier- the classification model.train- the training metrics.validation- the cross-validation metrics.test- the test metrics.- the model metadata tags.
- All Implemented Interfaces:
Serializable, Model
public record ClassificationModel(String algorithm, StructType schema, Formula formula, DataFrameClassifier classifier, ClassificationMetrics train, ClassificationMetrics validation, ClassificationMetrics test, Properties tags)
extends Record
implements Model, Serializable
The classification model.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionClassificationModel(String algorithm, StructType schema, Formula formula, DataFrameClassifier classifier, ClassificationMetrics train, ClassificationMetrics validation, ClassificationMetrics test, Properties tags) Creates an instance of aClassificationModelrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealgorithmrecord component.Returns the value of theclassifierrecord component.final booleanIndicates whether some other object is "equal to" this one.formula()Returns the value of theformularecord component.final inthashCode()Returns a hash code value for this object.intReturns the number of classes.intModel inference.intModel inference.schema()Returns the value of theschemarecord component.tags()Returns the value of thetagsrecord component.test()Returns the value of thetestrecord component.final StringtoString()Returns a string representation of this record class.train()Returns the value of thetrainrecord component.Returns the value of thevalidationrecord component.Methods inherited from interface Model
getTag, getTag, setProperty
-
Constructor Details
-
ClassificationModel
public ClassificationModel(String algorithm, StructType schema, Formula formula, DataFrameClassifier classifier, ClassificationMetrics train, ClassificationMetrics validation, ClassificationMetrics test, Properties tags) Creates an instance of aClassificationModelrecord class.- Parameters:
algorithm- the value for thealgorithmrecord componentschema- the value for theschemarecord componentformula- the value for theformularecord componentclassifier- the value for theclassifierrecord componenttrain- the value for thetrainrecord componentvalidation- the value for thevalidationrecord componenttest- the value for thetestrecord componenttags- the value for thetagsrecord component
-
-
Method Details
-
predict
Model inference.- Parameters:
x- the input tuple.- Returns:
- the prediction.
-
predict
Model inference.- Parameters:
x- the input tuple.posteriori- a posteriori probabilities on output.- Returns:
- the prediction.
-
numClasses
public int numClasses()Returns the number of classes.- Returns:
- the number of classes.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
algorithm
-
schema
Returns the value of theschemarecord component. -
formula
-
classifier
Returns the value of theclassifierrecord component.- Returns:
- the value of the
classifierrecord component
-
train
-
validation
Returns the value of thevalidationrecord component.- Returns:
- the value of the
validationrecord component
-
test
-
tags
Returns the value of thetagsrecord component.
-