|
13 | 13 |
|
14 | 14 | from warnings import simplefilter |
15 | 15 |
|
16 | | -import matplotlib.pyplot as plt |
17 | 16 | import numpy as np |
18 | 17 | import pandas as pd |
19 | 18 | from sklearn.ensemble import RandomForestRegressor |
@@ -145,22 +144,6 @@ def data_safety_checker(list_vote: list, actual_result: float) -> bool: |
145 | 144 | return safe > not_safe |
146 | 145 |
|
147 | 146 |
|
148 | | -def plot_forecast(actual, predictions): |
149 | | - plt.figure(figsize=(10, 5)) |
150 | | - plt.plot(range(len(actual)), actual, label="Actual") |
151 | | - plt.plot(len(actual), predictions[0], "ro", label="Linear Reg") |
152 | | - plt.plot(len(actual), predictions[1], "go", label="SARIMAX") |
153 | | - plt.plot(len(actual), predictions[2], "bo", label="SVR") |
154 | | - plt.plot(len(actual), predictions[3], "yo", label="RF") |
155 | | - plt.legend() |
156 | | - plt.title("Data Safety Forecast") |
157 | | - plt.xlabel("Days") |
158 | | - plt.ylabel("Normalized User Count") |
159 | | - plt.grid(True) |
160 | | - plt.tight_layout() |
161 | | - plt.show() |
162 | | - |
163 | | - |
164 | 147 | if __name__ == "__main__": |
165 | 148 | """ |
166 | 149 | data column = total user in a day, how much online event held in one day, |
@@ -202,5 +185,3 @@ def plot_forecast(actual, predictions): |
202 | 185 | # check the safety of today's data |
203 | 186 | not_str = "" if data_safety_checker(res_vote, test_user[0]) else "not " |
204 | 187 | print(f"Today's data is {not_str}safe.") |
205 | | - |
206 | | - plot_forecast(train_user, res_vote) |
0 commit comments