代码拉取完成,页面将自动刷新
from sklearn.datasets import load_breast_cancer
cancer = load_breast_cancer()
from sklearn.model_selection import train_test_split
X_train,X_test,Y_tiain,Y_test = train_test_split(cancer.data,
cancer.target,stratify=cancer.target,random_state=66)
from sklearn.preprocessing import StandardScaler
nn = StandardScaler()
X_train = nn.fit_transform(X_train)
X_test = nn.fit_transform(X_test)
from sklearn.neural_network import MLPClassifier
mlp = MLPClassifier(solver='lbfgs',hidden_layer_sizes=[10,10],activation='tanh',alpha=1)
mlp.fit(X_train,Y_tiain)
print('================================\n')
print('测试数据集得分:{0}'.format(mlp.score(X_test,Y_test)))
print('================================\n')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。