0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GridSearchCVの結果をcsvに保存する

Posted at

Grid Searchの結果の保存の仕方

  results = clf.cv_results_
    params = results['params']
    print("params", params)
    param_str = list()
    for p in params:
        temp_param = ""
        for key,  value in p.items():
            temp_param += key + ':' + str(value) +'_'
        param_str.append(temp_param)
    param_str = np.array(param_str)
    mean_score = results['mean_test_score']
    stds = results['std_test_score']
    rank = results['rank_test_score']
    data = {"param name": param_str, "mean" : mean_score, "std" : stds, "rank": rank}
    import pandas as pd
    df = pd.DataFrame(data)
    df.to_csv('path/to/grid_svm_result.csv', encoding='utf-8', index=False)

使用したparamはstringとして、保存している。
以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?