如何更改后面的组合框代码中的背景

问题描述

如何更改后面的组合框代码中的背景?我在后面的代码中做了这个,但没有用:

#visualize code
def plot_search_results(grid,lsi_log_index):
    """
    Params: 
        grid: A trained gridsearchcv object.
    """
    ## Results from grid search
    results = grid.cv_results_
    means_test = results['mean_test_score']
    stds_test = results['std_test_score']
    means_train = results['mean_train_score']
    stds_train = results['std_train_score']

    ## Getting indexes of values per hyper-parameter
    masks=[]
    masks_names= list(grid.best_params_.keys())
    for p_k,p_v in grid.best_params_.items():
        masks.append(list(results['param_'+p_k].data==p_v))

    params=grid.param_grid

    ## Ploting results
    fig,ax = plt.subplots(1,len(params),sharex='none',sharey='all',figsize=(20,5))
    fig.suptitle('score per parameter')
    fig.text(0.04,0.5,'MEAN score',va='center',rotation='vertical')
    pram_preformace_in_best = {}
    for i,p in enumerate(masks_names):
        m = np.stack(masks[:i] + masks[i+1:])
        pram_preformace_in_best
        best_parms_mask = m.all(axis=0)
        best_index = np.where(best_parms_mask)[0]
        x = np.array(params[p])
        y_1 = np.array(means_test[best_index])
        e_1 = np.array(stds_test[best_index])
        y_2 = np.array(means_train[best_index])
        e_2 = np.array(stds_train[best_index])
        ax[i].errorbar(x,y_1,e_1,linestyle='--',marker='o',label='test')
        ax[i].errorbar(x,y_2,e_2,linestyle='-',marker='^',label='train' )
        ax[i].set_xlabel(p.upper())
    for log_scaler in lsi_log_index:
        ax[log_scaler].set_xscale("log")

    plt.legend()
    plt.show()
  
plot_search_results(forest_grid,[])

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)