Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
analyze_webstats with PEP8
  • Loading branch information
juanpabloaj committed Jan 3, 2016
commit 6536b1b5d4f54a6e45014fc589e5819b1582b9bb
7 changes: 4 additions & 3 deletions ch01/analyze_webstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
x = x[~sp.isnan(y)]
y = y[~sp.isnan(y)]

# plot input data

def plot_models(x, y, models, fname, mx=None, ymax=None, xmin=None):
''' plot input data '''

plt.figure(num=None, figsize=(8, 6))
plt.clf()
Expand Down Expand Up @@ -138,8 +139,8 @@ def error(f, x, y):
train = sorted(shuffled[split_idx:])
fbt1 = sp.poly1d(sp.polyfit(xb[train], yb[train], 1))
fbt2 = sp.poly1d(sp.polyfit(xb[train], yb[train], 2))
print("fbt2(x)= \n%s"%fbt2)
print("fbt2(x)-100,000= \n%s"%(fbt2-100000))
print("fbt2(x)= \n%s" % fbt2)
print("fbt2(x)-100,000= \n%s" % (fbt2-100000))
fbt3 = sp.poly1d(sp.polyfit(xb[train], yb[train], 3))
fbt10 = sp.poly1d(sp.polyfit(xb[train], yb[train], 10))
fbt100 = sp.poly1d(sp.polyfit(xb[train], yb[train], 100))
Expand Down