当前位置:网站首页>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 20
The 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 .
边栏推荐
- 2020.2.14
- It is forbidden to splice SQL in code
- Report on the construction and development mode and investment mode of sponge cities in China 2022-2028
- Similarities and differences of text similarity between Jaccard and cosine
- 2022 chemical automation control instrument examination content and chemical automation control instrument simulation examination
- Gossip about redis source code 75
- 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?
- How to understand the gain bandwidth product operational amplifier gain
- MySQL is installed as a Windows Service
- AI Challenger 2018 text mining competition related solutions and code summary
猜你喜欢
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
Analysis of refrigeration and air conditioning equipment operation in 2022 and examination question bank of refrigeration and air conditioning equipment operation
Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at
Schematic diagram of crystal oscillator clock and PCB Design Guide
Selenium check box
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Recommendation of knowledge base management system
Test the influence of influent swacth on the electromagnetic coil of quartz meter
[about text classification trick] things you don't know
随机推荐
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
How to solve the "safe startup function prevents the operating system from starting" prompt when installing windows10 on parallel desktop?
Suggestions for improving code quality
"Learning notes" recursive & recursive
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?
ITK learning notes (VII) the position of ITK rotation direction remains unchanged
Recommendation of knowledge base management system
After the Lunar New Year and a half
P1339 [USACO09OCT]Heat Wave G
2022 Guangdong Provincial Safety Officer a certificate third batch (main person in charge) simulated examination and Guangdong Provincial Safety Officer a certificate third batch (main person in charg
Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
How to understand the gain bandwidth product operational amplifier gain
Gossip about redis source code 74
The first game of the new year, many bug awards submitted
Kubedl hostnetwork: accelerating the efficiency of distributed training communication
C # basic knowledge (2)
[PHP basics] session basic knowledge, application case code and attack and defense
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
IO flow principle and classification