def test_plot_relationship_between_features_both_bool(): plot_features_interaction("x12", "x12", data_1M) result_path = Path(__file__).parents[0].absolute().joinpath( "result_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_both_bool.png") pyplot.savefig(str(result_path)) baseline_path = Path(__file__).parents[0].absolute().joinpath( "baseline_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_both_bool.png") pyplot.cla() pyplot.close(pyplot.gcf()) compare_images_from_paths(str(baseline_path), str(result_path))
def test_plot_relationship_between_features_datetime_categorical_2(): plot_features_interaction("home_ownership", "issue_d", loan_data) result_path = Path(__file__).parents[0].absolute( ).joinpath("result_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_datetime_categorical_2.png") pyplot.gcf().set_size_inches(10, 11.5) pyplot.savefig(str(result_path)) baseline_path = Path(__file__).parents[0].absolute( ).joinpath("baseline_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_datetime_categorical_2.png") pyplot.cla() pyplot.close(pyplot.gcf()) compare_images_from_paths(str(baseline_path), str(result_path))
def test_plot_relationship_between_features_numeric_categorical(): plot_features_interaction("x1", "x7", data_1M) result_path = Path(__file__).parents[0].absolute().joinpath( "result_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_numeric_categorical.png") pyplot.gcf().set_size_inches(14, 9) pyplot.savefig(str(result_path)) baseline_path = Path(__file__).parents[0].absolute().joinpath( "baseline_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_numeric_categorical.png") pyplot.cla() pyplot.close(pyplot.gcf()) compare_images_from_paths(str(baseline_path), str(result_path))
def test_plot_relationship_between_features_datetime_bool_2(): df = pandas.DataFrame() df["loan_condition_cat"] = loan_data["loan_condition_cat"].astype("bool") df["issue_d"] = loan_data["issue_d"] plot_features_interaction("loan_condition_cat", "issue_d", df) result_path = Path(__file__).parents[0].absolute().joinpath( "result_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_datetime_bool_2.png") pyplot.gcf().set_size_inches(10, 11.5) pyplot.savefig(str(result_path)) baseline_path = Path(__file__).parents[0].absolute().joinpath( "baseline_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_datetime_bool_2.png") pyplot.cla() pyplot.close(pyplot.gcf()) compare_images_from_paths(str(baseline_path), str(result_path))
def test_plot_relationship_between_features_both_numeric_exist_ax(): pyplot.figure() ax = pyplot.gca() ax.set_title("My ax") plot_features_interaction("x4", "x5", data_1M, ax=ax) result_path = Path(__file__).parents[0].absolute( ).joinpath("result_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_both_numeric_exist_ax.png") pyplot.savefig(str(result_path)) baseline_path = Path(__file__).parents[0].absolute( ).joinpath("baseline_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_both_numeric_exist_ax.png") pyplot.cla() pyplot.close(pyplot.gcf()) compare_images_from_paths(str(baseline_path), str(result_path))
def test_plot_relationship_between_features_datetime_numeric_2(): daily_min_temperatures = pandas.read_csv( Path(__file__).parents[0].joinpath("resources").joinpath( "daily-min-temperatures.csv"), parse_dates=["Date"]) plot_features_interaction("Temp", "Date", daily_min_temperatures) result_path = Path(__file__).parents[0].absolute().joinpath( "result_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_datetime_numeric_2.png") pyplot.gcf().set_size_inches(18, 8) pyplot.savefig(str(result_path)) baseline_path = Path(__file__).parents[0].absolute().joinpath( "baseline_images").joinpath("test_visualization_aids").joinpath( "test_plot_relationship_between_features_datetime_numeric_2.png") pyplot.cla() pyplot.close(pyplot.gcf()) compare_images_from_paths(str(baseline_path), str(result_path))