Replies: 1 comment
-
Hi! In the same long comment (which starts with def apply_model(x_num, x_cat=None):
if isinstance(model, rtdl.FTTransformer):
return model(x_num, x_cat)
elif isinstance(model, (rtdl.MLP, rtdl.ResNet)):
assert x_cat is None
return model(x_num)
else:
# raise NotImplementedError(
# f'Looks like you are using a custom model: {type(model)}.'
# ' Then you have to implement this branch first.'
# )
assert isinstance(model, Model)
return model(x_num, x_cat)
yes, since raw (that is, without any wrappers) rtdl.MLP, rtdl.ResNet are capable of processing only numerical features. You can check it in the implementation of their Does this help? |
Beta Was this translation helpful? Give feedback.
-
Dear Sir/Madam,
In your 'rtdl.ipynb', it says,
IF you use MLP, ResNet or any other simple feed-forward model (NOT transformer-based model) and there are categorical features...Then the model should be used as
model(x_num, x_cat)
instead of ofmodel(x)
.Then in 'apply_model', it seems x_cat cannot be used in rtdl.MLP, rtdl.ResNet. I don't quite understand. Could any explain when cat and num are used in all of these models, how should I input the data into the model and apply_model?
def apply_model(x_num, x_cat=None):
if isinstance(model, rtdl.FTTransformer):
return model(x_num, x_cat)
elif isinstance(model, (rtdl.MLP, rtdl.ResNet)):
assert x_cat is None
return model(x_num)
else:
raise NotImplementedError(
f'Looks like you are using a custom model: {type(model)}.'
' Then you have to implement this branch first.'
)
Beta Was this translation helpful? Give feedback.
All reactions