当前位置:网站首页>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 .
边栏推荐
- Briefly understand the operation mode of developing NFT platform
- ISBN number
- What are the securities companies with the lowest Commission for stock account opening? Would you recommend it? Is it safe to open an account on your mobile phone
- Advanced C language - pointer 2 - knowledge points sorting
- Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
- Fluent learning (5) GridView
- 2022 chemical automation control instrument examination content and chemical automation control instrument simulation examination
- Amway by head has this project management tool to improve productivity in a straight line
- AI Challenger 2018 text mining competition related solutions and code summary
- Double efficiency. Six easy-to-use pychar plug-ins are recommended
猜你喜欢
![[about text classification trick] things you don't know](/img/c0/fdb04f6b31f1dba2658c2430dc4036.jpg)
[about text classification trick] things you don't know

Alibaba cloud container service differentiation SLO hybrid technology practice

Design of logic level conversion in high speed circuit

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

How to write a good title of 10w+?

2022 examination of safety production management personnel of hazardous chemical production units and examination skills of safety production management personnel of hazardous chemical production unit

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

Fluent learning (4) listview

BBS forum recommendation

How to solve the "safe startup function prevents the operating system from starting" prompt when installing windows10 on parallel desktop?
随机推荐
ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
D28:maximum sum (maximum sum, translation)
Tencent interview: can you find the number of 1 in binary?
Pytorch learning notes 5: model creation
What are the application fields of digital twins in industry?
MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
Briefly understand the operation mode of developing NFT platform
Advanced C language - pointer 2 - knowledge points sorting
股票开户佣金最低的券商有哪些大家推荐一下,手机上开户安全吗
How to make recv have a little temper?
2/14 (regular expression, sed streaming editor)
Gossip about redis source code 83
Ramble 72 of redis source code
SPI based on firmware library
Enter MySQL in docker container by command under Linux
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
[BSP video tutorial] stm32h7 video tutorial phase 5: MDK topic, system introduction to MDK debugging, AC5, AC6 compilers, RTE development environment and the role of various configuration items (2022-
Report on prospects and future investment recommendations of China's assisted reproductive industry, 2022-2028 Edition
Joint examination of six provinces 2017
股票开户最低佣金炒股开户免费,网上开户安全吗