Spaces:
Sleeping
Sleeping
Suchinthana
commited on
Commit
·
26f2246
1
Parent(s):
e989afe
Graph update
Browse files
app.py
CHANGED
@@ -29,26 +29,28 @@ def predict_and_plot(dirty, wait, lastyear, usa):
|
|
29 |
# Predicting on test set for comparison
|
30 |
y_pred = model.predict(X_test)
|
31 |
|
32 |
-
#
|
33 |
-
|
34 |
|
35 |
-
#
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
52 |
|
53 |
# Adjust layout and save the plot
|
54 |
plt.tight_layout()
|
|
|
29 |
# Predicting on test set for comparison
|
30 |
y_pred = model.predict(X_test)
|
31 |
|
32 |
+
# Plotting Wait vs Good
|
33 |
+
plt.figure(figsize=(12, 6))
|
34 |
|
35 |
+
# Scatter plot for Wait vs Good
|
36 |
+
plt.subplot(1, 2, 1)
|
37 |
+
plt.scatter(X_test.iloc[:, 1], y_test, color='blue', alpha=0.6, label='Actual Good Values') # X_test[:, 1] for wait
|
38 |
+
plt.scatter(wait, predicted_value, color='red', label=f'Input: Wait={wait}, Predicted Good={predicted_value:.2f}', zorder=5)
|
39 |
+
plt.title('Wait vs Good')
|
40 |
+
plt.xlabel('Wait')
|
41 |
+
plt.ylabel('Good')
|
42 |
+
plt.legend()
|
43 |
+
plt.grid(True)
|
44 |
+
|
45 |
+
# Plotting USA vs Good
|
46 |
+
plt.subplot(1, 2, 2)
|
47 |
+
plt.scatter(X_test.iloc[:, 3], y_test, color='blue', alpha=0.6, label='Actual Good Values') # X_test[:, 3] for usa
|
48 |
+
plt.scatter(usa, predicted_value, color='red', label=f'Input: USA={usa}, Predicted Good={predicted_value:.2f}', zorder=5)
|
49 |
+
plt.title('USA vs Good')
|
50 |
+
plt.xlabel('USA')
|
51 |
+
plt.ylabel('Good')
|
52 |
+
plt.legend()
|
53 |
+
plt.grid(True)
|
54 |
|
55 |
# Adjust layout and save the plot
|
56 |
plt.tight_layout()
|