Re: [scikit-learn] API Discussion: Where shall we put the plotting functions?
As a user, I feel that (2) "sklearn.plot.XXX.plot_YYY" best allows for future expansion of sub-namespaces in a tractable way that is also easy to understand during code review. For example, sklearn.plot.tree.plot_forest() or sklearn.plot.lasso.plot_* . Just my opinion. J.B. 2019年4月2日(火) 23:40 Hanmin Qin : > See https://github.com/scikit-learn/scikit-learn/issues/13448 > > We've introduced several plotting functions (e.g., plot_tree and > plot_partial_dependence) and will introduce more (e.g., > plot_decision_boundary) in the future. Consequently, we need to decide > where to put these functions. Currently, there're 3 proposals: > > (1) sklearn.plot.plot_YYY (e.g., sklearn.plot.plot_tree) > > (2) sklearn.plot.XXX.plot_YYY (e.g., sklearn.plot.tree.plot_tree) > > (3) sklearn.XXX.plot.plot_YYY (e.g., sklearn.tree.plot.plot_tree, note > that we won't support from sklearn.XXX import plot_YYY) > > Joel Nothman, Gael Varoquaux and I decided to post it on the mailing list > to invite opinions. > > Thanks > > Hanmin Qin > ___ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn > ___ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Re: [scikit-learn] LASSO: Predicted values show negative correlation with observed values on random data
in your example with random data Lasso leads to coef_ of zeros so you get as prediction : np.mean(Y[train]) you'll see the same phenomenon if you do: pred = np.r_[pred, np.mean(Y[train])] Alex ___ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
[scikit-learn] LASSO: Predicted values show negative correlation with observed values on random data
Hello, I tried to apply LASSO regression in combination with LeaveOneOut CV on my data, and observed a significant negative correlation between predicted and observed response values. I tried to replicate the problem using random data (please see code below). Anyone have an idea what I am doing wrong? I would very much like to use LASSO regression on my data. Thanks a lot! Cheers, Martin #Lasso example from sklearn.linear_model import Lasso from sklearn.model_selection import LeaveOneOut from scipy.stats import pearsonr import numpy as np n_samples = 500 n_features = 30 #create random features rng = np.random.RandomState(seed=42) X = rng.randn(n_samples * n_features).reshape(n_samples, n_features) #Create Ys Y = rng.randn(n_samples) #instantiate regressor and cv object cv = LeaveOneOut() reg = Lasso(random_state = 42) #create arrays to save predicted (and observed) Y values pred = np.array([]) obs = np.array([]) #run cross validation for train, test in cv.split(X, Y): #fit regressor reg.fit(X[train], Y[train]) #append predicted and observed values to the arrays pred = np.r_[pred, reg.predict(X[test])] obs = np.r_[obs, Y[test]] #test correlation pearsonr(pred, obs) ___ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
[scikit-learn] API Discussion: Where shall we put the plotting functions?
See https://github.com/scikit-learn/scikit-learn/issues/13448 We've introduced several plotting functions (e.g., plot_tree and plot_partial_dependence) and will introduce more (e.g., plot_decision_boundary) in the future. Consequently, we need to decide where to put these functions. Currently, there're 3 proposals: (1) sklearn.plot.plot_YYY (e.g., sklearn.plot.plot_tree) (2) sklearn.plot.XXX.plot_YYY (e.g., sklearn.plot.tree.plot_tree) (3) sklearn.XXX.plot.plot_YYY (e.g., sklearn.tree.plot.plot_tree, note that we won't support from sklearn.XXX import plot_YYY) Joel Nothman, Gael Varoquaux and I decided to post it on the mailing list to invite opinions. Thanks Hanmin Qin___ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn