Skip to Content
金融人工智能:用Python实现AI量化交易
book

金融人工智能:用Python实现AI量化交易

by Yves Hilpisch
August 2022
Intermediate to advanced
394 pages
12h 32m
Chinese
Posts & Telecom Press
Content preview from 金融人工智能:用Python实现AI量化交易
机器学习
137
训练轮数
损失
5-5MSE 值与训练轮数的关系
5.4
 容量
模型或算法的
容量
定义了模型或算法基本上可以学习什么类型的函数或关系。对于仅基于
单项式的
OLS
回归,
只有一个参数定义了模型的容量:要使用的最高阶单项式的次数。如
果将该阶数参数设置为
deg=3
,则
OLS
回归模型可以学习常数型、线性型、二次型或三次
型的函数关系。参数
deg
越大,
OLS
回归模型的容量越大。
下面的
Python
代码从
deg=1
开始,以
2
为增量增大阶数,
MSE
值随着阶数参数的增大而
单调递减。图
5-6
显示了所有考虑阶数的回归线。
In [29]: reg = {}
for d in range(1, 12, 2):
reg[d] = np.polyfit(f, l, deg=d)
p = np.polyval(reg[d], f)
mse = MSE(l, p)
print(f'{d:2d} | MSE={mse}')
1 | MSE=0.005322474034260403
3 | MSE=0.004353110724143185
5 | MSE=0.0034166422957371025
7 | MSE=0.0027389501772354025
9 | MSE=0.001411961626330845
11 | MSE=0.0012651237868752322
In [30]: plt.figure(figsize=(10, 6))
plt.plot(f, l, 'ro', label='sample ...
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

Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu
解密金融数据

解密金融数据

Justin Pauley
Python3.0科学计算指南

Python3.0科学计算指南

Posts & Telecom Press, Claus Führer, Jan Erik Solem, Olivier Verdier
scikit-learn机器学习(第2版)

scikit-learn机器学习(第2版)

Posts & Telecom Press, Gavin Hackeling

Publisher Resources

ISBN: 9787115594556