Created
February 10, 2011 11:52
-
-
Save fabianp/820401 to your computer and use it in GitHub Desktop.
Some experiments with PLS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Just some experiments with pls | |
""" | |
import numpy as np | |
m, n = 3, 3 | |
X = np.random.randn(m, n) | |
Y = np.random.randn(m, n) | |
from scikits.learn import pls | |
clf = pls.PLSRegression() | |
clf.fit(X, Y, algorithm='svd', n_components=n) | |
print clf.coefs | |
# | |
# Seems strange to me that results vary so much | |
# | |
clf.fit(X, Y, algorithm='nipals', n_components=n) | |
print clf.coefs | |
# | |
# I would expect pls to degrade gracefully into usual regression when | |
# Y is a vector. Instead, I get a LinalgError | |
# | |
clf.n_components = 1 | |
clf.fit([[0, 0], [1, 1]], [0, 1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment