|
- import matplotlib
- matplotlib.use('TkAgg')
- import matplotlib.pyplot as plt
- import pandas as pd
- import seaborn as sns
-
-
- x_label = ['0', '20', '40', '60', '80', '100']
-
- data = pd.DataFrame()
- data['Different Ration of Training Data (%)'] = x_label
-
- data['Accuracy_1'] = [0.0, 0.22669, 0.24497, 0.45704, 0.55027, 0.57952]
- data['Accuracy'] = [0.0, 0.40037, 0.45704, 0.47349, 0.57587, 0.61792]
- data['source_1'] = "Bert-base-chinese"
- data['Method'] = "Our model"
- # deep, muted, bright, pastel, dark, colorblind
- fig, ax1 = plt.subplots()
- sns.pointplot(x="Different Ration of Training Data (%)", y="Accuracy_1", data=data,
- order=x_label, hue='source_1',palette=[sns.xkcd_rgb["blue"]],
- # order=['1', '2', '4', '8', '16', '32'],
- markers=['s'])
-
- sns.pointplot(x="Different Ration of Training Data (%)", y="Accuracy", data=data,
- order=x_label,hue='Method',palette=[sns.xkcd_rgb["bright red"]],
- # order=['1', '2', '4', '8', '16', '32'],
- markers=['v'])
- # ax1.set(aspect=1.0 / ax1.get_data_ratio() * 0.2)
-
-
- # sns.set_style("darkgrid")
- # plt.figure(figsize=(10, 6))
- # plt.title('Deviance')
- # plt.plot(np.arange(params['n_estimators']) + 1, gbm.train_score_, 'b-',
- # label='Training Set Deviance')
- # plt.plot(np.arange(params['n_estimators']) + 1, test_score, 'r-',
- # label='Test Set Deviance')
- # plt.legend(loc='upper right')
- # plt.xlabel('Number of estimators')
- # plt.ylabel('Deviance')
-
-
- # ax2 = plt.twinx()
- # sns.pointplot(x="DeepFM with different embedding size", y="AUC", data=data,
- # order=x_label,
- # # order=['1', '2', '4', '8', '16', '32'],
- # ax=ax2, color='r', markers=['v'])
- # # ax2.yaxis.set_major_formatter(ticker.ScalarFormatter())、
- # ax2.set(aspect=1.0 / ax2.get_data_ratio() * 0.15)
- # ax2.figure.legend()
- plt.tight_layout()
- # plt.subplots_adjust(bottom=0.4, top=0.6)
- # plt.show()
- plt.savefig('hyper_radio.pdf', format='pdf', dpi=300)
- # plt.savefig('hyper_routing.pdf', format='pdf', dpi=300)
- # plt.savefig('hyper_num.pdf', format='pdf', dpi=300)
- # plt.savefig('hyper_dim.pdf', format='pdf', dpi=300)
- # plt.savefig("hyper_embedding_size_new.pdf", format='pdf', dpi=300)
|