Fitting a Model by Hand


In [ ]:
import matplotlib.pyplot as plt
import numpy as np

from utils.models import Parameters, LinearModel

plt.rcParams.update({'font.size': 18})

In [ ]:
%matplotlib notebook

In [ ]:
xs, ys = np.load("data/xs.npy")[:30], np.load("data/ys.npy")[:30]

In [ ]:
parameters = Parameters([0.5, 0], [[-1, 1], [-1, 1]], ["bias", "weight"])
lm = LinearModel(input_values=np.linspace(0, 1), parameters=parameters)

In [ ]:
lm.plot()

In [ ]:
lm.set_data(xs, ys)

lm.show_MSE = True
lm.make_interactive(log=True)