Skip to content

Commit dff37c4

Browse files
authored
DOC Fix incorrect 0-1 scaling in the RBM example (scikit-learn#19363)
1 parent 246795f commit dff37c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/neural_networks/plot_rbm_logistic_classification.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from sklearn.model_selection import train_test_split
3838
from sklearn.neural_network import BernoulliRBM
3939
from sklearn.pipeline import Pipeline
40+
from sklearn.preprocessing import minmax_scale
4041
from sklearn.base import clone
4142

4243

@@ -79,7 +80,7 @@ def shift(x, w):
7980
X, y = datasets.load_digits(return_X_y=True)
8081
X = np.asarray(X, 'float32')
8182
X, Y = nudge_dataset(X, y)
82-
X = (X - np.min(X, 0)) / (np.max(X, 0) + 0.0001) # 0-1 scaling
83+
X = minmax_scale(X, feature_range=(0, 1)) # 0-1 scaling
8384

8485
X_train, X_test, Y_train, Y_test = train_test_split(
8586
X, Y, test_size=0.2, random_state=0)

0 commit comments

Comments
 (0)