逻辑回归案例

import pandas as pd
root="G:/python/源码/源码/luqu.csv"
dataframe=pd.read_csv(root)
#print(dataframe)
x=dataframe.ix[:,1:4]
y=dataframe.ix[:,0]
from sklearn.linear_model import LogisticRegression
model2=LogisticRegression()
model2.fit(x,y)
print(model2.score(x,y))
final=model2.predict([[451,3.8,4]])
print(final)

你可能感兴趣的:(python)