2929""" 
3030
3131# Author: Mathieu Blondel <[email protected] > 32+ # Author: Hamzeh Alsalhi <[email protected] > 3233# 
3334# License: BSD 3 clause 
3435
4243from  .preprocessing  import  LabelBinarizer 
4344from  .metrics .pairwise  import  euclidean_distances 
4445from  .utils  import  check_random_state 
45- from  .utils .multiclass  import  type_of_target 
46- from  .utils .multiclass  import  unique_labels 
4746from  .utils .validation  import  _num_samples 
4847from  .externals .joblib  import  Parallel 
4948from  .externals .joblib  import  delayed 
@@ -94,12 +93,12 @@ def fit_ovr(estimator, X, y, n_jobs=1):
9493        An estimator object implementing `fit` and one of `decision_function` 
9594        or `predict_proba`. 
9695
97-     X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
96+     X : (sparse)  array-like, shape = [n_samples, n_features] 
9897        Data. 
9998
100-     y : { array-like, sparse matrix},  shape = [n_samples] or 
101-         [n_samples, n_classes]  Multi-class targets. An indicator matrix 
102-         turns on multilabel  classification. 
99+     y : (sparse)  array-like, shape = [n_samples] or [n_samples, n_classes]  
100+         Multi-class targets. An indicator matrix turns on multilabel  
101+         classification. 
103102
104103    Returns 
105104    ------- 
@@ -116,7 +115,7 @@ def fit_ovr(estimator, X, y, n_jobs=1):
116115    columns  =  (col .toarray ().ravel () for  col  in  Y .T )
117116    # In cases where individual estimators are very fast to train setting 
118117    # n_jobs > 1 in can results in slower performance due to the overhead 
119-     # of spawning threads. 
118+     # of spawning threads.  See joblib issue #112.  
120119    estimators  =  Parallel (n_jobs = n_jobs )(delayed (_fit_binary )
121120                                         (estimator ,
122121                                          X ,
@@ -140,13 +139,13 @@ def predict_ovr(estimators, label_binarizer, X):
140139        multiclass labels to binary labels and vice-versa. fit_ovr supplies 
141140        this object as part of its output. 
142141
143-     X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
142+     X : (sparse)  array-like, shape = [n_samples, n_features] 
144143        Data. 
145144
146145    Returns 
147146    ------- 
148-     y : { array-like, sparse matrix},  shape = [n_samples] or 
149-         [n_samples, n_classes].  Predicted multi-class targets. 
147+     y : (sparse)  array-like, shape = [n_samples] or [n_samples, n_classes].  
148+         Predicted multi-class targets. 
150149    """ 
151150    e_types  =  set ([type (e ) for  e  in  estimators  if  not 
152151                   isinstance (e , _ConstantPredictor )])
@@ -264,12 +263,12 @@ def fit(self, X, y):
264263
265264        Parameters 
266265        ---------- 
267-         X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
266+         X : (sparse)  array-like, shape = [n_samples, n_features] 
268267            Data. 
269268
270-         y : { array-like, sparse matrix},  shape = [n_samples] or 
271-             [n_samples, n_classes]  Multi-class targets. An indicator matrix 
272-             turns on multilabel  classification. 
269+         y : (sparse)  array-like, shape = [n_samples] or [n_samples, n_classes]  
270+             Multi-class targets. An indicator matrix turns on multilabel  
271+             classification. 
273272
274273        Returns 
275274        ------- 
@@ -288,13 +287,13 @@ def predict(self, X):
288287
289288        Parameters 
290289        ---------- 
291-         X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
290+         X : (sparse)  array-like, shape = [n_samples, n_features] 
292291            Data. 
293292
294293        Returns 
295294        ------- 
296-         y : { array-like, sparse matrix},  shape = [n_samples] or 
297-             [n_samples, n_classes].  Predicted multi-class targets. 
295+         y : (sparse)  array-like, shape = [n_samples] or [n_samples, n_classes].  
296+             Predicted multi-class targets. 
298297        """ 
299298        self ._check_is_fitted ()
300299
@@ -319,7 +318,7 @@ def predict_proba(self, X):
319318
320319        Returns 
321320        ------- 
322-         T : { array-like, sparse matrix} , shape = [n_samples, n_classes] 
321+         T : (sparse)  array-like, shape = [n_samples, n_classes] 
323322            Returns the probability of the sample for each class in the model, 
324323            where classes are ordered as they are in `self.classes_`. 
325324        """ 
@@ -474,7 +473,7 @@ def fit(self, X, y):
474473
475474        Parameters 
476475        ---------- 
477-         X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
476+         X : (sparse)  array-like, shape = [n_samples, n_features] 
478477            Data. 
479478
480479        y : numpy array of shape [n_samples] 
@@ -493,7 +492,7 @@ def predict(self, X):
493492
494493        Parameters 
495494        ---------- 
496-         X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
495+         X : (sparse)  array-like, shape = [n_samples, n_features] 
497496            Data. 
498497
499498        Returns 
@@ -533,7 +532,7 @@ def fit_ecoc(estimator, X, y, code_size=1.5, random_state=None, n_jobs=1):
533532    classes : numpy array of shape [n_classes] 
534533        Array containing labels. 
535534
536-     `code_book_`: numpy array of shape [n_classes, code_size] 
535+     `code_book_`  : numpy array of shape [n_classes, code_size] 
537536        Binary array containing the code of each class. 
538537    """ 
539538    _check_estimator (estimator )
@@ -650,7 +649,7 @@ def fit(self, X, y):
650649
651650        Parameters 
652651        ---------- 
653-         X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
652+         X : (sparse)  array-like, shape = [n_samples, n_features] 
654653            Data. 
655654
656655        y : numpy array of shape [n_samples] 
@@ -670,7 +669,7 @@ def predict(self, X):
670669
671670        Parameters 
672671        ---------- 
673-         X : { array-like, sparse matrix} , shape = [n_samples, n_features] 
672+         X : (sparse)  array-like, shape = [n_samples, n_features] 
674673            Data. 
675674
676675        Returns 
0 commit comments