机器学习股票预测

Like most of you, I have a strong interest in making more money and growing my savings faster. And as I’ve started my career over the last 2 years, I’ve been seeking advice on how to best manage the money I’ve earned.

像你们中的大多数人一样,我对赚更多的钱和更快地增加储蓄存有浓厚的兴趣。 在过去两年中开始我的职业生涯时,我一直在寻求有关如何最好地管理所赚钱的建议。

To date, my personal finance strategy has been relatively conservative — invest the bulk of my savings in an S&P 500 ETF and let my them grow with the market. My friend Emmanuel who now works in asset management told me that this method — the Vanguard method — held the best blend of risk and reward, and he gave me a book called “The Boglehead’s Guide to Investing”, written by Vanguard’s founder John C. Bogle. This book explained that putting your money in a total stock market ETF was best because trying to beat the market is time-consuming and nearly impossible — even the best hedge funds could only beat the market for a year or two before ultimately providing similar, or worse, returns.

到目前为止,我的个人理财策略一直相对保守-将我的大部分积蓄投资于S&P 500 ETF,并让它们随着市场增长。 我现在在资产管理部门工作的朋友伊曼纽尔(Emmanuel)告诉我,这种方法-先锋方法-最佳地结合了风险和回报,他给了我一本名为《伯格尔黑德的投资指南》的书,该书由先锋公司的创始人约翰C撰写。博格尔这本书解释说,最好将您的资金投入整个股票市场的ETF,因为试图击败市场是耗时的,几乎是不可能的-即使最好的对冲基金也只能在最终提供类似或之前的一两年内击败市场。更糟糕的是,回报。

Yet still, there have been a few examples of people successfully beating the market time and time again to make extraordinary wealth. The most famous example is Warren Buffet, who has used a process of evaluating companies based on their fundamentals — financial metrics like net income and ratios like Earnings per Share — to make investments that have helped him become one of the wealthiest people on the planet. In fact, a whole school of investing exists based on picking stocks based on their financial fundamentals, aptly named “fundamental investing.”

然而,仍然有一些人成功地一次又一次地击败市场以赚取非凡的财富。 最著名的例子是沃伦·巴菲特(Warren Buffet),他使用了一种基于公司基本面的公司评估流程-诸如净收入之类的财务指标以及诸如每股收益之类的比率-进行投资,帮助他成为地球上最富有的人之一。 实际上,整个投资流派都是根据其财务基础挑选股票而建立的,恰当地称为“基础投资”。

Fundamental investing is based on the idea that you can find stocks undervalued by the market based on their fundamentals. You look at how the market rates a stock compared to how fundamentalists evaluate that stock according to a specific valuation metric. The logic goes that if you can find and buy undervalued stocks, then you can make money when stocks reach their market potential.

基本投资基于这样的想法,即您可以根据基本面发现被市场低估的股票。 您要看一下市场对股票的定价与原教旨主义者根据特定估值指标对股票的评估相比。 逻辑是,如果您可以找到并购买被低估的股票,那么当股票达到市场潜力时就可以赚钱。

To test out whether fundamental investing principles really worked and see which specific fundamental metrics would factor most in predicting stock prices, I decided to build a model to try and evaluate fundamental investing.

为了测试基本投资原则是否真的有效,并查看哪些特定的基本指标是预测股票价格的主要因素,我决定建立一个模型来尝试和评估基本投资。

Note: The next few sections concern the data analysis and modeling process. Feel free to skip to the takeaways below.

注意:接下来的几节涉及数据分析和建模过程。 随意跳到下面的外卖店。

Data

数据

I scraped financial data and valuation metrics from every single company in the Russell3000. The 2 time periods I chose to scrape from were the stock price, several financial metrics, and several valuation metrics from January 2018. I then scraped the stock price of January 2020 in order to calculate the lift over 2 years. Data was scraped from Morningstar and Yahoo Finance.

我从Russell3000中的每个公司中抓取了财务数据和评估指标。 我选择抓取的2个时间段是股价,一些财务指标和2018年1月以来的一些估值指标。然后,我抓取了2020年1月的股价,以计算2年的提升。 数据来自Morningstar和Yahoo Finance。

Thus, I had my independent variables — the financial and valuation metrics — and the dependent predictor variable — the percent a stock increased between Jan 2018 and Jan 2020.

因此,我有了自己的自变量-财务和估值指标-以及因变量。从2018年1月到2020年1月,股票的增长百分比。

Feature Engineering

特征工程

After I collected the data, I engineered several ratios based on this article: “15 Financial Ratios that Every Investor Should Use” by investinganswers.com. Some of these ratios were:

收集数据后,我根据本文设计了几个比率: investingsanswers.com“每个投资者应使用的15个财务比率” 。 其中一些比率是:

  1. Price to Earnings Ratio — The stock price / earnings per share. Gives an idea of how the stock is valued compared to how much that company is actually making.市盈率-股票价格/每股收益。 给出与公司实际生产的股票相比,股票的估值方式。
  2. Price to Book Ratio — Price per share / book value per share. Compares how the market values a stock versus how the actual shareholders value it.市净率—每股价格/每股账面价值。 比较市场对股票的估价与实际股东对股票的估价。
  3. Return on Assets — Net income / average total assets. Measures of how well the company uses its assets to make money.资产回报率-净收入/平均总资产。 公司使用其资产赚钱的程度的度量。
  4. Return on Equity — Net income / average stockholders equity. Measures how much money the company generates for each dollar given to shareholders. If a company generates more money for its shareholders relative to other companies, the stock will be more valuable to the market.股本回报率-净收入/平均股东权益。 衡量公司为给股东的每一美元产生多少钱。 如果一个公司为股东带来的收益要比其他公司多,那么股票对市场的价值就会更高。

Modeling

造型

After removing multicollinearity, I tried several different regression models to look at my data. Among these, I used regular linear regression, ridge, and lasso, using GridSearchCV to optimize parameters.

消除多重共线性后,我尝试了几种不同的回归模型来查看我的数据。 其中,我使用规则的线性回归,岭和套索,并使用GridSearchCV优化参数。

However, the model performances on these regression types were very low, producing an R² of .01 and less. (R² measures how well your features capture the variance in your target). This suggested that either the pattern was likely non-linear, or that the data simply had little relationship with the target variable, or both.

但是,这些回归类型的模型性能非常低,R²为0.01和更低。 (R²衡量您的特征捕获目标差异的程度)。 这表明该模式可能是非线性的,或者数据与目标变量几乎没有关系,或者两者都有。

As a last ditch effort to get more out of my data, I created polynomial features out of all my existing ones and applied a Random Forest Regression model, which in a simplified sense uses “if, else” patterns to make predictions on the data. With this model I was able to improve the R² to .04 — a 400% increase although still quite poor.

为了从数据中获取更多信息,我付出了最后的努力,我从所有现有特征中创建了多项式特征,并应用了随机森林回归模型,该模型在简化意义上使用“ if,else”模式对数据进行预测。 使用此模型,我可以将R²提高到.04,尽管仍然很差,但提高了400%。

Results

结果

As stated above, the R² for these models was very poor, showing that the data had explained very little of the variance no matter what type of model and pattern I tried to use. In addition, I was able to reduce another performance indicator, RMSE, from 42% to 39%. But even so, the results still meant that on average, my predictions were 39% off. If a stock price went up by 50%, my model could predict that it only went up 11%.

如上所述,这些模型的R²非常差,表明无论我尝试使用哪种类型的模型和模式,数据都很少解释差异。 此外,我能够将另一个性能指标RMSE从42%降低到39%。 但是即使如此,结果仍然意味着我的预测平均下降了39%。 如果股价上涨了50%,我的模型可以预测它只会上涨11%。

In terms of silver linings, upon analyzing the feature importances of random forest model we see that all of the top 5 features contain 1 of 2 ratios: the Price to Book Ratio, and the Return on Assets.

就一线希望而言,通过分析随机森林模型的特征重要性,我们发现所有前5个特征均包含以下2个比率之一:市净率和资产收益率。

Takeaways

外卖

  1. It is very difficult to produce a machine learning model that can accurately and precisely predict stock performance from just fundamental ratios. Likely, many more factors contribute to stock price that are just as if not more important, which is why in my best model stock fundamental ratios only explained 4% of the variance in the target. Such contributing factors could be how well a stock has been performing as of late (technical analysis) or how well a stock’s industry has been moving as a whole.很难产生一种仅基于基本比率就可以准确,准确地预测库存表现的机器学习模型。 可能还有更多因素似乎对股票价格产生了更大的影响,这就是为什么在我的最佳模型中,股票基本比率仅解释了目标方差的4%。 此类影响因素可能是股票最近的表现(技术分析)或股票行业整体的发展状况。
  2. This is not to say that fundamental analysis cannot lead to results — it just means that doing so might be enormously challenging. There’s a reason why most hedge funds don’t outperform the stock market each year.这并不是说基础分析不能得出结果,而只是意味着这样做可能具有极大的挑战性。 为什么大多数对冲基金每年都不能跑赢股票市场是有原因的。
  3. In cases where fundamental investing does work, perhaps we’re looking for cases where outliers exist in key variables such as the 2 identified above — Price to Book ratio and ROA. With regards to Price to Book, if a stock has an abnormally low ratio, then the market values the stock much lower than its book value. Here, it seems possible that the stock price will increase so that the market aligns more reasonably with the book value. With regards to ROA, a stock with an abnormally high ratio may suggest that this particular company may be doing something special that allows them to get the most out of their resources, suggesting better future performance. However, this is just my guess, and I would need to do further analysis to see if there’s any relationship between outliers and stock performance.在基本投资确实有效的情况下,也许我们正在寻找关键变量存在离群值的情况,例如上面确定的2个变量—市净率和ROA。 关于账面价格,如果股票的比率异常低,则市场对该股票的估值远低于其账面价值。 在这里,股票价格可能会上涨,从而使市场更合理地与账面价值保持一致。 关于ROA,具有异常高比率的股票可能表明这家特定公司可能正在做一些特殊的事情,使他们可以从资源中获得最大收益,从而暗示了更好的未来表现。 但是,这只是我的猜测,我需要做进一步分析,以查看离群值与股票表现之间是否存在任何关系。

翻译自: https://medium.com/swlh/does-fundamental-investing-work-attempting-to-predict-stock-success-with-machine-learning-c3dcc139c6c

机器学习股票预测


http://www.taodudu.cc/news/show-4692848.html

相关文章:

  • 美国证监会给区块链股票降温
  • 交易基础知识
  • 记录一次使用线性回归和多项式回归为房价定价
  • LSTM预测股价的APP
  • 神经网络时间序列分析,神经网络模型可解释性
  • 神经网络模型的模型假设,人工神经网络预测模型
  • 如何给公司估价
  • 股票估价
  • 【学习笔记】关于苹果Safari浏览器不支持sessionStorage的问题
  • Fiddler与iPhone配合拦截首都图书馆微信小程序请求并多线程模拟请求刷预约 Java HttpGet HttpPost
  • IOS开发之判断iPhone连接的网络(WiFi,2G,3G,LTE,4G)是IPV4还是IPV6网络
  • 苹果ipv6审核解决方案
  • [iOS]Charles工具
  • iOS开发 检测网络是否真正可用(真正可以访问互联网)
  • charles 抓包小程序(电脑window,手机是iPhone ios 10.3)
  • 针对苹果最新审核要求为应用兼容IPv6
  • 微信小程序,安卓可以调接口,苹果调不了的解决方案
  • 利用wireShark抓取iphone手机上的网络通信包
  • iphone配置邮箱客户端——以whut邮箱为例(whut.edu.cn)
  • Charles最新破解版苹果iphone安卓android手机抓包分析教程笔记
  • 苹果手机iphone丢失被诈骗经历,警醒更多的人
  • 面向小白,无脑安装OrCAD
  • 大脑如何表征时间和情绪之间的关系?
  • 自制DIY 机器狗 完全教程 - MIT猎豹Cheetah
  • 训练小米叫,让狗狗叫还真的不容易!
  • 狗狗得了脑炎怎么办
  • 脑机接口关键技术
  • 人脸识别属于特异大脑功能
  • Arduino休眠模式和看门狗以及中断详解
  • 一道烧脑题

机器学习股票预测_是否进行基础投资工作,以尝试通过机器学习预测股票成功...相关推荐

  1. 唐宇迪机器学习课程数据集_最受欢迎的数据科学和机器学习课程-2020年8月

    唐宇迪机器学习课程数据集 There are a lot of great online resources and websites on data science and machine lear ...

  2. python蜡烛图预测_【Python量化投资】系列之SVR预测第二天开盘趋势和股价的正负统计分析(附代码)...

    原标题:[Python量化投资]系列之SVR预测第二天开盘趋势和股价的正负统计分析(附代码) 本期导读 ⊙ML.SVM介绍 ⊙股价的正负统计分析 ⊙预测第二天开盘趋势 机器学习方法是计算机科学的一个分 ...

  3. 统计学习基础:数据挖掘、推理和预测_百度零基础深度学习笔记(三) 波士顿房价预测...

    波士顿房价预测 波士顿房价预测是一个经典的机器学习任务,期待构建一个房价预测模型,其数据中包含13个影响房价的因素和该类型房屋均价. 波士顿房价影响因素 数据预处理 数据预处理包括: 数据导入 数据形 ...

  4. 机器学习实战 基于_基于ScikitLearn、Keras和TensorFlow的机器学习实战:分类

    本文讲解Aurélien Géron所著的<Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow>的第一部分 ...

  5. 2019机器学习代码实现_如何用3行代码实现任何机器学习项目

    2019机器学习代码实现 Wouldn't it be great to be able to solve complex machine learning problems quickly and ...

  6. pytorch神经网络因素预测_实战:使用PyTorch构建神经网络进行房价预测

    微信公号:ilulaoshi / 个人网站:lulaoshi.info 本文将学习一下如何使用PyTorch创建一个前馈神经网络(或者叫做多层感知机,Multiple-Layer Perceptron ...

  7. python 图像走势预测_在keras中对单一输入图像进行预测并返回预测结果操作

    模型经过训练测试之后,我们往往用一两张图对模型预测结果进行分析讨论,那么下面介绍在keras中用已训练的模型经过测试的方法. 下面是以利用预训练的ResNet来展示预测的效果,选了一张狗的图片,是来自 ...

  8. python爬虫股票市盈率_量化交易的第一步,Python爬取股票数据

    基本环境配置python 3.6 pycharm requests csv time 相关模块pip安装即可 目标网页 分析网页 一切的一切都在图里 找到数据了,直接请求网页,解析数据,保存数据 请求 ...

  9. keras时间序列数据预测_使用Keras的时间序列数据中的异常检测

    keras时间序列数据预测 Anomaly Detection in time series data provides e-commerce companies, finances the insi ...

最新文章

  1. php jquery教程下载,jquery怎么下载和引用
  2. Javascript之链式运动框架1
  3. linux热插拔原理,.NET Core 的热插拔机制的深入探索
  4. python多个for的执行顺序-python_装饰器篇(多个装饰器下的执行顺序)
  5. Angular中怎样通过localStorage实现数据持久化-实现存储搜索历史为例
  6. Asp.Net验证控件和表达式测试题
  7. 值得收藏!数据分析最常用的18个概念,终于有人讲明白了
  8. 网络规划设计师考试总结
  9. 灵活控制 Hibernate 的日志或 SQL 输出,以便于诊断
  10. 对于计算机专业的调查报告,计算机专业调查报告.doc
  11. 每周荐书:云原生、Docker、Web算法(评论送书)
  12. JTabel 中监听某个单元格的值确实改变了
  13. SQL Server 数据库之生成与执行 SQL 脚本
  14. 【matlab】人工智能的仿生优化算法之萤火虫算法讲解(Firefly Algorithm)
  15. obj文件格式详解及示例
  16. OBJ 模型文件与MTL材质文件 介绍
  17. MySql: 事务特性ACID、三大并发读、四种事务隔离级别
  18. CNN网络实现垃圾分类
  19. python 爬取图片、没有后缀名_python爬虫,图片是无格式的
  20. css翻转箭头,巧用css3轻松实现箭头上下旋转

热门文章

  1. Oracle大数据量读取:LOB variable no longer valid after subsequent fetch
  2. 网页端Skype更新 在桌面/移动平台添加对Safari的支持
  3. 使用海康摄像头实现实时监控
  4. Web前端成都培训机构
  5. postgresql学习配置主从同步和自动备份
  6. 那些学计算机的女生后来都怎么样了?
  7. python电子表格_Python操作 Excel表格
  8. 无人驾驶面临的伦理问题
  9. Lesson12_多态
  10. 听肖邦Chopin: Waltz No.19 in A minor, Op.Posth的美好