Module ONORMA

operalib.ridge implements Operator-valued Naive Online Regularised Risk Minimization Algorithm (ONORMA)

class operalib.onorma.ONORMA(kernel='DGauss', lbda=1e-05, T=None, A=None, learning_rate='invscaling', truncation=None, gamma=None, mu=0.2, eta=1.0, power=0.5, shuffle=True, random_state=0)[source]

Operator-valued Naive Online Regularised Risk Minimization Algorithm .

Operator-Valued kernel Operator-valued Naive Online Regularised Risk Minimization Algorithm (ONORMA) extends the standard kernel-based online learning algorithm NORMA from scalar-valued to operator-valued setting. The truncation is currently not implemented.

See also

sklearn.Ridge
Linear ridge regression.
sklearn.KernelRidge
Kernel ridge regression.
sklearn.SVR
Support Vector Regression implemented using libsvm.

References

  • Audiffren, Julien, and Hachem Kadri. “Online learning with multiple operator-valued kernels.” arXiv preprint arXiv:1311.0222 (2013).
  • Kivinen, Jyrki, Alexander J. Smola, and Robert C. Williamson. “Online learning with kernels.” IEEE transactions on signal processing 52.8 (2004): 2165-2176.

Examples

>>> import operalib as ovk
>>> import numpy as np
>>> n_samples, n_features, n_targets = 10, 5, 5
>>> rng = np.random.RandomState(0)
>>> y = rng.randn(n_samples, n_targets)
>>> X = rng.randn(n_samples, n_features)
>>> clf = ovk.ONORMA('DGauss', lbda=1.)
>>> clf.fit(X, y)  
ONORMA(A=None, T=None, eta=1.0, gamma=None, kernel='DGauss', lbda=1.0,
       learning_rate='invscaling', mu=0.2, power=0.5, random_state=0,
       shuffle=True, truncation=None)
Attributes:
coef_ : array, shape = [n_features] or [n_targets, n_features]

Weight vector(s) in kernel space

linop_ : callable

Callable which associate to the training points X the Gram matrix (the Gram matrix being a LinearOperator)

A_ : array, shape = [n_targets, n_targets]

Set when Linear operator used by the decomposable kernel is default or None.

T_ : integer

Total number of iterations

n_ : integer

Total number of datapoints

p_ : integer

Dimensionality of the outputs

Methods

fit(X, y) Fit ONORMA model.
get_params([deep]) Get parameters for this estimator.
partial_fit(X, y) Partial fit of ONORMA model.
predict(X) Predict using ONORMA model.
score(X, y[, sample_weight]) Returns the coefficient of determination R^2 of the prediction.
set_params(**params) Set the parameters of this estimator.
fit(X, y)[source]

Fit ONORMA model.

Parameters:
X : {array-like, sparse matrix}, shape = [n_samples, n_features]

Training data.

y : {array-like}, shape = [n_samples] or [n_samples, n_targets]

Target values.

Returns:
self : returns an instance of self.
get_params(deep=True)

Get parameters for this estimator.

Parameters:
deep : boolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:
params : mapping of string to any

Parameter names mapped to their values.

partial_fit(X, y)[source]

Partial fit of ONORMA model.

This method is usefull for online learning for instance. Must call

Parameters:
X : {array-like, sparse matrix}, shape = [n_samples, n_features]

Training data.

y : {array-like}, shape = [n_samples] or [n_samples, n_targets]

Target values.

Returns:
self : returns an instance of self.
predict(X)[source]

Predict using ONORMA model.

Parameters:
X : {array-like, sparse matrix}, shape = [n_samples, n_features]

Samples.

Returns:
C : {array}, shape = [n_samples] or [n_samples, n_targets]

Returns predicted values.

score(X, y, sample_weight=None)

Returns the coefficient of determination R^2 of the prediction.

The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.

Parameters:
X : array-like, shape = (n_samples, n_features)

Test samples.

y : array-like, shape = (n_samples) or (n_samples, n_outputs)

True values for X.

sample_weight : array-like, shape = [n_samples], optional

Sample weights.

Returns:
score : float

R^2 of self.predict(X) wrt. y.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
self