How would I expand this function call from the Rossman lesson:
ColumnarModelData(PATH, ColumnarDataset.from_data_frame(trn_df, cat_flds=cat_vars, y=trn_y), ColumnarDataset.from_data_frame(val_df, cat_flds=cat_vars, y=val_y), bs=128, test_ds=test_ds)
I attempted to recreate ColumnarDataset.from_data_frame()
by creating three lists of df’s, test_ds, trn_df, val_df
where each is a list of categorical variables, continuous variables, and target variable. i.e.
test_ds = [cat_vars, cont_vars, y]
Here is the Class:
class ColumnarModelData(ModelData):
def __init__(self, path, trn_ds, val_ds, bs, test_ds=None, shuffle=True):
test_dl = DataLoader(test_ds, bs, shuffle=False, num_workers=1) if test_ds is not None else None
super().__init__(path, DataLoader(trn_ds, bs, shuffle=shuffle, num_workers=1),
DataLoader(val_ds, bs*2, shuffle=False, num_workers=1), test_dl)
My attempt:
md = {'path':PATH,
'test_dl':DataLoader(test_ds, batch_size=128, shuffle=False, num_workers=1),
'trn_dl':DataLoader(trn_df, batch_size=128, shuffle=False, num_workers=1),
'val_dl':DataLoader(val_df, batch_size=128*2, shuffle=False, num_workers=1)}
But what I don’t understand is how the output is given. Is it a dict?:
<main.ColumnarModelData at 0x1c3d3349e8>
My attempt tries to create the same object except as a dict but it has no vars() dict attributes like ColumnarModelData.