How to predict a spike using a neural network (preferably using a neurolab or pyramine in python)

I want to use neural networks to predict time series B in the next 30 days from now on, based on series A (I have a complete history of series A) and a list of events E in the next 30 days (E is a list of binary units). Knowing that B is linearly proportional to A and when the event occurs on day i (E [i] = 1), it causes a surge in B (the ratio is unknown). I have training data containing tuples (A, E, B). I tested using a direct transfer network, but it does not work very well (without predicting the correct bursts). Should I use repeating networks and how can I do this with neurolab or pybrain? Thanks.

You can see an example here .

Edit: The code is a bit complicated, so I cannot paste here. However, the idea is that I feed A + E as inputs and predict B, so there are 30 + 30 input units, 30 output units, no hidden layer (I tested with 1 hidden layer, including 30 units and 90 units, t it's better). Timers data is shown in the link above. (The red line B, A has the same shape without peaks).

A_list, B_list, E_list = input() X, Y = [A + E for A, E in zip(A_list, E_list)], B_list indim, outdim = len(X[0]), len(Y[0]) network = nl.net.newp([[-1, 1]]*indim, outdim, transf=nl.trans.LogSig()) errors = network.train(norm_X(X), norm_Y(Y), epochs=4000, show=1000, lr=0.01) 

Where norm_X (X) scales X to [-1,1], and norm_Y scales Y to [0, 1].

+4
source share
1 answer

Try using neurolab.net.newff , with train_bfgs :

 network = nl.net.newff([[-1, 1]]*indim, [10,outdim], transf=nl.trans.LogSig()) network.trainf = nl.train.train_bfgs network.train(...) 

Use reuse, you can see that: http://packages.python.org/neurolab/ex_newelm.html

+2
source

Source: https://habr.com/ru/post/1413206/


All Articles