gfdl.model.EnsembleGFDLClassifier#
- class EnsembleGFDLClassifier(hidden_layer_sizes: ArrayLike = (100,), activation: str = 'identity', weight_scheme: str = 'uniform', seed: int = None, reg_alpha: float = None, rtol: float = None, voting: str = 'soft')[source]#
Ensemble random vector functional link network classifier.
- Parameters:
- hidden_layer_sizesarray-like of shape (n_layers,)
The ith element represents the number of neurons in the ith hidden layer.
- activationstr, default=’identity’
Activation function for the hidden layers.
‘identity’, no-op activation, useful to implement linear bottleneck, returns f(x) = x
‘tanh’:
tanh.‘relu’:
relu.‘sigmoid’:
sigmoid.‘softmax’:
softmax.‘softmin’:
softmin.‘log_sigmoid’:
log_sigmoid.‘log_softmax’:
log_softmax.
- weight_schemestr, default=’uniform’
Distribution used to initialize the random hidden-layer weights.
The initialization functions generate weight matrices of shape (n_hidden_units, n_features), where values are drawn according to the selected scheme.
‘zeros’: set weights to zeros (
zeros).‘range’: set weights to normalized np.arange (
range).‘uniform’: uniform distribution (
uniform).‘he_uniform’: He uniform distribution (
he_uniform).‘lecun_uniform’: Lecun uniform distribution (
lecun_uniform).‘glorot_uniform’: Glorot uniform distribution (
glorot_uniform).‘normal’: Normal distribution (
normal).‘he_normal’: He normal distribution (
he_normal).‘lecun_normal’: Lecun normal distribution (
lecun_normal).‘glorot_normal’: Glorot normal distribution (
glorot_normal).
- seedint, default=`None`
Random seed used to initialize the network.
- reg_alphafloat, default=`None`
When None, use Moore-Penrose inversion to solve for the output weights of the network. Otherwise, it specifies the constant that multiplies the L2 term of sklearn Ridge, controlling the regularization strength. reg_alpha must be a non-negative float.
- rtolfloat, default=None
Cutoff for small singular values for the Moore-Penrose pseudo-inverse. Only applies when
reg_alpha=None. Whenrtol=None, the array API standard default forpinvis used.- votingstr, default=`”soft”`
Whether to use soft or hard voting in the ensemble.
Methods
fit(X, y)Train the ensemble of connected RVFL networks on the training set (X, y).
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
predict(X)Predict class for X.
predict_proba(X)Predict class probabilities for X.
score(X, y[, sample_weight])Return accuracy on provided data and labels.
set_params(**params)Set the parameters of this estimator.
set_score_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
scoremethod.get_generator
Notes
The implementation is based on the one described by Shi et al. in [1].
References
[1]Shi, Katuwal, Suganthan, Tanveer, “Random vector functional link neural network based ensemble deep learning.” Pattern Recognition, vol. 117, pp. 107978, 2021, https://doi.org/10.1016/j.patcog.2021.107978.
Examples
>>> from sklearn.datasets import make_classification >>> from gfdl.model import EnsembleGFDLClassifier >>> X, y = make_classification(n_samples=1000, n_features=4, ... n_informative=2, n_redundant=0, ... random_state=0, shuffle=False) >>> clf = EnsembleGFDLClassifier(seed=0) >>> clf.fit(X, y) >>> print(clf.predict([[0, 0, 0, 0]])) [1]
- __init__(hidden_layer_sizes: ArrayLike = (100,), activation: str = 'identity', weight_scheme: str = 'uniform', seed: int = None, reg_alpha: float = None, rtol: float = None, voting: str = 'soft')[source]#
Methods
__init__([hidden_layer_sizes, activation, ...])fit(X, y)Train the ensemble of connected RVFL networks on the training set (X, y).
get_generator(seed)get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
predict(X)Predict class for X.
predict_proba(X)Predict class probabilities for X.
score(X, y[, sample_weight])Return accuracy on provided data and labels.
set_params(**params)Set the parameters of this estimator.
set_score_request(*[, sample_weight])Configure whether metadata should be requested to be passed to the
scoremethod.