Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Implementing BackPropagation - Questions

Hi,
I am trying to implement a simple machine learning model and have a set of general questions how to implement it.
In general it involves building/learning a signal F(x,W)
where
x is current bar(daily/minute)
W is a learned constant

So say F(x,W) returns a buy/sell/hold signal for each bar and my trading algorithm is going to be implemented based on that.

But, W above is a learned constant, meaning W is learned/calculated by applying F(x,W) to historical (daily/minute) bar data and teaching/correcting the result of F(x,W) the value it is expected to return for each bar. Based on this training for each bar, the value of W is adjusted until F(x,W) returns what we want.

Learning W in F(x,W) is a one time operation for the whole algorithm and W is not modified after that.

This is F(x,W) is then used in both backtesting as well as paper trading forward.

Questions:
1. Where is the best API to implement the learning of W batch_transform ?? I can see how batch transform can be used to calculate the signal F(x,W) during backtesting/papertrading. But learning of W must happen only once and requires probably say 5 years or more of historical data/bars. While generating the signal F(x,W) after W has been learned probably only requires about may be the last 10-50 bars
2. Where can W be saved after training so that
2.1 It can be accessed from with the algo so that each call to handle_data() can use it
2.2 Is there a way to save it somewhere so that it can be used in a different algorithm. Because it may take quite a bit of computation/training to arrive at a good W
3. Is there a way to implement common code/functionality as my own library and then be able to use it multiple algorithms?