-
Hi, I'm new on DJL and I want implement my idea, unfortunately, I don't find how to do. My model is like that: I have data composed by different "types", a specific data can share some types with others data but not all types. My idea is for all combinations of type: to do a little Neural Network (NN) by type and a last NN to aggregate outputs from little NN. (When I say type, it's a set of features) An illustration with a simple example I tried to read documentation and the DJL's code on github, I have two ideas to implement my idea but I have problems with each one First idea: ParalleleBlock I saw the ParalleleBlock, I thought I was able to do a function which does what I want but when I read the code of this class I see the function is applied on each children with all inputs. So my question is: Is it possible, for each child, to take only a part of the input and at the end concatenate the parts ? And an other question with this idea: I saw I can use a Trainer to control the training process here. But will there be some conflicts if different trainers (so with different models) share parameters ? (the idea implies that what you call Model is 2 little NN with a NN for the combination in my first illustration) Second idea: from scratch With Pytorch, I saw I could do my idea here
And I don't know if it's the good practice With the from scratch approach (without trainer so), is it possible to use SequentialBlock and to do the forward/bachpropagation manually ? If you have question on my idea, don't hesitate :-) EDIT: I'm wondering if I have to create my own block class inherited from AbstractBlock, I read the code of subclasses already existing, if I understand well I have to override three methods:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
What you want is to create a custom For the Trainer, I want to understand what your use case is a bit more. Do you have three different models because they work on different datasets, but you have shared parameters between them? Or, is it that the models are all working together on a single dataset? Or, is it something else? |
Beta Was this translation helpful? Give feedback.
What you want is to create a custom
AbstractBlock
. TheParallelBlock
andSequentialBlock
are there because they represent common patterns used in many models. But, they can't implement all of the models that people want to implement. With a custom block, you can write pretty much any model as it is just imperative Java code.For the Trainer, I want to understand what your use case is a bit more. Do you have three different models because they work on different datasets, but you have shared parameters between them? Or, is it that the models are all working together on a single dataset? Or, is it something else?