【问题标题】:xgb hyper parameter tuning using random search cv使用随机搜索 cv 调整 xgb 超参数
【发布时间】:2023-02-09 20:56:41
【问题描述】:
cross_val = StratifiedKFold(n_splits=split_number)

index_iterator = cross_val.split(features_dataframe, classes_dataframe)

clf = RandomForestClassifier()

random_grid = _create_hyperparameter_finetuning_grid()

clf_random = RandomizedSearchCV(estimator = clf, param_distributions = random_grid, n_iter = 100, cv = cross_val,verbose=2, random_state=42, n_jobs = -1)

clf_random.fit(X, y)

我在某些网站上找到了这段用于随机搜索简历的代码。我不确定代码中的“random_grid = _create_hyperparameter_finetuning_grid()”是什么。 请赐教。

超参数调整

【问题讨论】:

    标签: python python-3.x machine-learning jupyter-notebook random-forest


    【解决方案1】:

    它作为第二个参数传递给模型,在文档 (https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.RandomizedSearchCV.html) 中报告说它应该是一个“以参数名称 (str) 作为键和分布或要尝试的参数列表的字典”。

    RF模型生成一组决策树,根据一些超参数找到正确的分类。然后使用参数分布来测试所有可能的参数组合。

    这里也有解释:

    How to correctly implement StratifiedKFold with RandomizedSearchCV

    【讨论】:

      猜你喜欢
      • 2019-05-11
      • 2019-10-04
      • 2019-11-13
      • 2021-06-02
      • 2019-05-01
      • 2016-05-11
      • 2019-10-15
      • 2021-06-14
      • 2018-11-08
      相关资源
      最近更新 更多