如何解决如何更改后面的组合框代码中的背景
如何更改后面的组合框代码中的背景?我在后面的代码中做了这个,但没有用:
#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 举报,一经查实,本站将立刻删除。