GeneralizedLinearModel (Spark 3.5.5 JavaDoc) (original) (raw)
Object
- org.apache.spark.mllib.regression.GeneralizedLinearModel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LassoModel, LinearRegressionModel, LogisticRegressionModel, RidgeRegressionModel, SVMModel
public abstract class GeneralizedLinearModel
extends Object
implements scala.Serializable
GeneralizedLinearModel (GLM) represents a model trained using GeneralizedLinearAlgorithm. GLMs consist of a weight vector and an intercept.
param: weights Weights computed for every feature. param: intercept Intercept computed for this model.
See Also:
Serialized Form
Constructor Summary
Constructors
Constructor and Description GeneralizedLinearModel(Vector weights, double intercept) Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method and Description double intercept() RDD predict(RDD<Vector> testData) Predict values for the given data set using the model trained. double predict(Vector testData) Predict values for a single data point using the model trained. String toString() Print a summary of the model. Vector weights() * ### Methods inherited from class Object `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`
Constructor Detail
* #### GeneralizedLinearModel public GeneralizedLinearModel([Vector](../../../../../org/apache/spark/mllib/linalg/Vector.html "interface in org.apache.spark.mllib.linalg") weights, double intercept)
Method Detail
* #### intercept public double intercept() * #### predict public [RDD](../../../../../org/apache/spark/rdd/RDD.html "class in org.apache.spark.rdd")<Object> predict([RDD](../../../../../org/apache/spark/rdd/RDD.html "class in org.apache.spark.rdd")<[Vector](../../../../../org/apache/spark/mllib/linalg/Vector.html "interface in org.apache.spark.mllib.linalg")> testData) Predict values for the given data set using the model trained. Parameters: `testData` \- RDD representing data points to be predicted Returns: RDD\[Double\] where each entry contains the corresponding prediction * #### predict public double predict([Vector](../../../../../org/apache/spark/mllib/linalg/Vector.html "interface in org.apache.spark.mllib.linalg") testData) Predict values for a single data point using the model trained. Parameters: `testData` \- array representing a single data point Returns: Double prediction from the trained model * #### toString public String toString() Print a summary of the model. Overrides: `toString` in class `Object` Returns: (undocumented) * #### weights public [Vector](../../../../../org/apache/spark/mllib/linalg/Vector.html "interface in org.apache.spark.mllib.linalg") weights()