scikit-learnのgridsearchでrandomforestを実行した後、決定木の分岐条件を
出力する方法がありましたらご教授お願いいたします。
fitまでは上手くいって予測結果を出力できるのですが、分岐条件を出そうとすると
学習出来ていないというエラーが出ます。
<スクリプト抜粋> forest_grid = GridSearchCV(estimator=RandomForestClassifier(random_state=0), param_grid = param_grid, scoring="accuracy", #metrics cv = 3, #cross-validation n_jobs = -1) #number of core forest_grid.fit(X_train,y_train) #fit trees=(forest_grid.estimator).decision_path(X_train) <-----ここでエラーが出ます <エラー> NotFittedError: This RandomForestClassifier instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/28 15:23
2020/01/28 15:31