Lasso Fista cross-validation

class mrinversion.linear_model.LassoFistaCV(lambdas, folds=10, max_iterations=50000, tolerance=0.0052, positive=True, sigma=0.0, randomize=False, times=1, inverse_dimension=None, n_jobs=2)[source]

Bases: object

Methods Documentation

fit(K, s)[source]

Fit the model using the coordinate descent method from scikit-learn for all alpha anf lambda values using the n-folds cross-validation technique. The cross-validation metric is the mean squared error.

Parameters:
  • K – A \(m \times n\) kernel matrix, \({\bf K}\). A numpy array of shape (m, n).

  • s – A \(m \times m_\text{count}\) signal matrix, \({\bf s}\) as a csdm object or a numpy array or shape (m, m_count).

predict(K)[source]

Predict the signal using the linear model.

Parameters:

K (ndarray) – A \(m \times n\) kernel matrix, \({\bf K}\). A numpy array of shape (m, n).

Returns:

A numpy array of shape (m, m_count) with the predicted values

Return type:

ndarray

residuals(K, s)[source]

Return the residual as the difference the data and the predicted data(fit), following

(23)\[\text{residuals} = {\bf s - Kf^*}\]

where \({\bf f^*}\) is the optimum solution.

Parameters:
  • K (ndarray.) – A \(m \times n\) kernel matrix, \({\bf K}\). A numpy array of shape (m, n).

  • s (ndarray ot CSDM object.) – A csdm object or a \(m \times m_\text{count}\) signal matrix, \({\bf s}\).

Returns:

If s is a csdm object, returns a csdm object with the residuals. If s is a numpy array, return a \(m \times m_\text{count}\) residue matrix. csdm object

Return type:

ndarray or CSDM object.

cv_plot()[source]

Plot the CV plot