LeaveOneOut

class LeaveOneOut(*args)

Leave-one-out model selection score.

The score is the weight-mass normalized PRESS statistic (Allen, 1974): with the weighted least-squares fit \hat{\vect{y}}, the residual r_i = y_i - \hat{y}_i and the weighted leverage h_i = w_i \psi(\vect{u}_i)^\intercal \mat{G}^{-1} \psi(\vect{u}_i) with \mat{G} = \mat{\Psi}^\intercal \mat{W} \mat{\Psi} returned by getHDiag(),

\mathrm{Err}_{\mathrm{LOO}} =
\frac{1}{\sum_{i=1}^n w_i} \sum_{i=1}^n
w_i \left(\frac{r_i}{1 - h_i}\right)^2,

relative to the weight-mass normalized output variance \sum w_i (y_i - \bar{y}_w)^2 / \sum w_i around the weighted mean. Dropping an observation is a rank-one downdate of the weighted normal equations, so the score is exact for any weights, uniform or not. Unlike CorrectedLeaveOneOut, no small-sample correction factor is applied.

Methods

getClassName()

Accessor to the object's name.

getName()

Accessor to the object's name.

hasName()

Test if the object is named.

run(*args)

Run the algorithm.

setName(name)

Accessor to the object's name.

Notes

LeaveOneOut inherits from FittingAlgorithm.

This class is not usable on its own is because it has sense only within the FunctionalChaosAlgorithm.

__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

run(*args)

Run the algorithm.

Usage:

run(x, y, weight, psi, indices)

run(x, y, psi, indices)

run(y, weight, indices, proxy)

run(y, indices, proxy)

run(method, y*)

With the first and second usages, we build the design proxy and apply the corresponding run. With the third and fourth usages, we build a least square method with the proxy and right hand size. With the fifth usage, we apply the fitting algorithm using an already defined least squares method.

Parameters:
x2-d sequence of float

Input sample

y2-d sequence of float

Output sample

weightsequence of float

Quadrature weights w_i of the least-squares inner product, of size equal to the size of the input sample

psisequence of Function

Basis

indicessequence of int

Indices of the basis

proxyDesignProxy

The design proxy

methodLeastSquaresMethod

Least square method (QR, SVD or Cholesky)

Returns:
measurefloat

Fitting measure

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.