Skip to content

Instantly share code, notes, and snippets.

@g-leech g-leech/ffw.py
Created Feb 25, 2018

Embed
What would you like to do?
Dumb linear prediction of "fit to work" judgments for 2014
import numpy as np
from sklearn import linear_model
from sklearn.metrics import mean_squared_error, r2_score
# Monthly data, Nov-08 to Mar-13
months = np.array(range(0,53))
ffws = np.array([ 17400, 15100, 21000, 19800, 23400, 21800, 22000, 22700, 22900, 20500, 22000, 21500, 20800, 17000, 22100, 21600, 23600, 21100, 20200, 21300, 21300, 19700, 20800, 19000, 19900, 15700, 21900, 20800, 22800, 17000, 17300, 17100, 16700, 16600, 17800, 18100, 18400, 14700, 18500, 16900, 17200, 15200, 16600, 15700, 16500, 16400, 15800, 16900, 15800, 10400, 13600, 10200, 7700 ] )
regr = linear_model.LinearRegression()
regr.fit(months.reshape(-1, 1), ffws)
april2013 = 54 #th month in the dataset
feb2014 = 64 #th month in the dataset
prediction = sum([regr.predict(x) for x in range(april2013, feb2014) ])
# 133,587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.