0

I have implemented a custom loss function that is supposed to enhance a binary cross entropy loss function, by weighting incorrect decisions depending on an opportunity cost.

The whole code is listed here: (unfortunately I don't see any way to post it in stachexchange) https://gist.github.com/dickreuter/dcca63d0699b9b195c88c81530f74c5f

You can see the following: if LTP t-0 is greater than starting price, the cumulative sum of 'back' is positive.

I'm trying to build a neural network, can maximize the payoff (the sum of 'back').

For that I have implemented a custom loss function, that punishes the network by lost opportunity (the value of 'back'). For false positives, 'back' will be -1, and the punishment to the network will be according that value as well.

When training the neural network I would expect it to easily find that it simply needs to look at the column 'starting_price_bigger_than_ltp'. But for some reason this doesn't appear to happen.

Any suggestions what I can make better are highly appreciated.

Nickpick
  • 301
  • 1
  • 4
  • 11
  • Generally, CV is not a place to ask coding questions (as they probably won't get the right answers). Also, for [debugging neural networks](https://stats.stackexchange.com/questions/352036/what-should-i-do-when-my-neural-network-doesnt-learn), there is an excellent thread summarizing many successful approaches. In this sense, I think your question would benefit from rewriting: if it is a bug in your code you seek, ask the moderators for migration to Stack Overflow, and also possibly include the code instead of linking the repo (just copy paste with four spaces at the start of each line) ... – Jan Kukacka Sep 25 '18 at 07:21
  • ... (cont.) If it is a conceptual thing, as validating if your loss makes sense mathematically, consider rewriting it in terms of formulas and not variable names from your code. – Jan Kukacka Sep 25 '18 at 07:22

0 Answers0