为什么我在python 3.6的jupyter笔记本中收到警告,我该如何解决?

时间:2018-10-14 22:28:50

标签: python python-3.x jupyter-notebook

我正在尝试运行以下代码,并且看到了很多此类警告,我只是想知道如何阻止它们发生,究竟是什么导致了这些警告,

为什么在运行以下代码时会收到以下警告,

# Test options and evaluation metric
seed = 7
scoring = 'accuracy'

results = []
names = []

# evaluate each model in turn
for name, model in models:
    kfold = model_selection.KFold(n_splits=10, random_state=seed)
    cv_results = model_selection.cross_val_score(
        model, X_train, Y_train, cv=kfold, scoring=scoring)
    results.append(cv_results)
    names.append(name)
    msg = "%s: %f (%f)" % (name, cv_results.mean(), cv_results.std())
    print(msg)

警告:

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/linear_model/logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.
  FutureWarning)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/linear_model/logistic.py:459: FutureWarning: Default multi_class will be changed to 'auto' in 0.22. Specify the multi_class option to silence this warning.
  "this warning.", FutureWarning)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/linear_model/logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.
  FutureWarning)

1 个答案:

答案 0 :(得分:0)

这件事也发生在我身上。 它警告您在代码中编写的即将发布的python版本中的语法更改。 如果您在将来的版本中运行相同的代码,则可能无法按预期运行。