Skip to content

Commit

Permalink
fix bug predict aqi
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen-Duc-Khai committed Nov 18, 2023
1 parent 868574e commit 05a431a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion prediction-service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def predict_aqi(target_date, previous_aqi=None):

# If a previous_aqi value is provided, use it as input for the last day
if previous_aqi is not None:
input_data[-1] = previous_aqi
input_data = np.append(input_data, previous_aqi)

# Normalize the data using the best_scaler
input_data = best_scaler.transform(input_data.reshape(-1, 1))
Expand Down Expand Up @@ -133,6 +133,8 @@ def predict_aqi_endpoint():
# Predict AQI for target_date
predicted_aqi_target_date = predict_aqi(target_date)

print(predicted_aqi_target_date)

# Predict AQI for the day after target_date using the predicted_aqi_target_date as input
next_day = target_date + timedelta(days=1)
predicted_aqi_next_day = predict_aqi(next_day, previous_aqi=predicted_aqi_target_date)
Expand Down

0 comments on commit 05a431a

Please sign in to comment.