#!/usr/bin/env python # coding: utf-8 # # Deep learning for Bulldozers # In[1]: get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') # In[2]: get_ipython().run_line_magic('matplotlib', 'inline') from fastai.imports import * from fastai.torch_imports import * from fastai.dataset import * from fastai.learner import * from fastai.structured import * from fastai.column_data import * # # Load in our data from last lesson # In[53]: dep = 'SalePrice' PATH = "data/bulldozers/" df_raw = pd.read_feather('tmp/bulldozers-raw') keep_cols = list(np.load('tmp/keep_cols.npy')) # In[54]: df_raw.loc[df_raw.YearMade<1950, 'YearMade'] = 1950 df_raw['age'] = df_raw.saleYear-df_raw.YearMade df_raw = df_raw[keep_cols+['age', dep]].copy() df_indep = df_raw.drop(dep,axis=1) n_valid = 12000 n_trn = len(df_raw)-n_valid # In[55]: cat_flds = [n for n in df_indep.columns if df_raw[n].nunique()