logo
Loading...

D42跟D44的作業解答是不是偷懶= =? - Cupoy

D44 作業解答,logistic regression卻用randomforest?D42 is ...

D42跟D44的作業解答是不是偷懶= =?

2023/08/01 下午 11:32
tree based model - 隨機森林程式碼撰寫
YenCheng Lai
觀看數:20
回答數:1
收藏數:0

D44 作業解答,logistic regression卻用randomforest? D42 is the same # 讀取 wine 資料 wine = load_wine() # 切分訓練集/測試集 x_train, x_test, y_train, y_test = train_test_split(wine.data, wine.target, test_size=0.1, random_state=4) **# 建立一個羅吉斯回歸模型 regr = RandomForestClassifier()** # 將訓練資料丟進去模型訓練 regr.fit(x_train, y_train) # 將測試資料丟進模型得到預測結果 y_pred = regr.predict(x_test)

回答列表

  • 2023/08/04 下午 01:55
    王健安
    贊同數:1
    不贊同數:0
    留言數:0

    YenCheng Lai 您好, 今天早上我已經更新 D42 跟 D44 的解答內容, 除修正您給予的提點外, 資料集方面因應 sklearn 已經不支援波士頓資料集的呼叫與載入, 迴歸任務的練習更改為糖尿病資料集, 並且各以一個參數為例,引導您如何全面性地探索一個參數對模型預測力的影響, 如有問題,敬請不吝指教。