July 2018
Beginner to intermediate
406 pages
9h 55m
English
So, we step back and take another look at the data. It seems that there is an inflection point between weeks 3 and 4. Let's separate the data and train two lines using week 3.5 as a separation point:
>>> inflection = int(3.5*7*24) # calculate the inflection point in hours>>> xa = x[:inflection] # data before the inflection point>>> ya = y[:inflection]>>> xb = x[inflection:] # data after>>> yb = y[inflection:]>>> fa = sp.poly1d(sp.polyfit(xa, ya, 1))>>> fb = sp.poly1d(sp.polyfit(xb, yb, 1))>>> fa_error = error(fa, xa, ya)>>> fb_error = error(fb, xb, yb)>>> print("Error inflection=%f" % (fa_error + fb_error))Error inflection=132950348.197616
From the first line (straight), we train with ...
Read now
Unlock full access