import os

import pandas as pd


def get_test_results():
    path = os.path.join(os.getcwd(), "test_results.txt")
    file = pd.read_csv(path, sep=";").drop_duplicates()
    top_10_percentile_mean_sq = file.mean_sq.quantile(0.00001)
    #top_10_percentile_mean_abs_err = file.mean_abs_err.quantile(0.025)
    top_10_percentile_r2 = file.r2.quantile(0.99999)
    final = file[(file.mean_sq <= top_10_percentile_mean_sq) & (
                file.r2 >= top_10_percentile_r2)]
    print(final["columns_used"].values.tolist())
    print(final["num_rounds"].values.tolist())
    print(final["parameters"].values.tolist())
    print("MeanSq: ", final["mean_sq"].values.tolist())
    print("R2: ", final["r2"].values.tolist())
    print(len(final["columns_used"].values.tolist()))
    print("Top 10 percentile mean_sq:", top_10_percentile_mean_sq)
    print("Top 10 percentile r2:", top_10_percentile_r2)

