Skip to Content
Python算法交易
book

Python算法交易

by Yves Hilpisch
November 2022
Intermediate to advanced
392 pages
10h 8m
Chinese
China Electric Power Press Ltd.
Content preview from Python算法交易
通过机器学习预测市场动向
|
161
打印出截距值。
根据拟合的模型预测所需的值。
将参数
fit_intercept
设置为
False
可获得与
NumPy
和
polyfit()
完全相同的回归结果:
In [72]: lm = linear_model.LinearRegression(fit_intercept=False)
In [73]: lm.fit(m[:lags].T, m[lags])
Out[73]: LinearRegression(fit_intercept=False)
In [74]: lm.coef_
Out[74]: array([-0.66666667, 0.33333333, 1.33333333])
In [75]: lm.intercept_
Out[75]: 0.0
In [76]: lm.predict(m[:lags].T)
Out[76]: array([ 3., 4., 5., 6., 7., 8., 9., 10., 11.])
强制没有截距值进行拟合。
这个例子已经很好地说明了如何将
scikit-learn
应用于预测问题。由于其一致的
API
设计,基本方法也可以应用于其他模型。
5.2.2
一个简单的分类问题
在分类问题中,必须确定新观察结果属于一组有限的分类(“类别”)中的哪一个。
机器学习中研究的一个经典问题是从
0
~
9
的手写数字的识别。这种识别可能得出
正确的结果,例如
3
。或者错误的结果,例如
6
或
8
,其中所有这些错误的结果都是
同等错误的。在金融市场环境中 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
图解大模型 : 生成式AI 原理与实战

图解大模型 : 生成式AI 原理与实战

Jay Alammar, Maarten Grootendorst

Publisher Resources

ISBN: 9787519869694