Pushpak21 commited on
Commit
55f4726
·
verified ·
1 Parent(s): f065e67

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. predictor/chart_plotter.py +9 -6
predictor/chart_plotter.py CHANGED
@@ -10,16 +10,19 @@ def plot_actual_vs_predicted(df: pd.DataFrame):
10
 
11
  plot_df = df.dropna(subset=["Product_Store_Sales_Total", "Predicted_Sales"])
12
 
13
- scatter = alt.Chart(plot_df).mark_point(filled=True, size=70).encode(
14
- x=alt.X("Product_Store_Sales_Total", title="Actual Sales"),
15
- y=alt.Y("Predicted_Sales", title="Predicted Sales"),
16
- tooltip=["Product_Store_Sales_Total", "Predicted_Sales"]
 
 
 
17
  ).properties(
18
- title="Actual vs Predicted Sales",
19
  width=600,
20
  height=400
21
  )
22
-
23
  line = alt.Chart(pd.DataFrame({
24
  'x': [plot_df["Product_Store_Sales_Total"].min(), plot_df["Product_Store_Sales_Total"].max()],
25
  'y': [plot_df["Product_Store_Sales_Total"].min(), plot_df["Product_Store_Sales_Total"].max()]
 
10
 
11
  plot_df = df.dropna(subset=["Product_Store_Sales_Total", "Predicted_Sales"])
12
 
13
+ df["Error"] = abs(df["Product_Store_Sales_Total"] - df["Predicted_Sales"])
14
+
15
+ scatter = alt.Chart(df).mark_circle(size=60).encode(
16
+ x=alt.X('Product_Store_Sales_Total', title='Actual Sales'),
17
+ y=alt.Y('Predicted_Sales', title='Predicted Sales'),
18
+ color=alt.Color('Error:Q', scale=alt.Scale(scheme='redyellowblue'), legend=alt.Legend(title="Error")),
19
+ tooltip=['Product_Store_Sales_Total', 'Predicted_Sales', 'Error']
20
  ).properties(
21
+ title='Actual vs Predicted Sales',
22
  width=600,
23
  height=400
24
  )
25
+
26
  line = alt.Chart(pd.DataFrame({
27
  'x': [plot_df["Product_Store_Sales_Total"].min(), plot_df["Product_Store_Sales_Total"].max()],
28
  'y': [plot_df["Product_Store_Sales_Total"].min(), plot_df["Product_Store_Sales_Total"].max()]