99ELMRegressor, SimpleELMRegressor, SimpleELMClassifier). 
1010
1111An Extreme Learning Machine (ELM) is a single layer feedforward 
12- network with a random hidden layer components and least-squares fitting 
13- of the hidden->output weights by default. [1][2] 
12+ network with a random hidden layer components and ordinary linear 
13+ least squares fitting of the hidden->output weights by default. 
14+ [1][2] 
1415
1516References 
1617---------- 
2324from  abc  import  ABCMeta , abstractmethod 
2425
2526import  numpy  as  np 
26- from  scipy .linalg  import  pinv2 
2727
2828from  sklearn .utils  import  as_float_array 
29- from  sklearn .utils .extmath  import  safe_sparse_dot 
3029from  sklearn .base  import  BaseEstimator , ClassifierMixin , RegressorMixin 
3130from  sklearn .preprocessing  import  LabelBinarizer 
31+ from  sklearn .linear_model  import  LinearRegression 
3232
3333from  random_hidden_layer  import  SimpleRandomHiddenLayer 
3434
@@ -96,18 +96,19 @@ class ELMRegressor(BaseELM, RegressorMixin):
9696    ELMRegressor is a regressor based on the Extreme Learning Machine. 
9797
9898    An Extreme Learning Machine (ELM) is a single layer feedforward 
99-     network with a random hidden layer components and least-squares fitting 
100-     of the hidden->output weights by default. [1][2] 
99+     network with a random hidden layer components and ordinary linear 
100+     least squares fitting of the hidden->output weights by default. 
101+     [1][2] 
101102
102103    Parameters 
103104    ---------- 
104105    `hidden_layer` : random_hidden_layer instance, optional 
105106        (default=SimpleRandomHiddenLayer(random_state=0)) 
106107
107-     `regressor`    : linear_model  instance, optional (default=None) 
108+     `regressor`    : regressor  instance, optional (default=None) 
108109        If provided, this object is used to perform the regression from hidden 
109110        unit activations to the outputs and subsequent predictions.  If not 
110-         present, a simple  least squares fit is performed internally.  
111+         present, an ordinary linear  least squares fit is performed 
111112
112113    Attributes 
113114    ---------- 
@@ -139,14 +140,19 @@ def __init__(self,
139140
140141        super (ELMRegressor , self ).__init__ (hidden_layer , regressor )
141142
142-         self .coefs_  =  None 
143143        self .fitted_  =  False 
144144        self .hidden_activations_  =  None 
145+         self ._lin_reg  =  LinearRegression (copy_X = False ,
146+                                          normalize = False ,
147+                                          fit_intercept = False )
145148
146149    def  _fit_regression (self , y ):
147-         """fit regression using internal least squares/supplied regressor""" 
150+         """ 
151+         fit regression using internal linear regression 
152+         or supplied regressor 
153+         """ 
148154        if  (self .regressor  is  None ):
149-             self .coefs_   =   safe_sparse_dot ( pinv2 ( self .hidden_activations_ ) , y )
155+             self ._lin_reg . fit ( self .hidden_activations_ , y )
150156        else :
151157            self .regressor .fit (self .hidden_activations_ , y )
152158
@@ -183,7 +189,7 @@ def fit(self, X, y):
183189    def  _get_predictions (self , X ):
184190        """get predictions using internal least squares/supplied regressor""" 
185191        if  (self .regressor  is  None ):
186-             preds  =  safe_sparse_dot ( self .hidden_activations_ ,  self .coefs_ )
192+             preds  =  self ._lin_reg . predict ( self .hidden_activations_ )
187193        else :
188194            preds  =  self .regressor .predict (self .hidden_activations_ )
189195
@@ -219,18 +225,19 @@ class ELMClassifier(BaseELM, ClassifierMixin):
219225    ELMClassifier is a classifier based on the Extreme Learning Machine. 
220226
221227    An Extreme Learning Machine (ELM) is a single layer feedforward 
222-     network with a random hidden layer components and least-squares fitting 
223-     of the hidden->output weights by default. [1][2] 
228+     network with a random hidden layer components and ordinary linear 
229+     least squares fitting of the hidden->output weights by default. 
230+     [1][2] 
224231
225232    Parameters 
226233    ---------- 
227234    `hidden_layer` : random_hidden_layer instance, optional 
228235        (default=SimpleRandomHiddenLayer(random_state=0)) 
229236
230-     `regressor`    : linear_model  instance, optional (default=None) 
237+     `regressor`    : regressor  instance, optional (default=None) 
231238        If provided, this object is used to perform the regression from hidden 
232239        unit activations to the outputs and subsequent predictions.  If not 
233-         present, a simple  least squares fit is performed internally.  
240+         present, an ordinary linear  least squares fit is performed 
234241
235242    Attributes 
236243    ---------- 
@@ -333,8 +340,9 @@ class SimpleELMRegressor(BaseEstimator, RegressorMixin):
333340    SimpleELMRegressor is a regressor based on the Extreme Learning Machine. 
334341
335342    An Extreme Learning Machine (ELM) is a single layer feedforward 
336-     network with a random hidden layer components and least-squares fitting 
337-     of the hidden->output weights by default. [1][2] 
343+     network with a random hidden layer components and ordinary linear 
344+     least squares fitting of the hidden->output weights by default. 
345+     [1][2] 
338346
339347    SimpleELMRegressor is a wrapper for an ELMRegressor that uses a 
340348    SimpleRandomHiddenLayer and passes the __init__ parameters through 
@@ -345,14 +353,14 @@ class SimpleELMRegressor(BaseEstimator, RegressorMixin):
345353    `n_hidden` : int, optional (default=20) 
346354        Number of units to generate in the SimpleRandomHiddenLayer 
347355
348-     `xfer_func ` : {callable, string} optional (default='tanh') 
356+     `activation_func ` : {callable, string} optional (default='tanh') 
349357        Function used to transform input activation 
350358        It must be one of 'tanh', 'sine', 'tribas', 'sigmoid', 'hardlim' or 
351359        a callable.  If none is given, 'tanh' will be used. If a callable 
352360        is given, it will be used to compute the hidden unit activations. 
353361
354-     `xfer_args ` : dictionary, optional (default=None) 
355-         Supplies keyword arguments for a callable xfer_func  
362+     `activation_args ` : dictionary, optional (default=None) 
363+         Supplies keyword arguments for a callable activation_func  
356364
357365    `random_state`  : int, RandomState instance or None (default=None) 
358366        Control the pseudo random number generator used to generate the 
@@ -376,12 +384,13 @@ class SimpleELMRegressor(BaseEstimator, RegressorMixin):
376384              2006. 
377385    """ 
378386
379-     def  __init__ (self , n_hidden = 20 , xfer_func = 'tanh' , xfer_args = None ,
387+     def  __init__ (self , n_hidden = 20 ,
388+                  activation_func = 'tanh' , activation_args = None ,
380389                 random_state = None ):
381390
382391        self .n_hidden  =  n_hidden 
383-         self .xfer_func  =  xfer_func 
384-         self .xfer_args  =  xfer_args 
392+         self .activation_func  =  activation_func 
393+         self .activation_args  =  activation_args 
385394        self .random_state  =  random_state 
386395
387396        self .elm_regressor_  =  None 
@@ -407,8 +416,8 @@ def fit(self, X, y):
407416            Returns an instance of self. 
408417        """ 
409418        rhl  =  SimpleRandomHiddenLayer (n_hidden = self .n_hidden ,
410-                                       xfer_func = self .xfer_func ,
411-                                       xfer_args = self .xfer_args ,
419+                                       activation_func = self .activation_func ,
420+                                       activation_args = self .activation_args ,
412421                                      random_state = self .random_state )
413422
414423        self .elm_regressor_  =  ELMRegressor (hidden_layer = rhl )
@@ -440,8 +449,9 @@ class SimpleELMClassifier(BaseEstimator, ClassifierMixin):
440449    SimpleELMClassifier is a classifier based on the Extreme Learning Machine. 
441450
442451    An Extreme Learning Machine (ELM) is a single layer feedforward 
443-     network with a random hidden layer components and least-squares fitting 
444-     of the hidden->output weights by default. [1][2] 
452+     network with a random hidden layer components and ordinary linear 
453+     least squares fitting of the hidden->output weights by default. 
454+     [1][2] 
445455
446456    SimpleELMClassifier is a wrapper for an ELMClassifier that uses a 
447457    SimpleRandomHiddenLayer and passes the __init__ parameters through 
@@ -452,14 +462,14 @@ class SimpleELMClassifier(BaseEstimator, ClassifierMixin):
452462    `n_hidden` : int, optional (default=20) 
453463        Number of units to generate in the SimpleRandomHiddenLayer 
454464
455-     `xfer_func ` : {callable, string} optional (default='tanh') 
465+     `activation_func ` : {callable, string} optional (default='tanh') 
456466        Function used to transform input activation 
457467        It must be one of 'tanh', 'sine', 'tribas', 'sigmoid', 'hardlim' or 
458468        a callable.  If none is given, 'tanh' will be used. If a callable 
459469        is given, it will be used to compute the hidden unit activations. 
460470
461-     `xfer_args ` : dictionary, optional (default=None) 
462-         Supplies keyword arguments for a callable xfer_func  
471+     `activation_args ` : dictionary, optional (default=None) 
472+         Supplies keyword arguments for a callable activation_func  
463473
464474    `random_state`  : int, RandomState instance or None (default=None) 
465475        Control the pseudo random number generator used to generate the 
@@ -486,12 +496,13 @@ class SimpleELMClassifier(BaseEstimator, ClassifierMixin):
486496              2006. 
487497    """ 
488498
489-     def  __init__ (self , n_hidden = 20 , xfer_func = 'tanh' , xfer_args = None ,
499+     def  __init__ (self , n_hidden = 20 ,
500+                  activation_func = 'tanh' , activation_args = None ,
490501                 random_state = None ):
491502
492503        self .n_hidden  =  n_hidden 
493-         self .xfer_func  =  xfer_func 
494-         self .xfer_args  =  xfer_args 
504+         self .activation_func  =  activation_func 
505+         self .activation_args  =  activation_args 
495506        self .random_state  =  random_state 
496507
497508        self .elm_classifier_  =  None 
@@ -538,8 +549,8 @@ def fit(self, X, y):
538549            Returns an instance of self. 
539550        """ 
540551        rhl  =  SimpleRandomHiddenLayer (n_hidden = self .n_hidden ,
541-                                       xfer_func = self .xfer_func ,
542-                                       xfer_args = self .xfer_args ,
552+                                       activation_func = self .activation_func ,
553+                                       activation_args = self .activation_args ,
543554                                      random_state = self .random_state )
544555
545556        self .elm_classifier_  =  ELMClassifier (hidden_layer = rhl )
0 commit comments