[Python] Visualization of ranking models based on time executions

Discussão em 'Python' iniciado por Stack, Dezembro 7, 2024.

  1. Stack

    Stack Membro Participativo

    I'm working on reproducing the following plot for my own case: [​IMG]

    so, let's say I already have my results ready and in the form of data frames as below:

    import pandas as pd

    # Data
    data1 = {
    'Models': ['LinearRegression', 'Random Forest', 'XGBoost', 'MLPRegressor', 'SVR', 'CatBoostRegressor', 'LGBMRegressor'],
    'MAE': [4.906, 2.739, 2.826, 5.234, 5.061, 2.454, 2.76]
    'Runtime [ms]': [0:00:43.387145, 0:28:11.761681, 0:03:58.883474, 0:01:44.252276 , 0:04:52.754769, 0:19:36.925169, 0:04:51.223103]
    }
    data2 = {
    'Models': ['LinearRegression', 'Random Forest', 'XGBoost', 'MLPRegressor', 'SVR', 'CatBoostRegressor', 'LGBMRegressor'],
    'MAE': [4.575, 2.345, 2.129, 4.414, 4.353, 2.281, 2.511]
    'Runtime [ms]': [0:00:45.055854, 0:10:55.468473, 0:01:01.575033 , 0:00:31.231719 , 0:02:12.258870, 0:08:16.526615 , 0:15:25.084937]
    }
    data3 = {
    'Models': ['LinearRegression', 'Random Forest', 'XGBoost', 'MLPRegressor', 'SVR', 'CatBoostRegressor', 'LGBMRegressor'],
    'MAE': [4.575, 2.345, 2.129, 4.414, 4.353, 2.281, 2.511]
    'Runtime [ms]': [0:00:40.055854, 0:11:55.468473, 0:01:03.575033 , 0:00:29.231719 , 0:02:02.258870, 0:07:16.526615 , 0:13:25.084937]
    }


    df1 = pd.DataFrame(data1)
    df2 = pd.DataFrame(data2)
    df3 = pd.DataFrame(data3)


    So now I can calculate the ranking by computing absolute\relative frequencies in the final ranked table in the expected output.

    and get something like this to rank top models, but I will lose Runtime [ms]:

    Top models(sorted) count freq(%)
    LinearRegression,MLPRegressor,SVR,LGBMRegresso... 2 66.666667
    MLPRegressor,SVR,LinearRegression,XGBoost,LGBM... 1 33.333333


    How can I get close to this plot?

    Continue reading...

Compartilhe esta Página