Regression with tabular pandas - "Unnormalize the predictions"

Hi There,

So I am working with the fastai’s TabularPandas.

Following the usual steps:

procs_nn = [Categorify, Normalize]
to_nn = TabularPandas(dataf, procs_nn, cat_names=cat, cont_names=cont, 
                      y_names='turnover_log', splits = splits, 
                      y_block=RegressionBlock(n_out = 1))

learner = tabular_learner(dls, y_range=(-0.96, 3.1), layers=[500, 250], 
                          n_out=1, 
                          loss_func=F.mse_loss, 
                          metrics = [exp_rmspe, rmse])

learner.fit_one_cycle(14, 0.00083)

learner.predict(df_train.iloc[500])

It seems to me like the predictions are in log scale as well as normalize. Does Fastai’s learner object unnormalize and unlogs (exp) the predictions for us or is this something to do “by-hand”

Many thanks

Hello,

The problem is how you got df_train: Was it extracted from to_nn? In that case, you cannot feed it directly to the Learner; you must first do,

row = df_train.iloc[500]
row = dls.decode_row(row)
_, _, pred = learn.predict(row)

If, however, your data point is already decoded, you can pass it to the Learner unchanged.

Please do let me know if this helps.

Cheers!