ensemble-learning

How to handle categorical variables in sklearn GradientBoostingClassifier?

青春壹個敷衍的年華 提交于 2019-12-02 23:53:09
I am attempting to train models with GradientBoostingClassifier using categorical variables. The following is a primitive code sample, just for trying to input categorical variables into GradientBoostingClassifier . from sklearn import datasets from sklearn.ensemble import GradientBoostingClassifier import pandas iris = datasets.load_iris() # Use only data for 2 classes. X = iris.data[(iris.target==0) | (iris.target==1)] Y = iris.target[(iris.target==0) | (iris.target==1)] # Class 0 has indices 0-49. Class 1 has indices 50-99. # Divide data into 80% training, 20% testing. train_indices = list

Ensemble of different kinds of regressors using scikit-learn (or any other python framework)

隐身守侯 提交于 2019-12-02 14:44:46
I am trying to solve the regression task. I found out that 3 models are working nicely for different subsets of data: LassoLARS, SVR and Gradient Tree Boosting. I noticed that when I make predictions using all these 3 models and then make a table of 'true output' and outputs of my 3 models I see that each time at least one of the models is really close to the true output, though 2 others could be relatively far away. When I compute minimal possible error (if I take prediction from 'best' predictor for each test example) I get a error which is much smaller than error of any model alone. So I

GradientBoostingClassifier with a BaseEstimator in scikit-learn?

蹲街弑〆低调 提交于 2019-11-30 15:07:52
问题 I tried to use GradientBoostingClassifier in scikit-learn and it works fine with its default parameters. However, when I tried to replace the BaseEstimator with a different classifier, it did not work and gave me the following error, return y - np.nan_to_num(np.exp(pred[:, k] - IndexError: too many indices Do you have any solution for the problem. This error can be regenerated using the following snippets: import numpy as np from sklearn import datasets from sklearn.ensemble import

GradientBoostingClassifier with a BaseEstimator in scikit-learn?

心不动则不痛 提交于 2019-11-30 13:45:06
I tried to use GradientBoostingClassifier in scikit-learn and it works fine with its default parameters. However, when I tried to replace the BaseEstimator with a different classifier, it did not work and gave me the following error, return y - np.nan_to_num(np.exp(pred[:, k] - IndexError: too many indices Do you have any solution for the problem. This error can be regenerated using the following snippets: import numpy as np from sklearn import datasets from sklearn.ensemble import GradientBoostingClassifier from sklearn.linear_model import LogisticRegression from sklearn.utils import shuffle