Package paramz :: Package examples :: Module ridge_regression :: Class RidgeRegression
[hide private]
[frames] | no frames]

Class RidgeRegression

source code


Ridge regression with regularization.

For any regularization to work we to gradient based optimization.

Instance Methods [hide private]
 
__init__(self, X, Y, regularizer=None, basis=None, name='ridge_regression')
:param array-like X: the inputs X of the regression problem :param array-like Y: the outputs Y :param :py:class:`paramz.examples.ridge_regression.Regularizer` regularizer: the regularizer to use :param str name: the name of this regression object
source code
 
phi(self, Xpred, degrees=None)
Compute the design matrix for this model using the degrees given by the index array in degrees
source code
 
parameters_changed(self)
This method gets called when parameters have changed.
source code
 
objective_function(self)
The objective function for the given algorithm.
source code
 
predict(self, Xnew) source code

Inherited from model.Model: __str__, _repr_html_, objective_function_gradients, optimize, optimize_restarts

Inherited from parameterized.Parameterized: __getitem__, __setattr__, __setitem__, __setstate__, build_pydot, copy, get_property_string, grep_param_names, link_parameter, link_parameters, unlink_parameter

Inherited from core.parameter_core.Parameterizable: disable_caching, enable_caching, initialize_parameter, save, traverse, traverse_parents

Inherited from core.parameter_core.OptimizationHandlable: parameter_names, parameter_names_flat, randomize

Inherited from core.constrainable.Constrainable: constrain, constrain_bounded, constrain_fixed, constrain_negative, constrain_positive, fix, unconstrain, unconstrain_bounded, unconstrain_fixed, unconstrain_negative, unconstrain_positive, unfix

Inherited from core.indexable.Indexable: add_index_operation, remove_index_operation

Inherited from core.nameable.Nameable: hierarchy_name

Inherited from core.gradcheckable.Gradcheckable: checkgrad

Inherited from core.pickleable.Pickleable: __deepcopy__, __getstate__, pickle

Inherited from core.parentable.Parentable: has_parent

Inherited from core.updateable.Updateable: toggle_update, trigger_update, update_model, update_toggle

Inherited from core.observable.Observable: add_observer, change_priority, notify_observers, remove_observer, set_updates

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from model.Model (private): _allowed_failures, _fail_count

Inherited from core.parentable.Parentable: _parent_, _parent_index_

Properties [hide private]
  weights
  degree
  _phi

Inherited from parameterized.Parameterized: flattened_parameters

Inherited from parameterized.Parameterized (private): _description_str

Inherited from core.parameter_core.Parameterizable: gradient, num_params, param_array, unfixed_param_array

Inherited from core.parameter_core.OptimizationHandlable: gradient_full, optimizer_array

Inherited from core.constrainable.Constrainable: is_fixed

Inherited from core.nameable.Nameable: name

Inherited from core.parentable.Parentable: _highest_parent_

Inherited from object: __class__

Method Details [hide private]

__init__(self, X, Y, regularizer=None, basis=None, name='ridge_regression')
(Constructor)

source code 

:param array-like X: the inputs X of the regression problem :param array-like Y: the outputs Y :param :py:class:`paramz.examples.ridge_regression.Regularizer` regularizer: the regularizer to use :param str name: the name of this regression object

Overrides: object.__init__

phi(self, Xpred, degrees=None)

source code 

Compute the design matrix for this model using the degrees given by the index array in degrees

:param array-like Xpred: inputs to compute the design matrix for :param array-like degrees: array of degrees to use [default=range(self.degree+1)] :returns array-like phi: The design matrix [degree x #samples x #dimensions]

parameters_changed(self)

source code 

This method gets called when parameters have changed. Another way of listening to param changes is to add self as a listener to the param, such that updates get passed through. See :py:function:``paramz.param.Observable.add_observer``

Overrides: core.parameter_core.Parameterizable.parameters_changed
(inherited documentation)

objective_function(self)

source code 

The objective function for the given algorithm.

This function is the true objective, which wants to be minimized. Note that all parameters are already set and in place, so you just need to return the objective function here.

For probabilistic models this is the negative log_likelihood (including the MAP prior), so we return it here. If your model is not probabilistic, just return your objective to minimize here!

Overrides: model.Model.objective_function
(inherited documentation)

Property Details [hide private]

weights

Get Method:
unreachable.weights(self)

degree

Get Method:
unreachable.degree(self)

_phi

Get Method:
unreachable._phi(self)