I have a hard-coded deep neural network with structure of 4-4-5-3. The outputs are known to me however the training is not done using backpropagation but using a brute-force algorithm cycling weights’ values between -1 and 1. Outputs will get activated differently and if activation is above 0.6, a certain action is executed. Based on the compound result of all executions from all 3 outputs, a total result is produced for each epoch (I am dealing with timeseries data). From the list of all produced results I pick the ones which fit my goals best.

Now, my question is, how do I replicate this with a “proper” neural network in Keras or similar? Seen as I can’t actually train the NN as I don’t know when each output should “fire”, do I approach this more as an unsupervised learning problem or a classification problem?

Thank you

  • $\begingroup$ Are you asking how to implement the same brute force search procedure using a neural net library? Or how you can achieve a similar result using standard training algorithms instead of your current brute force search? In either case, it would be important to explain the following step in more detail: "From the list of all produced results I pick the ones which fit my goals best." How exactly do you measure what fits your goals best? $\endgroup$
    – user20160
    Mar 18, 2022 at 20:21
  • $\begingroup$ Ok, each output neuron represents an action that must be applied to timeseries financial data, for example — buy, sell, hold and each epoch will produce a total profit result. I am asking what options are there to replicate this training process using a non-hardcoded NN library by either using a bruteforce search through a NN library or standard training algorithms thus avoiding the bruteforce search. What I need is to increase the number of inputs and currently I cannot do that because bruteforce search has a limit to the number of possible searches it can do. Thank you for your input $\endgroup$
    – Peter
    Mar 19, 2022 at 9:43
  • 1
    $\begingroup$ Please add new information as an edit and not only as comments. Comments are easily overlooked, and can be edited/removed. $\endgroup$ Mar 20, 2022 at 14:02

1 Answer 1


The main obstacle to implementing this in Keras or another modern NN library will be formalizing the relationship between the model predictions and the "actions" that are executed. At a high level of generality, the standard approach uses a loss function, and seeks to minimize the discrepancy between the model's predictions and the target. The target is the thing that you're predicting, such as a classification label. Sometimes this is called a "dependent variable."

Once you have your target value and a loss function, Keras has optimizers that you can use to update the weights of your network for you.

As an aside, you describe your model as "taking action." There are specialized methods for training neural networks to interact with an environment and receive feedback about the quality of the network's decisions. A recent example is Alpha Go, Google's neural network that learned how to play the game Go. This neural network was trained using reinforcement learning. I don't know if this is relevant to your specific task, but I thought I would mention it in case it was.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.