请分别提供岭回归、逻辑回归、决策树的Python代码
时间: 2023-03-13 10:46:02 浏览: 87
决策树python代码
岭回归:from sklearn.linear_model import Ridgeclf = Ridge(alpha=1.0)
clf.fit(X_train, y_train)逻辑回归:from sklearn.linear_model import LogisticRegressionclf = LogisticRegression(random_state=0).fit(X_train, y_train)决策树:from sklearn.tree import DecisionTreeClassifierclf = DecisionTreeClassifier(random_state=0)
clf.fit(X_train, y_train)
阅读全文