Skip to content

Commit

Permalink
added in some timers to measure time to forecast, in addition to remo…
Browse files Browse the repository at this point in the history
…ving some comments.
  • Loading branch information
garethcull committed Mar 26, 2019
1 parent b5cc94c commit 31aea34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pandas as pd
from helper_v4 import forecastr,determine_timeframe,get_summary_stats,validate_model
import logging
import time



Expand Down Expand Up @@ -210,8 +211,6 @@ def main(message):
# Send data back to the client in the form of a label detected or text extracted.
emit('render_uploaded_csv_data', {'data': [column_headers,message, timeframe, summary_stats,original_data]})

# Probably need some sort of date checker function to properly format the date.
data[time_unit] = data[time_unit].apply(lambda x: pd.to_datetime(str(x)))



Expand Down
13 changes: 9 additions & 4 deletions helper_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from fbprophet.diagnostics import performance_metrics
import pandas as pd
import numpy as np
#import time
from flask_socketio import SocketIO, emit
import time


def forecastr(data,forecast_settings,column_headers,freq_val,build_settings):
Expand Down Expand Up @@ -122,10 +123,14 @@ def forecastr(data,forecast_settings,column_headers,freq_val,build_settings):
m = Prophet(**prophet_arg_vals)

# Fit the Model - Side Note it would be interesting to time how long this takes by file size #start = time.time()
#start = time.time()
start = time.time()
m.fit(data)
#end = time.time()
#print(end-start)
end = time.time()
print(end-start)

# Status update
emit('processing', {'data': 'model has been fit'})


# Let's create a new data frame for the forecast which includes how long the user requested to forecast out in time units and by time unit type (eg. "D", "M","Y")
future = m.make_future_dataframe(periods=fs_period, freq=freq_val)
Expand Down

0 comments on commit 31aea34

Please sign in to comment.