Machine learning in trading: theory, models, practice and algo-trading - page 294
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
What do you think, how do you work with recursion?
With lstm.
+from keras.preprocessing import sequence
+from keras.models import Sequential
+from keras.layers import Dense, Activation, Embedding
+from keras.layers import LSTM
+from keras.datasets import imdb
+
+# Устанавливаем seed для повторяемости результатов
+np.random.seed(42)
+# Максимальное количество слов (по частоте использования)
+max_features = 5000
+# Максимальная длина рецензии в словах
+maxlen = 80
+
+# Загружаем данные
+(X_train, y_train), (X_test, y_test) = imdb.load_data(nb_words=max_features)
+
+# Заполняем или обрезаем рецензии
+X_train = sequence.pad_sequences(X_train, maxlen=maxlen)
+X_test = sequence.pad_sequences(X_test, maxlen=maxlen)
+
+# Создаем сеть
+model = Sequential()
How to control the input, what to loop loop
+model = Sequential()
+# Слой для векторного представления слов
+model.add(Embedding(max_features, 32, dropout=0.2))
+# Слой долго-краткосрочной памяти
+model.add(LSTM(100, dropout_W=0.2, dropout_U=0.2)) # try using a GRU instead, for fun
+# Полносвязный слой
+model.add(Dense(1, activation="sigmoid"))
+
+# Копмилируем модель
+model.compile(loss='binary_crossentropy',
+ optimizer='adam',
+ metrics=['accuracy'])
+
+# Обучаем модель
+model.fit(X_train, y_train, batch_size=64, nb_epoch=7,
+ validation_data=(X_test, y_test), verbose=1)
+# Проверяем качество обучения на тестовых данных
+scores = model.evaluate(X_test, y_test,
+ batch_size=64)
+print("Точность на тестовых данных: %.2f%%" % (scores[1] * 100))
Already tried everything
register athttp://ru.stackoverflow.com the resource is specially designed for asking questions on programming, on any language, at any time, and at the same time we will expand the base of correct answers in russian
What do you think, how do you work with recursion?
With lstm.
+from keras.preprocessing import sequence
+from keras.models import Sequential
+from keras.layers import Dense, Activation, Embedding
+from keras.layers import LSTM
+from keras.datasets import imdb
+
+# Устанавливаем seed для повторяемости результатов
+np.random.seed(42)
+# Максимальное количество слов (по частоте использования)
+max_features = 5000
+# Максимальная длина рецензии в словах
+maxlen = 80
+
+# Загружаем данные
+(X_train, y_train), (X_test, y_test) = imdb.load_data(nb_words=max_features)
+
+# Заполняем или обрезаем рецензии
+X_train = sequence.pad_sequences(X_train, maxlen=maxlen)
+X_test = sequence.pad_sequences(X_test, maxlen=maxlen)
+
+# Создаем сеть
+model = Sequential()
How to control the input, what to loop
Judging by these code snippets you want to investigate/solve the text prediction problem. Here are some questions:
Of course LSTM relates to machine learning models, but textMining to trading?
If you have experience and know-how in the subject, start a new thread, like: TextMiningPython. If there are enthusiasts, they will support you. I will follow the development with interest. But start with a more intelligible description of the input and target data, links to the sources where you get the data and the problem you want to solve. Since your post to understand what it's about can only be a very high-level psychic.
Good luck.
there is a service from google called google correlatehttps://www.google.com/trends/correlate
It can search for correlated user queries, queries are presented in the form of BP. The interesting service is that you can load your BP into it and it will search for such queries that correlate with the specified BP.
The idea is to load there the symbol price and see what it correlates with, it may be useful for searching new predictors, of course, I understand that correlation is a very crude way to find links, but it's still interesting ....
So, the problem is that I do not understand in what form the service should feed the data with the price of the instrument, maybe someone will figure it out and tell me how to prepare the data and in what form they should be
added...........
Here is another article, which will give you a deeper understanding of the service of googlehttp://forbes.net.ua/opinions/1336134-google-pomogaet-ustanovit-zhdut-li-ukraincy-krizisa
the article shows that a strong correlation has been found between the indicators ofthe dynamics of real industrial production
in Ukraine withthe search query ofthe word combination "consumer credit" in Ukraine
there is a service from google called google correlatehttps://www.google.com/trends/correlate
It can search for correlated user queries, queries are presented in the form of BP. The interesting service is that you can load your BP into it and it will search for such queries that correlate with the specified BP.
The idea is to load there the symbol price and see what it correlates with, it may be useful for searching new predictors, of course, I understand that correlation is a very crude way to find links, but it's still interesting ....
So, the problem is that I do not understand in what form the service should feed the data with the price of the instrument, maybe someone will figure it out and tell me how to prepare the data and in what form they should be
The correlation is great, but I remember such indicators as entropy and something else I even do not remember, and here I suddenly wanted to raise the records...... Maybe something useful will come out of it....
there is such a service from google...
interesting, here's the code, but google didn't find anything correlative
interesting, here's the code, but google didn't find anything correlated
Thank you!!!
There is no need to differentiate there, it loses the structure of the series and the trend, you don't need to correlate either, correlation in calculations levels out the absolute values... The maximum you can do is to remove the trend in order to find some seasonal effects, but it's hard to know whether you need it...
Try it and it will work
It's true, the connections are strange to say the least )) From hip-hop forums to inquiries about horses :)
The question is how to identify what is the real connection and what is just a coincidence
There is no need to differentiate there, you lose the structure of the series and the trend
Right, yes. Google can't do that, it only looks for correlation with other trends, not with their increases, sorry, it doesn't turn out as useful.
you don't need to scale either.
It needs to, according to the FAQ (mean=0, sd=1, just what scale does). Although judging by the trend graph, google itself does scale for you in case you forgot.
http://prntscr.com/eighfp
France :)