I would like to implement an MTL NN in Flux but is not clear to me how to create a different set of layers for each task.
Right now I’m outputting all the tasks in the final layer and using logitcrossentropy
loss as all the tasks involve classification. The model is working but I would like to apply a different loss for each task as well as custom layers that are task specific.
n_in = size(train_x)[1]
n_out = size(train_y)[1]
skip_component = SkipConnection(
Chain(
Dropout(0.15),
Dense(n_in, n_in*2, relu),
BatchNorm(n_in*2, relu),
Dropout(0.15),
Dense(n_in*2, n_in*2, relu),
Dropout(0.15),
Dense(n_in*2, n_in*2, relu),
Dropout(0.15),
Dense(n_in*2, n_in*2, relu),
BatchNorm(n_in*2, relu),
Dropout(0.15),
Dense(n_in*2, n_in, relu),
), +)
m = Chain(
Dropout(0.3),
Dense(n_in, n_in, relu),
skip_component,
skip_component,
skip_component,
skip_component,
skip_component,
skip_component,
skip_component,
skip_component,
skip_component,
Dense(n_in, n_out, sigmoid),
) |> gpu