简体   繁体   English

如何在Jupyter Notebook中显示所有输出

[英]How to display all output in Jupyter notebook

I am learning using RandomSearchCV to find best parameters for Random Forest Classifier on Jupyter notebook. 我正在学习使用RandomSearchCV在Jupyter笔记本上查找随机森林分类器的最佳参数。

I used a pipeline + standard scaler. 我使用了管道+标准缩放器。

steps = [('scaler',StandardScaler()),('clf',RandomForestClassifier())]
RF = Pipeline(steps)

RF_params = {'clf__n_estimators':np.arange(50,150,10),'clf__criterion': 
['gini','entropy'],\
'clf__max_depth':[2,3,4,5]}

random_R = RandomizedSearchCV(estimator=RF,param_distributions=RF_params,\
                         n_iter=20,cv=3,verbose=1,scoring='f1')

random_R.fit(train,y)

Then I used 然后我用
random_R.best_estimator_ and random_R.get_params to output results, but it only showed: random_R.best_estimator_和random_R.get_params输出结果,但仅显示:

Pipeline(memory=None,
 steps=[('scaler', StandardScaler(copy=True, with_mean=True, with_std=True)), ('clf', RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',
        max_depth=3, max_features='auto', max_leaf_nodes=None,
        min_impurity_decrease=0.0, min_impurity_split=None,
    ...obs=None,
        oob_score=False, random_state=None, verbose=0,
        warm_start=False))])

Most output was omitted. 大部分输出被省略。 Is there a way to display all output? 有没有办法显示所有输出? I googled this and tried to change notebook's output setting but it did not work. 我用谷歌搜索并尝试更改笔记本的输出设置,但是没有用。 Thanks a lot! 非常感谢!

in your output try adding 在您的输出中尝试添加

 ,mode = 'a' 

it sounds like instead of appending it is overwriting. 听起来好像不是覆盖它而是覆盖它。 Check out the documentation here: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.RandomizedSearchCV.html 在此处查看文档: https : //scikit-learn.org/stable/modules/generated/sklearn.model_selection.RandomizedSearchCV.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM