# 随机将数据集划分成成70%训练集,30%测试集。 # 设置random_state参数:get the same output the first time you make the split. from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1, test_size=0.3)
"""Building and fit LogisticRegression model""" # 采用逻辑回归和贝叶斯两种模型 import pickle from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import MultinomialNB