How to setup regression problem

username: MichaelMMeskhi
cooked: <p>Hello,</p>
<p>I am looking into how to properly setup a regression problem. My concern is with the targets. For example, for each example in my input, I have 3x5 numerical outputs.</p>
<p>Example 1: output_1 - 5, 6, 7, 53, 0.5<br>
output_2 - 5, 0.3, 7, 53, 0.5<br>
output_3 - 5, 6.2, 7, 53, 0.5</p>
<p>And so on. Basically it is a multi-target regression if I am not mistaken. In the end, I want to predict only final 5 values based on 3 outputs available for each input example. I would like some guidance on how to process such data and what kind of architecture would be best suited to begin with.</p>
<p>Thank you</p>

username: ptrblck
cooked: <p>Could you explain how the single input sample create 3 outputs containing the 5 predictions?<br>
Are these 3 predictions created by different models for the same input?</p>

username: MichaelMMeskhi
cooked: <p>For example, an instance beach house with some qualities as a feature vector x. The goal is to predict this house’s price, customer rating, whatever some real values. But I have three such entries of one house. So let’s imagine the price, customer rating, etc… is different from 3 different websites. Does this make sense?</p>

username: ptrblck
cooked: <p>Thanks for the explanation. In that case I think you could treat this output as 15 independent predictions.<br>
I assume you would like to predict the 5 attributes from all 3 websites, not the mean/median etc.</p>

username: MichaelMMeskhi
cooked: <p>Yes, you’re correct. Thank you!</p>

username: BramVanroy
cooked: <p>I might be misunderstanding the problem, but it seems to make more sense to me to separate those three reviews into three different inputs so that in your final layer you only have to predict 5 attributes. Unless the problem is specifically to predict <em>three</em> sets of those attributes. Otherwise, I would guess that your problem is “for a given house, predict these five attributes”. If that is the case, you probably want to separate the different scores into different inputs.</p>

username: MichaelMMeskhi
cooked: <p>I see how my question might be confusing, I did not phrase it well. Per example, I would like to predict 3 sets of 5 attributes.</p>

username: BramVanroy
cooked: <p>Then you should indeed go with the suggestion by <a class="mention" href="/u/ptrblck">@ptrblck</a>!</p>

username: MichaelMMeskhi
cooked: <p>Hello,</p>
<p>I managed to setup a simple linear network with 2 hidden layers. Input data is 123 examples and 450 features. Predicting 12 output values (regression using MSELoss with Adam). Couple questions, my goal is to let the neural network perform feature selection/engineering. Then, I want to generate a new dataset based on this. For example, I learn some weights and then given a new dataset, say I pass the input through the weights without activations, those are my new learned examples based on the learned representation of my network?</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="MichaelMMeskhi" data-post="9" data-topic="96537">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/michaelmmeskhi/48/52095_2.png" class="avatar"> MichaelMMeskhi:</div>
<blockquote>
<p>For example, I learn some weights and then given a new dataset, say I pass the input through the weights without activations, those are my new learned examples based on the learned representation of my network?</p>
</blockquote>
</aside>
<p>The activations will be the output of each layer, so unless I misunderstand the sentence, you won’t be able to pass the input through the model without creating activations.</p>
<p>If you are trying to create new “features”, you could use the penultimate activations and try to train a new classifier on them. This would be similar to the fine-tuning approach, where you would freeze all but the last layers and only train the last layer.<br>
However, if you store these activations separately you are also free to use other ML models such as SVMs, RandomForest  etc.</p>
<aside class="quote no-group" data-username="MichaelMMeskhi" data-post="9" data-topic="96537">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/michaelmmeskhi/48/52095_2.png" class="avatar"> MichaelMMeskhi:</div>
<blockquote>
<p>my goal is to let the neural network perform feature selection/engineering</p>
</blockquote>
</aside>
<p>I’m a bit confused about this sentence, as feature selection is used in the some ML approaches to select input features. E.g. a random forest classifier can be used to remove highly correlated or noisy features based on the entropy etc. of the splits.<br>
However, it seems you would like to use feature selection or engineering “inside the model”?<br>
Could you explain your use case a bit?</p>

username: MichaelMMeskhi
cooked: <p>Hey <a class="mention" href="/u/ptrblck">@ptrblck</a> I appreciate your feedback! Yes, that’s what I ended up using. My question is since I am using a ReLU as my non-linear activation, in the penultimate layer, obviously I end up with some 0 values. Would using a LeakyReLU be a better approach?</p>
<p>What I meant in regards to your second part, was that I have around ~500 features and would like to do some sort of feature engineering. I know a NN technically does that by learning a new representation and such. But what I meant was is there a specific way to achieve that or it just depends on what my problem is and what I want.</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="MichaelMMeskhi" data-post="11" data-topic="96537">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/michaelmmeskhi/48/52095_2.png" class="avatar"> MichaelMMeskhi:</div>
<blockquote>
<p>since I am using a ReLU as my non-linear activation, in the penultimate layer, obviously I end up with some 0 values. Would using a LeakyReLU be a better approach?</p>
</blockquote>
</aside>
<p>You would have to check the model performance by switching the last non-linearity.<br>
Note that zero outputs don’t necessarily mean a “bad” behavior. If your model is able to successfully predict the targets, this activation (with zeros) seems to be a good representation such that the last linear layer can act as the classifier and compute the outputs.</p>
<aside class="quote no-group" data-username="MichaelMMeskhi" data-post="11" data-topic="96537">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/michaelmmeskhi/48/52095_2.png" class="avatar"> MichaelMMeskhi:</div>
<blockquote>
<p>What I meant in regards to your second part, was that I have around ~500 features and would like to do some sort of feature engineering. I know a NN technically does that by learning a new representation and such. But what I meant was is there a specific way to achieve that or it just depends on what my problem is and what I want.</p>
</blockquote>
</aside>
<p>Are these 500 features the input features or are you creating them in the model as an intermediate activation?<br>
Unfortunately, I don’t know what the current method would be to perform feature selection in a neural network. If I remember it correctly, I’ve read some papers which claim that e.g. the parameter or gradient magnitude does not correlate to the “importance” of these units. However, I cannot find the reference at the moment.</p>

username: BramVanroy
cooked: <p>I’d also be interested to see what the current best way is to do feature selection over a given input feature set. One could try our all possible combinations but that is not always feasible.</p>

username: MichaelMMeskhi
cooked: <blockquote>
<p>You would have to check the model performance by switching the last non-linearity.<br>
Note that zero outputs don’t necessarily mean a “bad” behavior. If your model is able to successfully predict the targets, this activation (with zeros) seems to be a good representation such that the last linear layer can act as the classifier and compute the outputs.</p>
</blockquote>
<p>Performance is good. And yes, having a 0 doesn’t mean its bad but if I were to extract penultimate layer activations, I could simply drop the 0 valued columns and thus have even reduced dimensions.</p>
<blockquote>
<p>Are these 500 features the input features or are you creating them in the model as an intermediate activation?<br>
Unfortunately, I don’t know what the current method would be to perform feature selection in a neural network. If I remember it correctly, I’ve read some papers which claim that e.g. the parameter or gradient magnitude does not correlate to the “importance” of these units. However, I cannot find the reference at the moment.</p>
</blockquote>
<p>Yes, those are the input features. I see. The parameter reference seems interesting.</p>
<p>Thank you!</p>

username: MichaelMMeskhi
cooked: <p>Unfortunately that is not. I am currently exploring simple DNNs and Variational Autoencoders. So far, results seem to be similar.</p>