gpt4 book ai didi

python - 我应该如何解决这个 DeprecationWarning?

转载 作者:行者123 更新时间:2023-12-01 09:28:54 26 4
gpt4 key购买 nike

%matplotlib 笔记本

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.cross_validation import train_test_split

警告

/home/abdul/anaconda3/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)

我正在使用 jupytor 笔记本和上面的代码行。出现 DeprecationWarning 那么我该如何解决这个问题?

最佳答案

弃用意味着该模块被标记为过时或已弃用,因此在当时的某个时间点之后不会有任何官方维护。 (在本例中为版本 0.20)。如果您计划升级到此之后,则必须在代码中修复此问题。

根据您的具体情况,而不是,

from sklearn.cross_validation import train_test_split

你可以使用,

from sklearn.model_selection import train_test_split

关于python - 我应该如何解决这个 DeprecationWarning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50127155/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com