Suppose I train 2 neural networks in stock trading. First network produces enter-trade signals (very sparse). The second network produces exit-trade signals and starts to give signals right after the first gives positive signal.
Question is whether it is mathematically sane to get gradient using just one loss value, which is a function of a squared difference of cumulative return (after 10K trades, for example) from theoretical cumulative return. Doing this trick for both networks, like sharing gradient.
E.g., L <- (-5000 - 20000)^2.
Clarification example of what I meant:
Suppose neural networks have been randomly initialized.
sum_ret_theoretical <- 20000 # theoretical cumulative return
price, input_1, input_2, neural_output_1, neural_output_2
1.000, 0.1, 0.2, 0, NA
1.001, 0.3, 0.1, 0, NA
1.007, 0.9, 0.2, 1, NA
Here first NN gave positive signal
1.01, 0.1, 0.2, NA, 0
1.016, 0.3, 0.1, NA, 0
1.03, 0.9, 0.2, NA, 1
Here second NN gave positive signal
return(i) = 1.03 - 1.007 - 0.0001 = 0.0229 # (trade gained a positive outcome after excluding a constant cost).
Go through all examples [1 in 1:I] until the end of the sample, accumulate returns in vector Ret. Here first training episode has ended.
sum_ret <- sum(Ret)
L <- (sum_ret - sum_ret_theoretical) ^ 2 # get loss function value after first episode ends
calculate neural networks' updates w.r.t. to L derivation (gradients) ## that is the question.
Can I train NN based on extremely sparse loss values (1 per epoch/episode) that is a function of accumulated NN performance. An example of that maybe a NN that is designed to approximate the sum (mean) of the sample of values from variable X, without looking at each x to get loss.