Model¶
This section documents the model components of the linear_model module.
model
¶
Defines sklearn.linear_model models interoperability.
This module provides functions to create scikit-learn linear model instances from Nextmv options.
FUNCTION | DESCRIPTION |
---|---|
LinearRegression |
Creates a scikit-learn LinearRegression model from Nextmv options. |
LinearRegression
¶
LinearRegression(options: Options) -> LinearRegression
Creates a sklearn.linear_model.LinearRegression
from the provided
options.
You can import the LinearRegression
function directly from linear_model
:
This function takes a Nextmv options object and configures a scikit-learn LinearRegression model with the appropriate parameters. It extracts parameter values from the options object that match the expected parameters for LinearRegression.
PARAMETER | DESCRIPTION |
---|---|
|
Options for the LinearRegression. Can include the following parameters:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
LinearRegression
|
A scikit-learn LinearRegression instance configured with the parameters from the options. |
Examples:
>>> from nextmv_sklearn.linear_model.options import LinearRegressionOptions
>>> options = LinearRegressionOptions().to_nextmv()
>>> # Modify options if needed
>>> options.fit_intercept = False
>>> model = LinearRegression(options)