当前位置:网站首页>Stock price forecast
Stock price forecast
2022-07-04 00:05:00 【Zhangchuncheng】
Stock price forecast
This article uses machine learning Methods a practical method to predict the stock price .
But if you want to make money with it , Guess how much you will lose ?
Data sources
The data comes from 2021 Years and 2022 The United States since NASDAQ Index data . The data includes
Opening price ( Open);Closing price ( Close/Last);All day high value ( High);All day low ( Low).
In form , No matter which value , It is a time series , The sampling interval is 1 God
among , For index , Represents the number of days .

One last little question , there “ Index ” and “ Stock price ” What does it matter ?
The NASDAQ-100 Index includes 100 of the largest domestic and international non-financial companies listed on The NASDAQ Stock Market based on market capitalization.
The Index reflects companies across major industry groups including computer hardware and software, telecommunications, retail/wholesale trade and biotechnology.
Simply speaking , It is also called NASDAQ 100, Is the U.S. 100 Stock price index of major non-financial companies .
In a nutshell , It represents “ US stock market ” The overall trend of . If we can predict its value , Then you can make money in the stock market .
The basic method
What is prediction ? Is a known past value , Estimate the subsequent value
such as , I want to know tomorrow's index (), Just use the known today ()、 yesterday () And the day before yesterday () To predict it .
This paper adopts three classic machine learning Methods to do this , Namely
Linear SVR linear regression model ; RBF SVR Kernel regression model ; Bayesian Ridge Probability model .
# SVR with linear and RBF kernels
from sklearn.svm import SVR
# Bayesian Ridge Regression
from sklearn.linear_model import BayesianRidge
# Some amazing code for stock analysis
# ...
The result of the calculation is
say concretely , I use a long period of data to train the regression model
The input parameters of the model are as follows 20The index value of days ;The output parameters are “ Tomorrow, ” Index value of .
Then use the trained model , Predict the data of another period , The prediction effect is as follows
Train in the second half , Use the first half of the time to test

Stock 2 Use the first half of the training , Test in the second half of the time

Stock 3
so , Linear model (Linear) And probability models (BR) The prediction effect is better , And the nonlinear model of kernel function (RBF) The prediction effect is poor .
On the whole , Such a simple model has been able to achieve “ It looks good ” The prediction effect of .
Machine learning model “ prejudice ”
Next , Let me take a closer look at the details of the prediction , You will find a very interesting phenomenon , This involves
Machine learning model “ prejudice ” problem ,
Judging from the general trend , This index started last year , It has been showing a steady downward trend .
Because the regression model can only learn the data it sees , therefore , It must have “ prejudice ”
Predict the index in the later period

Stock 4 Because the previous indexes are higher than the real value , therefore , Regression models include The predicted value should be slightly larger Prejudice ;
Predict the index of the previous period

Stock 5 This result is contrary to the previous , Regression models include The predicted value should be slightly smaller Prejudice .
Because this is pure Data driven Result , therefore , From the perspective of big data, there is no problem . But emotionally , Will think that it has a certain “ ethic ” problem .
Because of the bias of previous data , It will affect the later results like a ghost . The stock market is a relatively neutral place , But if the predicted value is human “ Ability ”、“ level ” Or something , It will inevitably infiltrate human “ Moral judgment ”, Thus causing substantial inequality .
边栏推荐
- Open 2022 efficient office, starting from project management
- Comment obtenir une commission préférentielle pour l'ouverture d'un compte en bourse? Est - ce que l'ouverture d'un compte en ligne est sécurisée?
- Tencent interview: can you find the number of 1 in binary?
- [note] IPC traditional interprocess communication and binder interprocess communication principle
- Fluent learning (5) GridView
- The upload experience version of uniapp wechat applet enters the blank page for the first time, and the page data can be seen only after it is refreshed again
- It is forbidden to splice SQL in code
- Cgb2201 preparatory class evening self-study and lecture content
- After the Lunar New Year and a half
- Les sociétés de valeurs mobilières dont la Commission d'ouverture d'un compte d'actions est la plus faible ont ce que tout le monde recommande.
猜你喜欢

Design of logic level conversion in high speed circuit

Kubedl hostnetwork: accelerating the efficiency of distributed training communication

Introducing Software Testing

How will the complete NFT platform work in 2022? How about its core functions and online time?

Vscode regular match replace console log(.*)

Correlation analysis summary

Reading notes on how programs run

Iclr2022: how does AI recognize "things I haven't seen"?

2022 a special equipment related management (elevator) examination questions and a special equipment related management (elevator) examination contents
![[note] IPC traditional interprocess communication and binder interprocess communication principle](/img/f6/36c28df02198539e27352e3cdf4ba6.jpg)
[note] IPC traditional interprocess communication and binder interprocess communication principle
随机推荐
Gossip about redis source code 79
How to prevent malicious crawling of information by one-to-one live broadcast source server
Briefly understand the operation mode of developing NFT platform
Op amp related - link
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
D29:post Office (post office, translation)
I would like to ask how the top ten securities firms open accounts? Is it safe to open an account online?
Correlation analysis summary
【leetcode】300. Longest increasing subsequence (dynamic programming, dichotomy)
C # basic knowledge (2)
Deep learning ----- using NN, CNN, RNN neural network to realize MNIST data set processing
P1339 [USACO09OCT]Heat Wave G
How will the complete NFT platform work in 2022? How about its core functions and online time?
Detailed explanation of the relationship between Zhongtai, wechat and DDD
Suggestions for improving code quality
Test the influence of influent swacth on the electromagnetic coil of quartz meter
Ramble 72 of redis source code
Recommendation of knowledge base management system
Report on prospects and future investment recommendations of China's assisted reproductive industry, 2022-2028 Edition
D23:multiple of 3 or 5 (multiple of 3 or 5, translation + solution)