Record Class RegressionModel
java.lang.Object
java.lang.Record
smile.model.RegressionModel
- Record Components:
algorithm- the algorithm name.schema- the schema of input data (without response variable).formula- the model formula.regression- the regression 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 RegressionModel(String algorithm, StructType schema, Formula formula, DataFrameRegression regression, RegressionMetrics train, RegressionMetrics validation, RegressionMetrics test, Properties tags)
extends Record
implements Model, Serializable
The regression model.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionRegressionModel(String algorithm, StructType schema, Formula formula, DataFrameRegression regression, RegressionMetrics train, RegressionMetrics validation, RegressionMetrics test, Properties tags) Creates an instance of aRegressionModelrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealgorithmrecord 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.Performs batch inference over a data frame.infer(DataFrame data, boolean probability, boolean explain, KernelSHAP.Options options) Performs batch inference over a data frame with customKernelSHAP.Options.Performs inference on a single tuple.infer(Tuple x, boolean probability, boolean explain, KernelSHAP.Options options) Performs inference on a single tuple with customKernelSHAP.Options.booleanisOnline()Returns true if this model supports online learning updates.doubleModel inference.Returns the value of theregressionrecord component.schema()Returns the value of theschemarecord component.double[]Computes SHAP values for the input tuple.double[]shap(Tuple x, KernelSHAP.Options options) Computes SHAP values for the input tuple with customKernelSHAP.Options.booleanReturns true if this model supports SHAP feature explanations.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.voidOnline updates the model with a single observation.voidOnline updates the regression model with a new training instance.Returns the value of thevalidationrecord component.
-
Constructor Details
-
RegressionModel
public RegressionModel(String algorithm, StructType schema, Formula formula, DataFrameRegression regression, RegressionMetrics train, RegressionMetrics validation, RegressionMetrics test, Properties tags) Creates an instance of aRegressionModelrecord class.- Parameters:
algorithm- the value for thealgorithmrecord componentschema- the value for theschemarecord componentformula- the value for theformularecord componentregression- the value for theregressionrecord 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.
-
isOnline
-
update
-
update
Online updates the regression model with a new training instance.- Parameters:
x- the input tuple.y- the target value.
-
supportsShap
public boolean supportsShap()Description copied from interface:ModelReturns true if this model supports SHAP feature explanations.- Specified by:
supportsShapin interfaceModel- Returns:
- true if SHAP explanations are supported.
-
shap
-
shap
Description copied from interface:ModelComputes SHAP values for the input tuple with customKernelSHAP.Options. -
infer
Description copied from interface:ModelPerforms inference on a single tuple. -
infer
Description copied from interface:ModelPerforms inference on a single tuple with customKernelSHAP.Options. -
infer
Description copied from interface:ModelPerforms batch inference over a data frame. -
infer
public Prediction[] infer(DataFrame data, boolean probability, boolean explain, KernelSHAP.Options options) Description copied from interface:ModelPerforms batch inference over a data frame with customKernelSHAP.Options. -
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
-
regression
Returns the value of theregressionrecord component.- Returns:
- the value of the
regressionrecord component
-
train
-
validation
Returns the value of thevalidationrecord component.- Returns:
- the value of the
validationrecord component
-
test
-
tags
Returns the value of thetagsrecord component.
-