Closed GillianGrayson closed 2 years ago
Hi GillianGrayson,
In our implementation, supporting multiple outputs for multiclass classification tasks is rather easy.
For models using an MLP
layer to produce the final prediction, you can achieve so by specifying the number of outputs via the noutput
parameter in the MLP
layer. This applies to dnn, afn, gc_arm, dcn, cin, nfm, xdfm, ipnn, kpnn, wd, gat, gcn, dcn+, sa_glu
. E.g., for gcn
, you should update line 57
with noutput specified for MLP
, and then directly return y
in line 75
without calling the squeeze
function.
Comments on (2):
It is recommended to use the provided MLP
layer, which should be much more efficient than using the for
loop.
Comments on (3):
Actually, models such as dfm, fm, hofm, afm
are originally proposed for binary classification tasks (pls refer to respective papers). Nonetheless, we can also extend these models to support multiclass classification, by simply using our implementation of the FactorizationMachine
layer, initializing it with reduce_dim=False
, and then feeding the output of this layer to another MLP
layer with ninput=nemb
, and noutput=nclass
to produce the final predictions.
Hope the above can address your concerns :)
Thank you a lot for a very informative and quick response!
Hi!
How to correctly support multiple output neurons in your models (for example for multiclass classification task)?
1)
armnet
andarmnet_1h
support multiple output neurons vianoutput
parameter - there is no problem.2) For some models, I added support for multiple output neurons by explicitly specifying the
noutput
parameter in the last MLP-layer, or by adding support for multiple output neurons for the Linear as follows:The following models can be adjusted in this way:
lr
,dnn
,afn
,gc_arm
,dcn
,cin
,nfm
,xdfm
,ipnn
,kpnn
,wd
,gat
,gcn
,dcn+
,sa_glu
.3) It is not quite clear how to add support for multiple output neurons for the following models:
dfm
,fm
,hofm
,afm
because of it is unclear how to modify FactorizationMachine for multiple output.Could you please comment on the correctness of changing the
Linear
layer from (2), and how to add support for multiple output neurons for models from (3)?