pyoselm.layer.GRBFRandomLayer

class pyoselm.layer.GRBFRandomLayer(n_hidden=20, grbf_lambda=0.001, centers=None, radii=None, random_state=None)[source]

Random Generalized RBF Hidden Layer transformer

Creates a layer of radial basis function units where:

f(a), s.t. a = ||x-c||/r

with c the unit center and f() is exp(-gamma * a^tau) where tau and r are computed based on [1]

Parameters
  • n_hidden (int, optional (default=20)) – Number of units to generate, ignored if centers are provided

  • grbf_lambda (float, optional (default=0.05)) – GRBF shape parameter

  • gamma ({int, float} optional (default=1.0)) – Width multiplier for GRBF distance argument

  • centers (array of shape (n_hidden, n_features), optional (default=None)) – If provided, overrides internal computation of the centers

  • radii (array of shape (n_hidden), optional (default=None)) – If provided, overrides internal computation of the radii

  • use_exemplars (bool, optional (default=False)) – If True, uses random examples from the input to determine the RBF centers, ignored if centers are provided

  • random_state (int or RandomState instance, optional (default=None)) – Control the pseudo random number generator used to generate the centers at fit time, ignored if centers are provided

`components_`

radii_ : numpy array of shape [n_hidden] centers_ : numpy array of shape [n_hidden, n_features]

Type

dictionary containing two keys:

`input_activations_`

Array containing ||x-c||/r for all samples

Type

numpy array of shape [n_samples, n_hidden]

See also

ELMRegressor, ELMClassifier, SimpleELMRegressor, SimpleELMClassifier, SimpleRandomLayer

References

1

Fernandez-Navarro, et al, “MELM-GRBF: a modified version of the extreme learning machine for generalized radial basis function neural networks”, Neurocomputing 74 (2011), 2502-2510

__init__(n_hidden=20, grbf_lambda=0.001, centers=None, radii=None, random_state=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([n_hidden, grbf_lambda, centers, …])

Initialize self.

activation_func_names()

Get list of internal activation function names

fit(X[, y])

Generate a random hidden layer.

fit_transform(X[, y])

Fit to data, then transform it.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

transform(X[, y])

Generate the random hidden layer’s activations given X as input.

classmethod activation_func_names()

Get list of internal activation function names

fit(X, y=None)

Generate a random hidden layer.

Parameters
  • X ({array-like, sparse matrix} of shape [n_samples, n_features]) – Training set: only the shape is used to generate random component values for hidden units

  • y (not used: placeholder to allow for usage in a Pipeline.) –

Returns

Return type

self

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) – Target values (None for unsupervised transformations).

  • **fit_params (dict) – Additional fit parameters.

Returns

X_new – Transformed array.

Return type

ndarray array of shape (n_samples, n_features_new)

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

dict

set_params(**params)

Set the parameters of this estimator.

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

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance

transform(X, y=None)

Generate the random hidden layer’s activations given X as input.

Parameters
  • X ({array-like, sparse matrix}, shape [n_samples, n_features]) – Data to transform

  • y (not used: placeholder to allow for usage in a Pipeline.) –

Returns

X_new

Return type

numpy array of shape [n_samples, n_components]