运行 ❯
获取你自己的
Python
服务器
×
更改导向
更改主题,深色/浅色
前往空间
import numpy from sklearn import linear_model X = numpy.array([3.78, 2.44, 2.09, 0.14, 1.72, 1.65, 4.92, 4.37, 4.96, 4.52, 3.69, 5.88]).reshape(-1,1) y = numpy.array([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) logr = linear_model.LogisticRegression() logr.fit(X,y) #predict if tumor is cancerous where the size is 3.46mm: predicted = logr.predict(numpy.array([3.46]).reshape(-1,1)) print(predicted)
[[4.03541657]]