tensorly.regression.cp_regression
.CPRegressor
- class CPRegressor(weight_rank, tol=1e-06, reg_W=1, n_iter_max=100, random_state=None, verbose=1)[source]
CP tensor regression
Learns a low rank CP tensor weight
- Parameters:
- weight_rankint
rank of the CP decomposition of the regression weights
- tolfloat
convergence value
- reg_Wfloat, optional, default is 1
l2 regularisation constant for the regression weights (\(reg_W * \sum_i ||factors[i]||_F^2\))
- n_iter_maxint, optional, default is 100
maximum number of iteration
- random_stateNone, int or RandomState, optional, default is None
- verboseint, default is 1
level of verbosity
- fit(X, y)[source]
Fits the model to the data (X, y)
- Parameters:
- Xtensor data of shape (n_samples, I_1, …, I_p)
- ytensor of shape (n_samples, O_1, …, O_q)
labels associated with each sample
- Returns:
- self
- get_params(**kwargs)[source]
Returns a dictionary of parameters
- predict(X)[source]
Returns the predicted labels for a new data tensor
- Parameters:
- Xndarray
tensor data of shape (n_samples, I_1, …, I_p)
- set_params(**parameters)[source]
Sets the value of the provided parameters