glassbox.models.linear_model._base¶
Abstract BaseLinearModel.
BaseLinearModel
¶
Bases: BaseModel
Abstract base class for linear models trained with gradient-based optimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rate
|
float
|
Initial learning rate used by the optimizer. |
0.01
|
max_epochs
|
int
|
Maximum number of optimization epochs. |
1000
|
tol
|
float
|
Convergence tolerance used by stopping criteria. |
1e-6
|
schedule
|
LearningSchedule
|
Strategy used to update the learning rate across epochs. |
LearningSchedule.CONSTANT
|
Initialize shared linear-model hyperparameters and learned coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rate
|
float
|
Initial learning rate used by the optimizer. |
0.01
|
max_epochs
|
int
|
Maximum number of optimization epochs. |
1000
|
tol
|
float
|
Convergence tolerance used by stopping criteria. |
1e-6
|
schedule
|
LearningSchedule
|
Strategy used to update the learning rate across epochs. |
LearningSchedule.CONSTANT
|
Source code in glassbox/models/linear_model/_base.py
fit
abstractmethod
¶
Fit the linear model to training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Training feature matrix of shape (n_samples, n_features). |
required |
y
|
ndarray
|
Training target vector of shape (n_samples,). |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The fitted model instance. |
Source code in glassbox/models/linear_model/_base.py
predict
abstractmethod
¶
Predict target values for input samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Input feature matrix of shape (n_samples, n_features). |
required |
**kwargs
|
Any
|
Additional keyword arguments for prediction. |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Predicted values of shape (n_samples,). |