from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
iris_dataset=load_iris()
print("data数组类型: {}".format(type(iris_dataset['data'])))
print("前五朵花数据:\n{}".format(iris_dataset['data'][:5]))
X_train,X_test,Y_train,Y_test=train_test_split(iris_dataset['data'],iris_dataset['target'],random_state=0)
log_reg = LogisticRegression(max_iter=3000)
clm=log_reg.fit(X_train,Y_train)
print(clm.predict(X_test))
print(clm.score(X_test,Y_test))