turn off parts of features in a neural network?












2












$begingroup$


Suppose I have a neural network which accepts two sets of features as inputs and generates corresponding outputs, for instance, generate average final grade from: 1. working hours for N students in a class, 2. mid-term grade for N students in the same class. During training, the neural network is trained with many different classes. What I would like to during inference is to turn off one set of the features (i.e. feed only working hours as inputs) and predict outputs using the same neural network. Obviously, setting the mid-term grades to be all 0s would not be a good option. I wonder if anyone know what would be a good way to do this?



Thanks!










share|improve this question











$endgroup$




bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • $begingroup$
    Why not only train of the features available at test time?
    $endgroup$
    – kbrose
    May 25 '18 at 16:52
















2












$begingroup$


Suppose I have a neural network which accepts two sets of features as inputs and generates corresponding outputs, for instance, generate average final grade from: 1. working hours for N students in a class, 2. mid-term grade for N students in the same class. During training, the neural network is trained with many different classes. What I would like to during inference is to turn off one set of the features (i.e. feed only working hours as inputs) and predict outputs using the same neural network. Obviously, setting the mid-term grades to be all 0s would not be a good option. I wonder if anyone know what would be a good way to do this?



Thanks!










share|improve this question











$endgroup$




bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • $begingroup$
    Why not only train of the features available at test time?
    $endgroup$
    – kbrose
    May 25 '18 at 16:52














2












2








2





$begingroup$


Suppose I have a neural network which accepts two sets of features as inputs and generates corresponding outputs, for instance, generate average final grade from: 1. working hours for N students in a class, 2. mid-term grade for N students in the same class. During training, the neural network is trained with many different classes. What I would like to during inference is to turn off one set of the features (i.e. feed only working hours as inputs) and predict outputs using the same neural network. Obviously, setting the mid-term grades to be all 0s would not be a good option. I wonder if anyone know what would be a good way to do this?



Thanks!










share|improve this question











$endgroup$




Suppose I have a neural network which accepts two sets of features as inputs and generates corresponding outputs, for instance, generate average final grade from: 1. working hours for N students in a class, 2. mid-term grade for N students in the same class. During training, the neural network is trained with many different classes. What I would like to during inference is to turn off one set of the features (i.e. feed only working hours as inputs) and predict outputs using the same neural network. Obviously, setting the mid-term grades to be all 0s would not be a good option. I wonder if anyone know what would be a good way to do this?



Thanks!







neural-network deep-learning






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 23 '18 at 17:44









Brian Spiering

4,2981129




4,2981129










asked Mar 26 '18 at 14:48









username123username123

1113




1113





bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • $begingroup$
    Why not only train of the features available at test time?
    $endgroup$
    – kbrose
    May 25 '18 at 16:52


















  • $begingroup$
    Why not only train of the features available at test time?
    $endgroup$
    – kbrose
    May 25 '18 at 16:52
















$begingroup$
Why not only train of the features available at test time?
$endgroup$
– kbrose
May 25 '18 at 16:52




$begingroup$
Why not only train of the features available at test time?
$endgroup$
– kbrose
May 25 '18 at 16:52










1 Answer
1






active

oldest

votes


















0












$begingroup$

As far as I know, you cannot do that.

First :




Obviously setting the mid-term grades to be all 0s would be be a good
option




No, actually that is a really bad option, neural networks do not understand magical parameters, meaning, if you put a 0 there it will think that the mid-term grades is 0, therefore it will probably give you a very low final grade prediction for you.



My advise, if you are very interested in doing that, create boolean factors, training inputs:




  1. working_hours

  2. mid-term_grade

  3. mid-term_grade_present


mid-term_grade_present should be a 1 when you have the mid-term_grade training data, and 0 when you do not have it. BTW, yes, generate training data without the mid-term_grade.



If you are working with non linear machine learning algorithms that should be enough, if you are using linear algorithms you should one hot encode the mid-term_grade_present and multiply it by the mid-term_grade, ending with something like this:




  1. working_hours

  2. mid-term_grade_present_1 * mid-term_grade

  3. mid-term_grade_present_0 * mid-term_grade






share|improve this answer









$endgroup$













  • $begingroup$
    Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
    $endgroup$
    – username123
    Mar 26 '18 at 15:23










  • $begingroup$
    if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
    $endgroup$
    – Kailegh
    Mar 26 '18 at 15:36










  • $begingroup$
    If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
    $endgroup$
    – username123
    Mar 26 '18 at 15:41










  • $begingroup$
    1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
    $endgroup$
    – Kailegh
    Mar 26 '18 at 18:57










  • $begingroup$
    did this idea finally work for you? or do we have to come up with something else?
    $endgroup$
    – Kailegh
    Mar 27 '18 at 14:54












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f29551%2fturn-off-parts-of-features-in-a-neural-network%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

As far as I know, you cannot do that.

First :




Obviously setting the mid-term grades to be all 0s would be be a good
option




No, actually that is a really bad option, neural networks do not understand magical parameters, meaning, if you put a 0 there it will think that the mid-term grades is 0, therefore it will probably give you a very low final grade prediction for you.



My advise, if you are very interested in doing that, create boolean factors, training inputs:




  1. working_hours

  2. mid-term_grade

  3. mid-term_grade_present


mid-term_grade_present should be a 1 when you have the mid-term_grade training data, and 0 when you do not have it. BTW, yes, generate training data without the mid-term_grade.



If you are working with non linear machine learning algorithms that should be enough, if you are using linear algorithms you should one hot encode the mid-term_grade_present and multiply it by the mid-term_grade, ending with something like this:




  1. working_hours

  2. mid-term_grade_present_1 * mid-term_grade

  3. mid-term_grade_present_0 * mid-term_grade






share|improve this answer









$endgroup$













  • $begingroup$
    Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
    $endgroup$
    – username123
    Mar 26 '18 at 15:23










  • $begingroup$
    if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
    $endgroup$
    – Kailegh
    Mar 26 '18 at 15:36










  • $begingroup$
    If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
    $endgroup$
    – username123
    Mar 26 '18 at 15:41










  • $begingroup$
    1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
    $endgroup$
    – Kailegh
    Mar 26 '18 at 18:57










  • $begingroup$
    did this idea finally work for you? or do we have to come up with something else?
    $endgroup$
    – Kailegh
    Mar 27 '18 at 14:54
















0












$begingroup$

As far as I know, you cannot do that.

First :




Obviously setting the mid-term grades to be all 0s would be be a good
option




No, actually that is a really bad option, neural networks do not understand magical parameters, meaning, if you put a 0 there it will think that the mid-term grades is 0, therefore it will probably give you a very low final grade prediction for you.



My advise, if you are very interested in doing that, create boolean factors, training inputs:




  1. working_hours

  2. mid-term_grade

  3. mid-term_grade_present


mid-term_grade_present should be a 1 when you have the mid-term_grade training data, and 0 when you do not have it. BTW, yes, generate training data without the mid-term_grade.



If you are working with non linear machine learning algorithms that should be enough, if you are using linear algorithms you should one hot encode the mid-term_grade_present and multiply it by the mid-term_grade, ending with something like this:




  1. working_hours

  2. mid-term_grade_present_1 * mid-term_grade

  3. mid-term_grade_present_0 * mid-term_grade






share|improve this answer









$endgroup$













  • $begingroup$
    Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
    $endgroup$
    – username123
    Mar 26 '18 at 15:23










  • $begingroup$
    if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
    $endgroup$
    – Kailegh
    Mar 26 '18 at 15:36










  • $begingroup$
    If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
    $endgroup$
    – username123
    Mar 26 '18 at 15:41










  • $begingroup$
    1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
    $endgroup$
    – Kailegh
    Mar 26 '18 at 18:57










  • $begingroup$
    did this idea finally work for you? or do we have to come up with something else?
    $endgroup$
    – Kailegh
    Mar 27 '18 at 14:54














0












0








0





$begingroup$

As far as I know, you cannot do that.

First :




Obviously setting the mid-term grades to be all 0s would be be a good
option




No, actually that is a really bad option, neural networks do not understand magical parameters, meaning, if you put a 0 there it will think that the mid-term grades is 0, therefore it will probably give you a very low final grade prediction for you.



My advise, if you are very interested in doing that, create boolean factors, training inputs:




  1. working_hours

  2. mid-term_grade

  3. mid-term_grade_present


mid-term_grade_present should be a 1 when you have the mid-term_grade training data, and 0 when you do not have it. BTW, yes, generate training data without the mid-term_grade.



If you are working with non linear machine learning algorithms that should be enough, if you are using linear algorithms you should one hot encode the mid-term_grade_present and multiply it by the mid-term_grade, ending with something like this:




  1. working_hours

  2. mid-term_grade_present_1 * mid-term_grade

  3. mid-term_grade_present_0 * mid-term_grade






share|improve this answer









$endgroup$



As far as I know, you cannot do that.

First :




Obviously setting the mid-term grades to be all 0s would be be a good
option




No, actually that is a really bad option, neural networks do not understand magical parameters, meaning, if you put a 0 there it will think that the mid-term grades is 0, therefore it will probably give you a very low final grade prediction for you.



My advise, if you are very interested in doing that, create boolean factors, training inputs:




  1. working_hours

  2. mid-term_grade

  3. mid-term_grade_present


mid-term_grade_present should be a 1 when you have the mid-term_grade training data, and 0 when you do not have it. BTW, yes, generate training data without the mid-term_grade.



If you are working with non linear machine learning algorithms that should be enough, if you are using linear algorithms you should one hot encode the mid-term_grade_present and multiply it by the mid-term_grade, ending with something like this:




  1. working_hours

  2. mid-term_grade_present_1 * mid-term_grade

  3. mid-term_grade_present_0 * mid-term_grade







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 '18 at 15:10









KaileghKailegh

813




813












  • $begingroup$
    Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
    $endgroup$
    – username123
    Mar 26 '18 at 15:23










  • $begingroup$
    if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
    $endgroup$
    – Kailegh
    Mar 26 '18 at 15:36










  • $begingroup$
    If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
    $endgroup$
    – username123
    Mar 26 '18 at 15:41










  • $begingroup$
    1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
    $endgroup$
    – Kailegh
    Mar 26 '18 at 18:57










  • $begingroup$
    did this idea finally work for you? or do we have to come up with something else?
    $endgroup$
    – Kailegh
    Mar 27 '18 at 14:54


















  • $begingroup$
    Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
    $endgroup$
    – username123
    Mar 26 '18 at 15:23










  • $begingroup$
    if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
    $endgroup$
    – Kailegh
    Mar 26 '18 at 15:36










  • $begingroup$
    If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
    $endgroup$
    – username123
    Mar 26 '18 at 15:41










  • $begingroup$
    1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
    $endgroup$
    – Kailegh
    Mar 26 '18 at 18:57










  • $begingroup$
    did this idea finally work for you? or do we have to come up with something else?
    $endgroup$
    – Kailegh
    Mar 27 '18 at 14:54
















$begingroup$
Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
$endgroup$
– username123
Mar 26 '18 at 15:23




$begingroup$
Sorry that was a typo, it should be Obviously setting the mid-term grades to be all 0s would not be a good option.... I just updated it in the text. If I set mid-term_grade_present to be 0, what should I use as inputs, specifically what should be the data for mid-term_grade part? If it is the same with mid-term_grade_present=1 case, then this boolean flag basically has no effect, if it is something else, what should it be?
$endgroup$
– username123
Mar 26 '18 at 15:23












$begingroup$
if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
$endgroup$
– Kailegh
Mar 26 '18 at 15:36




$begingroup$
if you have enough data you could try taking 20% of it and setting mid-term_grade_present=0
$endgroup$
– Kailegh
Mar 26 '18 at 15:36












$begingroup$
If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
$endgroup$
– username123
Mar 26 '18 at 15:41




$begingroup$
If I set mid-term_grade_present=0 I do not think mid_term_grade data would be ignored by the neural network since: 1. it is already included as part of inputs, 2. it is correlated with outputs.
$endgroup$
– username123
Mar 26 '18 at 15:41












$begingroup$
1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
$endgroup$
– Kailegh
Mar 26 '18 at 18:57




$begingroup$
1.-it is a neural network, it can learn non-linear relationships, and learn features interactions, trust me, it will learn that when mid-term_grade_present=0 it cant rely on mid-term_grade 2.- it is not correlated, you randomly pick a 20% of the data and remove the mid-term_grade info, no correlation in there, give a try, but I sincerely think it should work
$endgroup$
– Kailegh
Mar 26 '18 at 18:57












$begingroup$
did this idea finally work for you? or do we have to come up with something else?
$endgroup$
– Kailegh
Mar 27 '18 at 14:54




$begingroup$
did this idea finally work for you? or do we have to come up with something else?
$endgroup$
– Kailegh
Mar 27 '18 at 14:54


















draft saved

draft discarded




















































Thanks for contributing an answer to Data Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f29551%2fturn-off-parts-of-features-in-a-neural-network%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Callistus I

Tabula Rosettana

How to label and detect the document text images