def ploterrordistribution(ffillreslongdf, task): df = ffillreslongdf.copy()…
- User
def plot_error_distribution(ffill_res_long_df, task): df = ffill_res_long_df.copy() df['error_forecast_fact'] = df['forecast_gmv'] - df['sum_gmv']
# Q1 = df['error_forecast_fact'].quantile(0.25) # Q3 = df['error_forecast_fact'].quantile(0.75) # IQR = Q3 - Q1 df_no_outliers = df[ (df['error_forecast_fact'] >= df['error_forecast_fact'].quantile(0.01)) & (df['error_forecast_fact'] <= df['error_forecast_fact'].quantile(0.99)) ] fig = make_subplots(rows=1, cols=2, subplot_titles=("С выбросами", "Без выбросов"), shared_yaxes=True) colors = ['red', 'green', 'blue', 'orange', 'grey'] overall_color = 'black' seller_types = df['seller_type'].unique() fig.add_trace(go.Histogram(x=df['error_forecast_fact'], name="Все продавцы (все)", marker_color=overall_color, opacity=0.4, nbinsx=100), row=1, col=1) for i, seller in enumerate(seller_types): fig.add_trace(go.Histogram(x=df[df['seller_type'] == seller]['error_forecast_fact'], name=f"{seller} (все)", marker_color=colors[i % len(colors)], opacity=0.6, nbinsx=100), row=1, col=1) fig.add_trace(go.Histogram(x=df_no_outliers['error_forecast_fact'], name="Все продавцы (без выбросов)", marker_color=overall_color, opacity=0.4, nbinsx=100), row=1, col=2) for i, seller in enumerate(seller_types): fig.add_trace(go.Histogram(x=df_no_outliers[df_no_outliers['seller_type'] == seller]['error_forecast_fact'], name=f"{seller} (без выбросов)", marker_color=colors[i % len(colors)], opacity=0.6, nbinsx=100), row=1, col=2) # fig.update_layout( # title_text="Распределение ошибок прогноза по типу продавца", # xaxis_title="Ошибка прогноза (forecast - fact)", # yaxis_title="Количество наблюдений", # # bargap=0.1, # barmode='overlay', # width=1100, # height=500 # ) task.logger.report_plotly(title="Ошибка прогноза (forecast - fact)", series="error_histograms_with_total", iteration=0, figure=fig)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.