@@ -245,7 +245,7 @@ class GenELMClassifier(BaseELM, ClassifierMixin):
245
245
`classes_` : numpy array of shape [n_classes]
246
246
Array of class labels
247
247
248
- `elm_regressor_ ` : ELMRegressor instance
248
+ `genelm_regressor_ ` : ELMRegressor instance
249
249
Performs actual fit of binarized values
250
250
251
251
See Also
@@ -344,8 +344,8 @@ class ELMRegressor(BaseEstimator, RegressorMixin):
344
344
[1][2]
345
345
346
346
ELMRegressor is a wrapper for an GenELMRegressor that uses a
347
- RandomLayer and exposes the RandomLayer's parameters in its
348
- own constructor .
347
+ RandomLayer and passes the __init__ parameters through
348
+ to the hidden layer generated by the fit() method .
349
349
350
350
Parameters
351
351
----------
@@ -418,9 +418,11 @@ def __init__(self, n_hidden=20, alpha=0.5, rbf_width=1.0,
418
418
self .rbf_width = rbf_width
419
419
self .regressor = regressor
420
420
421
- self ._genelm_regressor_ = None
421
+ self ._genelm_regressor = None
422
422
423
423
def _create_random_layer (self ):
424
+ """Pass init params to RandomLayer"""
425
+
424
426
return RandomLayer (n_hidden = self .n_hidden ,
425
427
alpha = self .alpha , random_state = self .random_state ,
426
428
activation_func = self .activation_func ,
@@ -449,9 +451,9 @@ def fit(self, X, y):
449
451
Returns an instance of self.
450
452
"""
451
453
rhl = self ._create_random_layer ()
452
- self .genelm_regressor_ = GenELMRegressor (hidden_layer = rhl ,
454
+ self ._genelm_regressor = GenELMRegressor (hidden_layer = rhl ,
453
455
regressor = self .regressor )
454
- self .genelm_regressor_ .fit (X , y )
456
+ self ._genelm_regressor .fit (X , y )
455
457
return self
456
458
457
459
def predict (self , X ):
@@ -467,10 +469,10 @@ def predict(self, X):
467
469
C : numpy array of shape [n_samples, n_outputs]
468
470
Predicted values.
469
471
"""
470
- if (self .genelm_regressor_ is None ):
472
+ if (self ._genelm_regressor is None ):
471
473
raise ValueError ("SimpleELMRegressor not fitted" )
472
474
473
- return self .genelm_regressor_ .predict (X )
475
+ return self ._genelm_regressor .predict (X )
474
476
475
477
476
478
class ELMClassifier (ELMRegressor ):
@@ -486,8 +488,8 @@ class ELMClassifier(ELMRegressor):
486
488
data, then uses the superclass to compute the decision function that
487
489
is then unbinarized to yield the prediction.
488
490
489
- The RandomLayer used for the input transform are exposed in the
490
- ELMClassifier constructor.
491
+ The params for the RandomLayer used in the input transform are
492
+ exposed in the ELMClassifier constructor.
491
493
492
494
Parameters
493
495
----------
@@ -609,5 +611,8 @@ def predict(self, X):
609
611
return class_predictions
610
612
611
613
def score (self , X , y ):
614
+ """Force use of accuracy score since we don't inherit
615
+ from ClassifierMixin"""
616
+
612
617
from sklearn .metrics import accuracy_score
613
618
return accuracy_score (y , self .predict (X ))
0 commit comments