python逻辑回归
逻辑回归的概念 Python 2016 2017 2016 python , 20161490 图2.2016 #-*- coding: utf-8 -*- import pandas as pd import matplotlib.pyplot as plt data = pd.read_excel("c:/2018/2016myjb.xlsx") print (data) x = data.iloc[:,:8].as_matrix() #行全选,列选下标0-7 print ("x: \n", x) y = data.iloc[:,8].as_matrix()#行全选,列选下标8 print ("y: \n", y) from sklearn.linear_model import LogisticRegression as LR from sklearn.linear_model import RandomizedLogisticRegression as RLR #建立随机逻辑回归模型,筛选变量,特征筛选用了默认阈值0.25 rlr = RLR(selection_threshold=0.25) #训练模型 rlr.fit(x, y) #获取特征筛选结果,也可以通过.scores_方法获取各个特征的分数 rlr.get_support() print(u