DeprecationWarning

python

#1

Hello, I have an issue related to the Loan prediction hackathon when I was trying to improve the accuracy by tuning the hyperparameters for the model using the random forest method, and when running it I got that error message : c:\program files\python35-32\lib\site-packages\sklearn\model_selection_search.py:841: DeprecationWarning: The default of the iid parameter will change from True to False in version 0.22 and will be removed in 0.24. This will change numeric results when test-set sizes are unequal.
DeprecationWarning)
GridSearchCV(cv=‘warn’, error_score=‘raise-deprecating’,
estimator=RandomForestClassifier(bootstrap=True, class_weight=None, criterion=‘gini’,
max_depth=None, max_features=‘auto’, max_leaf_nodes=None,
min_impurity_decrease=0.0, min_impurity_split=None,
min_samples_leaf=1, min_samples_split=2,
min_weight_fraction_leaf=0.0, n_estimators=‘warn’, n_jobs=None,
oob_score=False, random_state=1, verbose=0, warm_start=False),
fit_params=None, iid=‘warn’, n_jobs=None,
param_grid={‘n_estimators’: [1, 21, 41, 61, 81, 101, 121, 141, 161, 181], ‘max_depth’: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]},
pre_dispatch=‘2*n_jobs’, refit=True, return_train_score=‘warn’,
scoring=None, verbose=0)
What should I do to fix it since Im following all the steps to the course related to the hackathon “Model Building: Part 2”.
Thanks.


#2

try and update the sklearn package


#3

@chaimaa

when you get DeprecationWarning or futurewarning, do this way
import warnings
warnings.filterwarnings(“ignore”)
warnings.filterwarnings(action=‘ignore’,category=DeprecationWarning)
warnings.filterwarnings(action=‘ignore’,category=FutureWarning)


#4

Thank you so much it works the warning disapears, and now the warning means only that a value of a parameter will return false in future version of sklearn no problem it wont affect my results?! I dont know why I dont get the same value as the tutorial Im following !this is my results :


th tutorial results’ :

is the values/output of gridsearch funtion are not unique?they depend on what?Thanks


#5

Hi @chaimaa,

The results may vary. It will depend on the random_state value you give. Also, for each run, the cv randomly split the train and validation set therefore results of each would be different.