text_html_output_1.png
train = pd.DataFrame(X, columns=[f'feat_{idx + 1}' for idx in range(X.shape[1])])
num_cols = train.columns.tolist()
categories = ['a'] * 50 + ['b'] * 25 + ['c'] * 25
random.shuffle(categories)
train['feat_5'] = categories
cat_cols = ['feat_5']

target = pd.DataFrame(y, columns=[f'target_{idx + 1}' for idx in range(y.shape[1])])
y_names = target.columns.tolist()

train = pd.concat([train, target], axis=1)

splits = RandomSplitter(valid_pct=0.2)(range_of(train))

to = TabularPandas(train, procs=[Categorify, Normalize], cat_names=cat_cols, cont_names=num_cols, y_names=y_names, splits=splits)

dls = to.dataloaders(bs=16).to('cuda')

xb_cat, xb_cont, yb = dls.one_batch()
(xb_cat.shape, xb_cont.shape, yb.shape)

learn = tabular_learner(dls, metrics=[accuracy_multi], loss_func=BCEWithLogitsLossFlat())
learn.lr_find()

learn.fit_one_cycle(5, 0.001)