Skip to content

Commit d0feab0

Browse files
ApproximateIdentityGaelVaroquaux
authored andcommitted
Revisions due to previous pull request.
1 parent bd5671e commit d0feab0

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

sklearn/multiclass.py

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,18 @@ def fit_ovr(estimator, X, y, n_jobs):
8181

8282
lb = LabelBinarizer()
8383
Y = lb.fit_transform(y)
84+
classes = []
85+
for i in range(Y.shape[1]):
86+
classes.append(["not %s" % i, i])
87+
8488
if n_jobs == 1:
8589
estimators = [_fit_binary(estimator, X, Y[:, i],
86-
classes=["not %s" % str(i), i])
90+
classes=classes[i])
8791
for i in range(Y.shape[1])]
8892
else:
8993
estimators = Parallel(n_jobs=n_jobs)(
9094
delayed(_fit_binary)(estimator, X, Y[:, i],
91-
classes=["not %s" % str(i), i])
95+
classes=classes[i])
9296
for i in range(Y.shape[1]))
9397
return estimators, lb
9498

@@ -158,14 +162,10 @@ class OneVsRestClassifier(BaseEstimator, ClassifierMixin, MetaEstimatorMixin):
158162
159163
n_jobs : int, optional, default: 1
160164
161-
The number of jobs to use for the computation. This works by breaking
162-
down the pairwise matrix into n_jobs even slices and computing them in
163-
parallel.
164-
165-
If -1 all CPUs are used. If 1 is given, no parallel computing code is
166-
used at all, which is useful for debuging. For n_jobs below -1,
167-
(n_cpus + 1 - n_jobs) are used. Thus for n_jobs = -2, all CPUs but one
168-
are used.
165+
The number of jobs to use for the computation. If -1 all CPUs are used.
166+
If 1 is given, no parallel computing code is used at all, which is
167+
useful for debugging. For n_jobs below -1, (n_cpus + 1 + n_jobs) are
168+
used. Thus for n_jobs = -2, all CPUs but one are used.
169169
170170
Attributes
171171
----------
@@ -348,14 +348,10 @@ class OneVsOneClassifier(BaseEstimator, ClassifierMixin, MetaEstimatorMixin):
348348
349349
n_jobs : int, optional, default: 1
350350
351-
The number of jobs to use for the computation. This works by breaking
352-
down the pairwise matrix into n_jobs even slices and computing them in
353-
parallel.
354-
355-
If -1 all CPUs are used. If 1 is given, no parallel computing code is
356-
used at all, which is useful for debuging. For n_jobs below -1,
357-
(n_cpus + 1 - n_jobs) are used. Thus for n_jobs = -2, all CPUs but one
358-
are used.
351+
The number of jobs to use for the computation. If -1 all CPUs are used.
352+
If 1 is given, no parallel computing code is used at all, which is
353+
useful for debugging. For n_jobs below -1, (n_cpus + 1 + n_jobs) are
354+
used. Thus for n_jobs = -2, all CPUs but one are used.
359355
360356
Attributes
361357
----------
@@ -507,14 +503,10 @@ class OutputCodeClassifier(BaseEstimator, ClassifierMixin, MetaEstimatorMixin):
507503
508504
n_jobs : int, optional, default: 1
509505
510-
The number of jobs to use for the computation. This works by breaking
511-
down the pairwise matrix into n_jobs even slices and computing them in
512-
parallel.
513-
514-
If -1 all CPUs are used. If 1 is given, no parallel computing code is
515-
used at all, which is useful for debuging. For n_jobs below -1,
516-
(n_cpus + 1 - n_jobs) are used. Thus for n_jobs = -2, all CPUs but one
517-
are used.
506+
The number of jobs to use for the computation. If -1 all CPUs are used.
507+
If 1 is given, no parallel computing code is used at all, which is
508+
useful for debugging. For n_jobs below -1, (n_cpus + 1 + n_jobs) are
509+
used. Thus for n_jobs = -2, all CPUs but one are used.
518510
519511
Attributes
520512
----------

0 commit comments

Comments
 (0)