medusa.analysis
#
Module Contents#
- class medusa.analysis.LinearRegression(add_intercept=True)[source]#
Linear regression model with normal equations, using PyTorch.
- Parameters:
add_intercept (bool) – Whether to add an intercept term to the model
- coef_#
The model coefficients, including the intercept if applicable
- Type:
torch.tensor
- fit(X, Y)[source]#
Fits the model to the data (X, Y).
- Parameters:
X (torch.tensor) – The input data, with shape (n_samples, n_features)
Y (torch.tensor) – The output data, with shape (n_samples, n_outputs)
- predict(X)[source]#
Predicts the output for the given input data.
- Parameters:
X (torch.tensor) – The input data, with shape (n_samples, n_features)
- Returns:
Y_hat – The predicted output data, with shape (n_samples, n_outputs)
- Return type:
torch.tensor
- predict_from_range(range_=(- 1, 1), steps=100)[source]#
Predicts the output for the given input range.
- Parameters:
range (tuple) – The range of input values to predict over
steps (int) – The number of steps to take between the range’s start and end
- Returns:
Y_hat – The predicted output data, with shape (n_samples, n_outputs)
- Return type:
torch.tensor