逻辑回归代码问题
最近在学习《Python数据分析与挖掘实战》的时候,在第5章的逻辑回归代码,
data = pd.read_excel('c:/Users/EDZ/Desktop/Python/chapter5/demo/data/bankloan.xls')
x = data.iloc[:,:8].values #取前8列作为x矩阵
y = data.iloc[:,8].values #取第9列作为y矩阵
from sklearn.linear_model import LogisticRegression as LR
from sklearn.linear_model import RandomizedLogisticRegression as RLR
rlr = RLR() #建立随机逻辑回归模型,筛选变量
rlr.fit(x,y) #训练模型
rlr.get_support() #获取特征筛选结果,也可以通过.scores_方法获取各个特征的分数
print('通过随机逻辑回归模型筛选特征结束。')
data1 = data.drop('违约',1)
print('有效特征值为:%s' % ','.join(data1.columns[rlr.get_support()]))
x = data1[data1.columns[rlr.get_support()]].values #筛选好特征值
lr = LR() #建立逻辑回归模型
lr.fit(x,y) #用筛选后的特征数据来训练模型
print('逻辑回归模型训练结束。')
print('模型的平均正确率为:%s' % lr.score(x,y)) #给出模型的平均正确率
出现了FutureWaring,内容为:
Class RandomizedLogisticRegression is deprecated; The class RandomizedLogisticRegression is deprecated in 0.19 and will be removed in 0.21.
warnings.warn(msg, category=DeprecationWarning)
C:\Users\EDZ\Anaconda3\lib\site-packages\sklearn\utils\deprecation.py:58: DeprecationWarning: Class Memory is deprecated; deprecated in version 0.20.1 to be removed in version 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib.
warnings.warn(msg, category=DeprecationWarning)
请问需要如何修改呢?还请大神们指教,小弟初入数据分析