Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c3f807

Browse files
author
Fabian Pedregosa
committed
More python2.5 fixes
1 parent 59a7b18 commit 9c3f807

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

sklearn/manifold/locally_linear.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ def locally_linear_embedding(
263263
# we'll compute M = (I-W)'(I-W)
264264
# depending on the solver, we'll do this differently
265265
if M_sparse:
266-
M = eye(*W.shape, format=W.format) - W
266+
# the **kwargs syntax is for python2.5 compatibility
267+
M = eye(*W.shape, **{'format' : W.format}) - W
267268
M = np.dot(M.T, M).tocsr()
268269
else:
269270
M = (np.dot(W.T, W) - (W.T + W)).todense()

sklearn/neighbors/regression.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ def predict(self, X):
234234
for (i, ind) in enumerate(neigh_ind)])
235235

236236

237-
@deprecated("deprecated in v0.9; will be removed in v0.11; "
238-
"use KNeighborsRegressor or RadiusNeighborsRegressor instead")
239237
class NeighborsRegressor(NeighborsBase, KNeighborsMixin, RadiusNeighborsMixin,
240238
SupervisedFloatMixin,
241239
RegressorMixin):
@@ -349,3 +347,8 @@ def predict(self, X):
349347
# compute interpolation on y
350348
return np.array([np.mean(self._y[ind])
351349
for ind in neigh_ind])
350+
351+
NeighborsRegressor = deprecated(
352+
"deprecated in v0.9; will be removed in v0.11; "
353+
"use KNeighborsRegressor or RadiusNeighborsRegressor instead")(
354+
NeighborsRegressor)

sklearn/utils/extmath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _fast_logdet_numpy(A):
5858
except AttributeError:
5959
# math.factorial is only available in Python >= 2.6
6060
import operator
61-
def factorial(x):
61+
def factorial(n):
6262
# don't use reduce operator or 2to3 will fail.
6363
# ripped from http://www.joelbdalley.com/page.pl?38
6464
# Ensure that n is a Natural number

0 commit comments

Comments
 (0)