@@ -245,7 +245,7 @@ class GenELMClassifier(BaseELM, ClassifierMixin):
245245 `classes_` : numpy array of shape [n_classes]
246246 Array of class labels
247247
248- `elm_regressor_ ` : ELMRegressor instance
248+ `genelm_regressor_ ` : ELMRegressor instance
249249 Performs actual fit of binarized values
250250
251251 See Also
@@ -344,8 +344,8 @@ class ELMRegressor(BaseEstimator, RegressorMixin):
344344 [1][2]
345345
346346 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 .
349349
350350 Parameters
351351 ----------
@@ -418,9 +418,11 @@ def __init__(self, n_hidden=20, alpha=0.5, rbf_width=1.0,
418418 self .rbf_width = rbf_width
419419 self .regressor = regressor
420420
421- self ._genelm_regressor_ = None
421+ self ._genelm_regressor = None
422422
423423 def _create_random_layer (self ):
424+ """Pass init params to RandomLayer"""
425+
424426 return RandomLayer (n_hidden = self .n_hidden ,
425427 alpha = self .alpha , random_state = self .random_state ,
426428 activation_func = self .activation_func ,
@@ -449,9 +451,9 @@ def fit(self, X, y):
449451 Returns an instance of self.
450452 """
451453 rhl = self ._create_random_layer ()
452- self .genelm_regressor_ = GenELMRegressor (hidden_layer = rhl ,
454+ self ._genelm_regressor = GenELMRegressor (hidden_layer = rhl ,
453455 regressor = self .regressor )
454- self .genelm_regressor_ .fit (X , y )
456+ self ._genelm_regressor .fit (X , y )
455457 return self
456458
457459 def predict (self , X ):
@@ -467,10 +469,10 @@ def predict(self, X):
467469 C : numpy array of shape [n_samples, n_outputs]
468470 Predicted values.
469471 """
470- if (self .genelm_regressor_ is None ):
472+ if (self ._genelm_regressor is None ):
471473 raise ValueError ("SimpleELMRegressor not fitted" )
472474
473- return self .genelm_regressor_ .predict (X )
475+ return self ._genelm_regressor .predict (X )
474476
475477
476478class ELMClassifier (ELMRegressor ):
@@ -486,8 +488,8 @@ class ELMClassifier(ELMRegressor):
486488 data, then uses the superclass to compute the decision function that
487489 is then unbinarized to yield the prediction.
488490
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.
491493
492494 Parameters
493495 ----------
@@ -609,5 +611,8 @@ def predict(self, X):
609611 return class_predictions
610612
611613 def score (self , X , y ):
614+ """Force use of accuracy score since we don't inherit
615+ from ClassifierMixin"""
616+
612617 from sklearn .metrics import accuracy_score
613618 return accuracy_score (y , self .predict (X ))
0 commit comments