Class DataFrameRegression.VectorDataFrameRegression

java.lang.Object
smile.regression.DataFrameRegression.VectorDataFrameRegression
All Implemented Interfaces:
Serializable, ToDoubleFunction<Tuple>, SHAP<Tuple>, DataFrameRegression, Regression<Tuple>
Enclosing interface:
DataFrameRegression

public static final class DataFrameRegression.VectorDataFrameRegression extends Object implements DataFrameRegression, SHAP<Tuple>, Serializable
Adapter wrapping a vector Regression<double[]> as a DataFrameRegression with SHAP<Tuple> support.
See Also:
  • Method Details

    • formula

      public Formula formula()
      Description copied from interface: DataFrameRegression
      Returns the model formula.
      Specified by:
      formula in interface DataFrameRegression
      Returns:
      the model formula.
    • schema

      public StructType schema()
      Description copied from interface: DataFrameRegression
      Returns the schema of predictors.
      Specified by:
      schema in interface DataFrameRegression
      Returns:
      the schema of predictors.
    • predict

      public double predict(Tuple x)
      Description copied from interface: Regression
      Predicts the dependent variable of an instance.
      Specified by:
      predict in interface Regression<Tuple>
      Parameters:
      x - an instance.
      Returns:
      the predicted value of dependent variable.
    • online

      public boolean online()
      Description copied from interface: Regression
      Returns true if this is an online learner.
      Specified by:
      online in interface Regression<Tuple>
      Returns:
      true if online learner.
    • update

      public void update(Tuple x, double y)
      Description copied from interface: Regression
      Online update the classifier with a new training instance. In general, this method may be NOT multi-thread safe.
      Specified by:
      update in interface Regression<Tuple>
      Parameters:
      x - the training instance.
      y - the response variable.
    • shap

      public double[] shap(Tuple x)
      Description copied from interface: SHAP
      Returns the SHAP values. For regression, the length of SHAP values is same as the number of features. For classification, SHAP values are of p x k, where p is the number of features and k is the classes. The first k elements are the SHAP values of first feature over k classes, respectively. The rest features follow accordingly.
      Specified by:
      shap in interface SHAP<Tuple>
      Parameters:
      x - an instance.
      Returns:
      the SHAP values.
    • shap

      public double[] shap(Tuple x, KernelSHAP.Options options)
      Description copied from interface: SHAP
      Returns the SHAP values with custom KernelSHAP.Options (ignored by exact explainers such as TreeSHAP and linear SHAP).
      Specified by:
      shap in interface SHAP<Tuple>
      Parameters:
      x - an instance.
      options - the KernelSHAP options, or null to use default options.
      Returns:
      the SHAP values.