How to use a trained Neural Network?










-2














I'm trying to understand the logic behind the use of a trained Neural Network. If I'm right : we should save the weights from the previous training, then, reload them with the new input.



For example, I have this data set :



  • Input= [[0,1][1,1]]

  • Output=[[1],[0]]

  • Results after training = [[0.999...],[0.005...]]

And I have also saved the weights. What I don't understand is : how I should use the previous weights to make a prediction for example ? For example, I want to try a prediction with the following input [1,0]. I find a lot of resources online with Matlab or Python, but I don't find something to clearly understand what the calculations are, to do it "from scratch".



Thank you,










share|improve this question























  • Can you post the code that you have so far and input data to be able to reproduce it?
    – Franco Piccolo
    Nov 11 at 18:34










  • I don't have write any code to use my trained network, because I don't understand how things works. I have try things like summing all the weights etc... but it doesn't work. That's why I really need to understand how to use my trained neural network
    – app_idea54
    Nov 11 at 19:10











  • Well, how did you train it to begin with? Or are you trying to use a neural net you pulled off the Internet?
    – Havenard
    Nov 11 at 19:26










  • No, I build my own Neural Network with an input, an hidden layer and an output. I use sigmoid function as activation function. As I previously said : I don't understand how I could use the data from my training.
    – app_idea54
    Nov 11 at 19:42











  • How did you get the outputs for your training set? Do the exact same thing using the trained weights to predict the output for the new sample.
    – beaker
    Nov 11 at 20:25















-2














I'm trying to understand the logic behind the use of a trained Neural Network. If I'm right : we should save the weights from the previous training, then, reload them with the new input.



For example, I have this data set :



  • Input= [[0,1][1,1]]

  • Output=[[1],[0]]

  • Results after training = [[0.999...],[0.005...]]

And I have also saved the weights. What I don't understand is : how I should use the previous weights to make a prediction for example ? For example, I want to try a prediction with the following input [1,0]. I find a lot of resources online with Matlab or Python, but I don't find something to clearly understand what the calculations are, to do it "from scratch".



Thank you,










share|improve this question























  • Can you post the code that you have so far and input data to be able to reproduce it?
    – Franco Piccolo
    Nov 11 at 18:34










  • I don't have write any code to use my trained network, because I don't understand how things works. I have try things like summing all the weights etc... but it doesn't work. That's why I really need to understand how to use my trained neural network
    – app_idea54
    Nov 11 at 19:10











  • Well, how did you train it to begin with? Or are you trying to use a neural net you pulled off the Internet?
    – Havenard
    Nov 11 at 19:26










  • No, I build my own Neural Network with an input, an hidden layer and an output. I use sigmoid function as activation function. As I previously said : I don't understand how I could use the data from my training.
    – app_idea54
    Nov 11 at 19:42











  • How did you get the outputs for your training set? Do the exact same thing using the trained weights to predict the output for the new sample.
    – beaker
    Nov 11 at 20:25













-2












-2








-2


2





I'm trying to understand the logic behind the use of a trained Neural Network. If I'm right : we should save the weights from the previous training, then, reload them with the new input.



For example, I have this data set :



  • Input= [[0,1][1,1]]

  • Output=[[1],[0]]

  • Results after training = [[0.999...],[0.005...]]

And I have also saved the weights. What I don't understand is : how I should use the previous weights to make a prediction for example ? For example, I want to try a prediction with the following input [1,0]. I find a lot of resources online with Matlab or Python, but I don't find something to clearly understand what the calculations are, to do it "from scratch".



Thank you,










share|improve this question















I'm trying to understand the logic behind the use of a trained Neural Network. If I'm right : we should save the weights from the previous training, then, reload them with the new input.



For example, I have this data set :



  • Input= [[0,1][1,1]]

  • Output=[[1],[0]]

  • Results after training = [[0.999...],[0.005...]]

And I have also saved the weights. What I don't understand is : how I should use the previous weights to make a prediction for example ? For example, I want to try a prediction with the following input [1,0]. I find a lot of resources online with Matlab or Python, but I don't find something to clearly understand what the calculations are, to do it "from scratch".



Thank you,







machine-learning neural-network training-data






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 19:23

























asked Nov 11 at 18:16









app_idea54

104




104











  • Can you post the code that you have so far and input data to be able to reproduce it?
    – Franco Piccolo
    Nov 11 at 18:34










  • I don't have write any code to use my trained network, because I don't understand how things works. I have try things like summing all the weights etc... but it doesn't work. That's why I really need to understand how to use my trained neural network
    – app_idea54
    Nov 11 at 19:10











  • Well, how did you train it to begin with? Or are you trying to use a neural net you pulled off the Internet?
    – Havenard
    Nov 11 at 19:26










  • No, I build my own Neural Network with an input, an hidden layer and an output. I use sigmoid function as activation function. As I previously said : I don't understand how I could use the data from my training.
    – app_idea54
    Nov 11 at 19:42











  • How did you get the outputs for your training set? Do the exact same thing using the trained weights to predict the output for the new sample.
    – beaker
    Nov 11 at 20:25
















  • Can you post the code that you have so far and input data to be able to reproduce it?
    – Franco Piccolo
    Nov 11 at 18:34










  • I don't have write any code to use my trained network, because I don't understand how things works. I have try things like summing all the weights etc... but it doesn't work. That's why I really need to understand how to use my trained neural network
    – app_idea54
    Nov 11 at 19:10











  • Well, how did you train it to begin with? Or are you trying to use a neural net you pulled off the Internet?
    – Havenard
    Nov 11 at 19:26










  • No, I build my own Neural Network with an input, an hidden layer and an output. I use sigmoid function as activation function. As I previously said : I don't understand how I could use the data from my training.
    – app_idea54
    Nov 11 at 19:42











  • How did you get the outputs for your training set? Do the exact same thing using the trained weights to predict the output for the new sample.
    – beaker
    Nov 11 at 20:25















Can you post the code that you have so far and input data to be able to reproduce it?
– Franco Piccolo
Nov 11 at 18:34




Can you post the code that you have so far and input data to be able to reproduce it?
– Franco Piccolo
Nov 11 at 18:34












I don't have write any code to use my trained network, because I don't understand how things works. I have try things like summing all the weights etc... but it doesn't work. That's why I really need to understand how to use my trained neural network
– app_idea54
Nov 11 at 19:10





I don't have write any code to use my trained network, because I don't understand how things works. I have try things like summing all the weights etc... but it doesn't work. That's why I really need to understand how to use my trained neural network
– app_idea54
Nov 11 at 19:10













Well, how did you train it to begin with? Or are you trying to use a neural net you pulled off the Internet?
– Havenard
Nov 11 at 19:26




Well, how did you train it to begin with? Or are you trying to use a neural net you pulled off the Internet?
– Havenard
Nov 11 at 19:26












No, I build my own Neural Network with an input, an hidden layer and an output. I use sigmoid function as activation function. As I previously said : I don't understand how I could use the data from my training.
– app_idea54
Nov 11 at 19:42





No, I build my own Neural Network with an input, an hidden layer and an output. I use sigmoid function as activation function. As I previously said : I don't understand how I could use the data from my training.
– app_idea54
Nov 11 at 19:42













How did you get the outputs for your training set? Do the exact same thing using the trained weights to predict the output for the new sample.
– beaker
Nov 11 at 20:25




How did you get the outputs for your training set? Do the exact same thing using the trained weights to predict the output for the new sample.
– beaker
Nov 11 at 20:25












1 Answer
1






active

oldest

votes


















0














It is as simple as doing your feedforward step with learned weights.



these are the steps you do in general:



1- feed forward : giving inputs to produce output labels



2-calculating the cost base on true labels of inputs which you have in a supervised problem



3-going backward in network to update your weights base on the cost



After you finished the training , you don't do step 2 and 3, you just Do the first step. going forward in network with new inputs and the learned weights in training process. the output is your prediction.






share|improve this answer




















  • I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
    – app_idea54
    Nov 12 at 6:52











  • there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
    – leo
    Nov 12 at 7:11











  • That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
    – app_idea54
    Nov 12 at 8:11










  • @app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
    – beaker
    Nov 12 at 18:00










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f53251755%2fhow-to-use-a-trained-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














It is as simple as doing your feedforward step with learned weights.



these are the steps you do in general:



1- feed forward : giving inputs to produce output labels



2-calculating the cost base on true labels of inputs which you have in a supervised problem



3-going backward in network to update your weights base on the cost



After you finished the training , you don't do step 2 and 3, you just Do the first step. going forward in network with new inputs and the learned weights in training process. the output is your prediction.






share|improve this answer




















  • I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
    – app_idea54
    Nov 12 at 6:52











  • there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
    – leo
    Nov 12 at 7:11











  • That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
    – app_idea54
    Nov 12 at 8:11










  • @app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
    – beaker
    Nov 12 at 18:00















0














It is as simple as doing your feedforward step with learned weights.



these are the steps you do in general:



1- feed forward : giving inputs to produce output labels



2-calculating the cost base on true labels of inputs which you have in a supervised problem



3-going backward in network to update your weights base on the cost



After you finished the training , you don't do step 2 and 3, you just Do the first step. going forward in network with new inputs and the learned weights in training process. the output is your prediction.






share|improve this answer




















  • I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
    – app_idea54
    Nov 12 at 6:52











  • there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
    – leo
    Nov 12 at 7:11











  • That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
    – app_idea54
    Nov 12 at 8:11










  • @app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
    – beaker
    Nov 12 at 18:00













0












0








0






It is as simple as doing your feedforward step with learned weights.



these are the steps you do in general:



1- feed forward : giving inputs to produce output labels



2-calculating the cost base on true labels of inputs which you have in a supervised problem



3-going backward in network to update your weights base on the cost



After you finished the training , you don't do step 2 and 3, you just Do the first step. going forward in network with new inputs and the learned weights in training process. the output is your prediction.






share|improve this answer












It is as simple as doing your feedforward step with learned weights.



these are the steps you do in general:



1- feed forward : giving inputs to produce output labels



2-calculating the cost base on true labels of inputs which you have in a supervised problem



3-going backward in network to update your weights base on the cost



After you finished the training , you don't do step 2 and 3, you just Do the first step. going forward in network with new inputs and the learned weights in training process. the output is your prediction.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 21:58









leo

1748




1748











  • I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
    – app_idea54
    Nov 12 at 6:52











  • there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
    – leo
    Nov 12 at 7:11











  • That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
    – app_idea54
    Nov 12 at 8:11










  • @app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
    – beaker
    Nov 12 at 18:00
















  • I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
    – app_idea54
    Nov 12 at 6:52











  • there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
    – leo
    Nov 12 at 7:11











  • That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
    – app_idea54
    Nov 12 at 8:11










  • @app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
    – beaker
    Nov 12 at 18:00















I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
– app_idea54
Nov 12 at 6:52





I understand the fact that I need to do a forward pass with the learned weights, and I know how to make a feedforward neural network with backpropagation. But I dont understand wich learned weights I need to use after my neural network is trained
– app_idea54
Nov 12 at 6:52













there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
– leo
Nov 12 at 7:11





there is only one weight matrix, what do you mean? there is only one set of weights that you are updating in each iteration and you need to keep it. if you understand and know how to do a feedforward as you said, do a feedforward with a new input after train with the weight matrix you have.
– leo
Nov 12 at 7:11













That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
– app_idea54
Nov 12 at 8:11




That what I'm trying to understand : how I must use the weight matrix ? It's not really clear for me : if I made a training with multiple inputs, then I save weights in a matrix, what is the method to use the weight matrix ? For example, should I sum them up ? Or should I iterate with them ?
– app_idea54
Nov 12 at 8:11












@app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
– beaker
Nov 12 at 18:00




@app_idea54 There is only one set of weights at any given time. Backpropagation updates those weights, which are then used on the next input. The weights used for prediction with the trained NN are the updated weights resulting from backpropagation on all training samples.
– beaker
Nov 12 at 18:00

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • 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.

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





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.

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%2fstackoverflow.com%2fquestions%2f53251755%2fhow-to-use-a-trained-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

Kleinkühnau

Makov (Slowakei)

Deutsches Schauspielhaus