Oct-11-2022, 05:28 PM
What does pd.dataframe.from_dic(vaidation.cv_results_
As used in the following python code
Any help appreciated.
Respectfully,
LZ
As used in the following python code
def get_cv_plot(validation, parameter): """ Function to plot cross validation metric """ # creating dataframe of cross validation results results = pd.DataFrame.from_dict(validation.cv_results_) results = results.sort_values([parameter]) # Get Mean score for each grid search for train data train_macro_f1 = validation.cv_results_["mean_train_score"] # Get Mean score for each grid search for cross validation data cv_macro_f1 = validation.cv_results_["mean_test_score"] C = results[parameter] # plotting the results plt.figure(figsize=(7, 4)) plt.plot(C, train_macro_f1, label='Train macro f1') plt.plot(C, cv_macro_f1, label='CV macro f1') plt.scatter(C, train_macro_f1, label='Train macro f1 points') plt.scatter(C, cv_macro_f1, label='CV macro f1 points') plt.xscale('log') plt.legend() plt.xlabel('hyperparameter') plt.ylabel('macro f1-score') plt.title('Macro f1-score Vs Hyperparameter') plt.grid(linestyle=-'-', linewidth=0.5) plt.grid() plt.show()I have never used this expression before, and I am not sure what I am doing wrong. It does throw an error when I call this def
Any help appreciated.
Respectfully,
LZ