Answer the question
In order to leave comments, you need to log in
How to input historical data?
I have never written neural networks in my life, but the task has arisen and we need to solve it.
I need the neural network to be able to predict what quantity of goods and on what day a certain client will order, based on his past orders. That is, analyze the intervals between past orders and the quantity ordered.
Implemented as follows:
For training, I take 10 orders, sorted by date, and 1 next as the correct answer. (in total 5400+ such bundles) I
bring the date to UNIX timestep and divide it by 10bn to get something like 0.1526995496
.
I divide the number by 10000 (I have not yet figured out how to normalize the data more correctly).
I give an array as an input, where the date and quantity for each order alternate
[0.1526995496, 0.2, 0.1526995637, 0.4, 0.1526995809, 1.0...]
[0.1536585814, 0.0001]
model = Sequential()
model.add(Dense(units=20, activation=act.relu))
model.add(Dense(units=2, activation=act.linear))
model.compile(optimizer=opt.Adam(), loss=ls.mae, metrics=['accuracy'])
history = model.fit(np_input, np_output, batch_size=1000, epochs=500, validation_split=0.2)
Previous orders:
2019-12-06 12:14:27 - 4.0
2019-12-10 11:25:44 - 2.0
2019-12-16 14:24:47 - 4.0
2020-01-03 13:16:28 - 4.0
2020-01-17 13:04:57 - 10.0
2020-03-27 14:25:57 - 2.0
2020-10-30 14:57:39 - 2.0
2020-11-09 15:00:24 - 3.0
2020-11-20 11:30:43 - 2.0
2021-01-06 11:20:15 - 1.0
Answer:
Date: 2020-01-02 14:58:58.516617
Amount: 13.0
Answer the question
In order to leave comments, you need to log in
I would try to submit the input data by day (week and so on, how deep is your history). Conditionally on an input of 30 numbers.
1) 31 days before day X, bought 0 / 1000
2) 30 days before day X, bought 1 / 1000
....
30) yesterday bought 50 / 1000
Exit interpreted as softmax by options + quantity of goods
1) will call today , probability 0.1
2) will call tomorrow, probability 0.6
3) this week - 0.1
4) went to competitors and is not going to buy anything - 0.2
A) will order goods 8 / 1000
P.S. And that your network is so primitive, it doesn’t smell like deep learning, well, add two more hidden layers of 10-20 neurons or something.
P.P.S. And a batch for 1/5 of the entire sample is such a thing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question