train_sizes=np.linspace(0.1, 1.0, 20)) fig_adult_lc.savefig(root_path + "/plots/decision_tree/adult_lc.png") fig_flag_lc = gp.plot_learning_curve(dt_flag, "flag learning curve", flag_x, flag_y, cv=3, train_sizes=np.linspace(0.1, 1.0, 20)) fig_flag_lc.savefig(root_path + "/plots/decision_tree/flag_lc.png") print("########## Plotting Max Depth Validation Curves... ##########") fig_adult_vc1 = gp.plot_validation_curve(dt_adult, "Max Depth Adult Validation Curve", adult_x, adult_y, param_name="max_depth", param_range=np.linspace(1, 50, 25), cv=5) fig_adult_vc1.savefig(root_path + "/plots/decision_tree/max_depth_adult_vc.png") fig_flag_vc1 = gp.plot_validation_curve(dt_flag, "Max Depth Flag Validation Curve", flag_x, flag_y, param_name="max_depth", param_range=np.linspace(1, 50, 25), cv=5) fig_flag_vc1.savefig(root_path + "/plots/decision_tree/max_depth_flag_vc.png")
train_sizes=np.linspace(0.1, 1.0, 7)) fig_adult_lc.savefig(root_path + "/plots/nn/adult_lc.png") fig_flag_lc = gp.plot_learning_curve(nn_flag, "Flag - learning curve", flag_x.todense(), flag_y.values.ravel(), cv=3, train_sizes=np.linspace(0.1, 1.0, 50)) fig_flag_lc.savefig(root_path + "/plots/nn/flag_lc.png") print("########## Plotting alpha Validation Curves... ##########") fig_adult_vc1 = gp.plot_validation_curve(nn_adult, "Adult - alpha Validation Curve", adult_x.todense(), adult_y.values.ravel(), param_name="alpha", param_range=np.linspace( 0.01, 0.05, 5), cv=3) fig_adult_vc1.savefig(root_path + "/plots/nn/alpha_adult_vc.png") fig_flag_vc1 = gp.plot_validation_curve( nn_flag, "Flag - alpha Validation Curve", flag_x.todense(), flag_y.values.ravel(), param_name="alpha", param_range=10.0**-np.arange(0.1, 7, 0.1), cv=5) fig_flag_vc1.savefig(root_path + "/plots/nn/alpha_flag_vc.png")
train_sizes=np.linspace(0.1, 1.0, 40)) fig_adult_lc.savefig(root_path + "/plots/boost/adult_lc.png") fig_flag_lc = gp.plot_learning_curve(boost_flag, "Flag - learning curve", flag_x.todense(), flag_y.values.ravel(), cv=3, train_sizes=np.linspace(0.1, 1.0, 40)) fig_flag_lc.savefig(root_path + "/plots/boost/flag_lc.png") print("########## Plotting n_estimators Validation Curves... ##########") fig_adult_vc1 = gp.plot_validation_curve( boost_adult, "Adult - n_estimators Validation Curve", adult_x.todense(), adult_y.values.ravel(), param_name="n_estimators", param_range=range(1, 100, 2), cv=5) fig_adult_vc1.savefig(root_path + "/plots/boost/n_estimators_adult_vc.png") fig_flag_vc1 = gp.plot_validation_curve(boost_flag, "Flag - n_estimators Validation Curve", flag_x.todense(), flag_y.values.ravel(), param_name="n_estimators", param_range=range(1, 100), cv=5) fig_flag_vc1.savefig(root_path + "/plots/boost/n_estimators_flag_vc.png") print("########## Plotting learning_rate Validation Curves... ##########")
train_sizes=np.linspace(0.1, 1.0, 5)) fig_adult_lc2.savefig(root_path + "/plots/svm/rbf_adult_lc.png") fig_flag_lc2 = gp.plot_learning_curve(svc_flag2, "Flag - learning curve", flag_x.todense(), flag_y.values.ravel(), cv=3, train_sizes=np.linspace(0.1, 1.0, 10)) fig_flag_lc2.savefig(root_path + "/plots/svm/rbf_flag_lc.png") print("########## Plotting C Validation Curves... ##########") fig_adult_vc1 = gp.plot_validation_curve(svc_adult, "Adult - C Validation Curve", adult_x.todense(), adult_y.values.ravel(), param_name="C", param_range=np.linspace(0.01, 4, 50), cv=5) fig_adult_vc1.savefig(root_path + "/plots/svm/C_adult_vc.png") fig_flag_vc1 = gp.plot_validation_curve(svc_flag, "Flag - C Validation Curve", flag_x.todense(), flag_y.values.ravel(), param_name="C", param_range=np.linspace(0.01, 0.5, 25), cv=5) fig_flag_vc1.savefig(root_path + "/plots/svm/C_flag_vc.png") fig_adult_vc2 = gp.plot_validation_curve(svc_adult,
train_sizes=np.linspace(0.1, 1.0, 20)) fig_adult_lc.savefig(root_path + "/plots/knn/adult_lc.png") fig_flag_lc = gp.plot_learning_curve(knn_flag, "Flag - learning curve", flag_x.todense(), flag_y.values.ravel(), cv=3, train_sizes=np.linspace(0.1, 1.0, 20)) fig_flag_lc.savefig(root_path + "/plots/knn/flag_lc.png") print("########## Plotting n_neighbors Validation Curves... ##########") fig_adult_vc1 = gp.plot_validation_curve( knn_adult, "Adult - n_neighbors Validation Curve", adult_x.todense(), adult_y.values.ravel(), param_name="n_neighbors", param_range=range(1, 50), cv=5) fig_adult_vc1.savefig(root_path + "/plots/knn/n_neighbors2_adult_vc.png") fig_flag_vc1 = gp.plot_validation_curve(knn_flag, "Flag - n_neighbors Validation Curve", flag_x.todense(), flag_y.values.ravel(), param_name="n_neighbors", param_range=range(1, 50), cv=5) fig_flag_vc1.savefig(root_path + "/plots/knn/n_neighbors2_flag_vc.png") print("########## Plotting Distance Metric Validation Curves... ##########")