5

4

I'm trying to create a neural network and train it to test predictability of short term stock price movements.

I've collated a 1-min open, high, low, closing and volume dataset for a particular stock. The idea is to train a network to crunch the data for times T - 1, T - 2, T - 3, T - 4, T - 5 to predict T + 5 closing price. Ideally, the network takes 7 input vectors

`{{open}, {high}, {low}, {close}, {volume}, {dayofweek}, {minutes_since_open}}`

over the past 5 minutes, i.e., 7 inputs x 5 time-steps, to produce a single output: `{close}`

at T + 5.

I'm still a bit rough, dusting off my Mathematica skills, as the last time I used it was with V7, before all the new features :)

Would really love some help here...

Here's a link to the data set (csv) :)

Have you looked into the

`Predict`

function to get started? – kickert – 2019-07-08T01:53:26.703My understanding is that Predict is more of a statistical function not a NN per se.... am I correct? – CuriousDudeFromEgypt – 2019-07-08T10:16:46.570

@CuriousDudeFromEgypt,

`Predict`

is considered supervised machine learning. You put labeled data in and it builds a model you can use for future data. I recommend you start there before you move into the`NetTrain`

family of functions. – kickert – 2019-07-08T11:33:14.200@CuriousDudeFromEgypt

`Predict[data, Method -> "NeuralNetwork"]`

does use`NeuralNetwork.`

– Xminer – 2019-07-08T11:40:25.857I retracted the flag because I found the person in the wolfram community dealing with the topic. – Xminer – 2019-07-08T11:48:47.040

@Xminer will give this a spin... (a) do you know what type of neural net does

`Predict`

use? (b) I managed to create & train a sample subset of the data using a`GatedRecurrentLayer[10] + LinearLayer`

(borrowing from another post), what’s a better network chain? (c) is there any documentation/pointer that explains how many inputs does each layer type have, how many outputs? I’m still a bit confused... Thanks :) – CuriousDudeFromEgypt – 2019-07-08T20:35:34.517(a) after run

– Xminer – 2019-07-09T07:33:02.453`Predict`

,you can see NN with`List @@ % // "Model" /. # & // "Network" /. # &`

(b)`optimal structure`

depends on`your objective function`

,the problem you're working on.For What(really important) are you trying to predict the short-term movement? (c)`How to visualize Network Structure`

,you mean? Play with NetGraph Examples@Xminer ... so, I couldn't get

`Predict`

to work with my input vectors, not sure what I'm doing wrong (error msg below):`Predict::mlincfttp: Incompatible variable type (Numerical) and variable value ({30.7399}).`

An example of the input vectors below:

`{{{31.07, 30.95, 30.99, 30.946, 30.915}, {31.12, 31.05, 31., 30.97, 30.97}, {30.9, 30.905, 30.88, 30.895, 30.89}, {30.96, 30.99, 30.94, 30.9154, 30.895}, {1216676, 600033, 462164, 357901, 248249}, {1, 2, 3, 4, 5}, {5, 5, 5, 5, 5}} -> {30.7399},{..etc..}`

Ideas? – CuriousDudeFromEgypt – 2019-07-16T17:53:28.437

@CuriousDudeFromEgypt Why

`close-open`

is always negative in your data? – Xminer – 2019-08-01T09:11:16.020