Skip to content
Snippets Groups Projects
Commit 67a56c29 authored by Fabian Pedregosa's avatar Fabian Pedregosa
Browse files

FIX: linnerud dataset mixed variables.

Variables exercise and physiological and should be the other way
round.

Thanks to James Bergstra for reporting the bug.
parent 4d1bdf11
Branches
Tags
No related merge requests found
Weight Waist Pulse
191 36 50
189 37 52
193 38 58
162 35 62
189 35 46
182 36 56
211 38 56
167 34 60
176 31 74
154 33 56
169 34 50
166 33 52
154 34 64
247 46 50
193 36 46
202 37 62
176 37 54
157 32 52
156 33 54
138 33 68
Chins Situps Jumps
5 162 60
2 110 60
12 101 101
12 105 37
13 155 58
4 101 42
8 101 38
6 125 40
15 200 40
17 251 250
17 120 38
13 210 115
14 215 105
1 50 50
6 70 31
12 210 120
4 60 25
11 230 80
15 225 73
2 110 43
Chins Situps Jumps
5 162 60
2 110 60
12 101 101
12 105 37
13 155 58
4 101 42
8 101 38
6 125 40
15 200 40
17 251 250
17 120 38
13 210 115
14 215 105
1 50 50
6 70 31
12 210 120
4 60 25
11 230 80
15 225 73
2 110 43
Weight Waist Pulse
191 36 50
189 37 52
193 38 58
162 35 62
189 35 46
182 36 56
211 38 56
167 34 60
176 31 74
154 33 56
169 34 50
166 33 52
154 34 64
247 46 50
193 36 46
202 37 62
176 37 54
157 32 52
156 33 54
138 33 68
......@@ -86,27 +86,27 @@ def test_pls():
pls_ca = pls_bynipals
x_loadings = np.array(
[[-0.66591531, 0.77356014],
[-0.67602366, -0.62873035],
[ 0.35892139, -0.11993352]])
[[-0.61470416, 0.37877695],
[-0.65625755, 0.01196893],
[-0.51733059, -0.93984954]])
assert_array_almost_equal(pls_ca.x_loadings_, x_loadings)
y_loadings = np.array(
[[ 0.6147046 , 0.37877736],
[ 0.65625787, 0.01196607],
[ 0.51733043, -0.93984895]])
[[ 0.66591533, 0.77358148],
[ 0.67602364, -0.62871191],
[-0.35892128, -0.11981924]])
assert_array_almost_equal(pls_ca.y_loadings_, y_loadings)
x_weights = np.array(
[[-0.58989082, 0.78900159],
[-0.77134081, -0.61352087],
[ 0.23887693, -0.03269003]])
[[-0.61330704, 0.25616119],
[-0.74697144, 0.11930791],
[-0.25668686, -0.95924297]])
assert_array_almost_equal(pls_ca.x_weights_, x_weights)
y_weights = np.array(
[[ 0.61330742, 0.25616374],
[ 0.74697171, 0.11930342],
[ 0.25668516, -0.95924284]])
[[ 0.58989127, 0.7890047 ],
[ 0.77134053, -0.61351791],
[-0.2388767 , -0.03267062]])
assert_array_almost_equal(pls_ca.y_weights_, y_weights)
# 2) Regression PLS (PLS2): "Non regression test"
......@@ -115,49 +115,31 @@ def test_pls():
pls2.fit(X, Y)
x_loadings = np.array(
[[-0.66591531, -0.01976472],
[-0.67602366, -0.35471175],
[ 0.35892139, -1.19418263]])
[[-0.61470416, -0.24574278],
[-0.65625755, -0.14396183],
[-0.51733059, 1.00609417]])
assert_array_almost_equal(pls2.x_loadings_, x_loadings)
y_loadings = np.array(
[[ 0.34163079, 0.33638156],
[ 0.41608584, 0.29078321],
[ 0.1429814 , 0.0651935 ]])
[[ 0.32456184, 0.29892183],
[ 0.42439636, 0.61970543],
[-0.13143144, -0.26348971]])
assert_array_almost_equal(pls2.y_loadings_, y_loadings)
x_weights = np.array(
[[-0.58989082, 0.46882134],
[-0.77134081, -0.56802033],
[ 0.23887693, -0.67643141]])
[[-0.61330704, -0.00443647],
[-0.74697144, -0.32172099],
[-0.25668686, 0.94682413]])
assert_array_almost_equal(pls2.x_weights_, x_weights)
y_weights = np.array(
[[ 0.61330742, 0.74851767],
[ 0.74697171, 0.64705202],
[ 0.25668516, 0.14506885]])
[[ 0.58989127, 0.40572461],
[ 0.77134053, 0.84112205],
[-0.2388767 , -0.35763282]])
assert_array_almost_equal(pls2.y_weights_, y_weights)
ypred = np.array(
[[ 9.34053037e+00, 1.39572471e+02, 6.75634346e+01],
[ 8.35625179e+00, 1.28543567e+02, 6.52136587e+01],
[ 6.88442847e+00, 1.12444632e+02, 6.19046849e+01],
[ 9.48402047e+00, 1.51099673e+02, 7.30739923e+01],
[ 1.05852278e+01, 1.53487226e+02, 7.05181552e+01],
[ 8.90885030e+00, 1.38282450e+02, 6.83808597e+01],
[ 6.77862431e+00, 1.07612118e+02, 5.97520250e+01],
[ 1.04183596e+01, 1.61076073e+02, 7.50477312e+01],
[ 1.13829272e+01, 1.78285171e+02, 8.06854024e+01],
[ 1.18461685e+01, 1.78850010e+02, 7.93812540e+01],
[ 1.13542309e+01, 1.67786960e+02, 7.53148497e+01],
[ 1.20340762e+01, 1.77605016e+02, 7.80842300e+01],
[ 1.02470983e+01, 1.62671902e+02, 7.64701009e+01],
[ 1.70939023e-01, 1.74451012e+01, 3.55750249e+01],
[ 9.69490309e+00, 1.41835825e+02, 6.75198672e+01],
[ 7.17068297e+00, 1.16570160e+02, 6.30663554e+01],
[ 8.37882344e+00, 1.31621907e+02, 6.67395903e+01],
[ 1.30076335e+01, 1.91010591e+02, 8.17092462e+01],
[ 1.20067084e+01, 1.79630851e+02, 7.92341246e+01],
[ 1.09495154e+01, 1.75568297e+02, 8.07654128e+01]])
assert_array_almost_equal(pls2.predict(X), ypred)
ypred_2 = np.array(
[[ 180.33278555, 35.57034871, 56.06817703],
[ 192.06235219, 37.95306771, 54.12925192]])
assert_array_almost_equal(pls2.predict(X[:2]), ypred_2)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment