開始使用免費開始

使用 GridSearchCV 的模型結果

你已經找出此模型的最佳參數:分裂準則設為 'gini',估計器(樹)的數量為 30,模型最大深度為 8,最大特徵數量設為 "log2"。

現在就用這組設定試試看,看看模型表現如何。你可以再次使用 get_model_results() 函式來節省時間。

本練習屬於課程

Fraud Detection in Python

檢視課程

練習說明

  • 在模型定義中輸入最佳設定。
  • 擬合模型、取得預測,並使用 get_model_results() 取得效能指標。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Input the optimal parameters in the model
model = RandomForestClassifier(class_weight={0:1,1:12}, ____='____',
            ____=____, ____='log2',  min_samples_leaf=10, ____=____, n_jobs=-1, random_state=5)

# Get results from your model
get_model_results(____, ____, ____, ____, ____)
編輯並執行程式碼