In [1]:
import pandas as pd
import solution
In [2]:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
%matplotlib inline
In [3]:
train = solution.get_data()
test = pd.DataFrame(
[
[0.05, 0.54],
[0.91, 0.91],
[0.31, 0.76],
[0.51, 0.31],
]
)
In [4]:
for s in solution.solve(train, test):
print s
In [6]:
model_dict = solution.get_poly_models(train[:60])
In [7]:
solution.plot_poly_models(train[60:], model_dict)
In [8]:
def plot_3d(df):
td = plt.figure(figsize=(10, 10)).gca(projection='3d')
td.scatter(df[0], df[1], df[2])
td.set_xlabel('feature_1')
td.set_ylabel('feature_2')
td.set_zlabel('price')
plt.show()
In [10]:
plot_3d(train)
In [13]:
for i in range(1, 6):
print i, solution.validate_k_fold(train, i)