data = pd.read_csv('../benchMarkingResult.txt',
                   header=None,
                   sep='\t',
                   names=('iteration',
                          'basic_result',
                          'efficient_result'))

"""
Explanation: benchmarking for the basic document and efficient document
End of explanation
"""


x = data.iteration
y1 = data.basic_result
y2 = data.efficient_result

fig, ax = plt.subplots(figsize=(10,10))
ax.scatter(x, y1, s=15)
ax.scatter(x, y2, s=15, c='g')

"""
Explanation: Plot the Basic and Efficient data first

Basic
End of explanation
"""


d1 = {'x':x, 'y_basic':y1}
d2 = {'x':x, 'y_efficient':y2}

mod1 = smf.ols(formula='y_basic ~ x - 1',
               data = d1).fit()

print mod1.summary()

mod2 = smf.ols(formula='y_efficient ~ x - 1', data=d2).fit()
mod2.summary()

"""
Explanation: do a linear regression for the 2 lines and evaluate the r-squared value
End of explanation
"""


y_est_basic = mod1.predict(x)
y_est_effi = mod2.predict(x)

fig, ax = plt.subplots(figsize=(10,10))
ax.scatter(x, y1, s=15)
ax.scatter(x, y2, s=15, c='g')
ax.plot(x, y_est_basic)
ax.plot(x, y_est_effi)
ax.legend(scatterpoints=1)

"""
Explanation: both r-squared look quite nice
plot the resulting lines. I'm ignoring the cross-validation here
End of explanation
"""


