4个版本 (2个破坏性更新)
0.3.1 | 2023年9月11日 |
---|---|
0.3.0 | 2019年1月8日 |
0.2.0 | 2018年5月12日 |
0.1.0 | 2018年1月12日 |
#162 在 机器学习 中
1,313 每月下载量
用于 7 个crate(3个直接使用)
20KB
342 行
fastapprox
Rust版本的Paul Mineiro的库。
机器学习中出现的一些函数的快速近似版本。
例如,在Vowpal Wabbit中,这是实现其惊人的训练速度的许多巧妙技巧之一。
模块名称 fast
和 faster
来自原始工作,代表具有不同速度-精度级别的相同算法集合。
虽然近似函数可能会给你一些加速(但不一定是!),应该提供一些警告
- 运行自己的基准测试
- 确保数学是算法中的瓶颈
- 注意收敛性
- SIMD版本尚未实现(直到
simd
crate从孵化器毕业)
基准测试
在MacBook Pro(2013年晚期),2.6 GHz Intel Core i7上运行cargo bench
给出以下输出
test cos_fast ... bench: 3,674 ns/iter (+/- 778)
test cos_faster ... bench: 1,559 ns/iter (+/- 206)
test cos_std ... bench: 7,329 ns/iter (+/- 104)
test cosfull_fast ... bench: 6,880 ns/iter (+/- 1,021)
test cosfull_faster ... bench: 4,238 ns/iter (+/- 183)
test cosh_fast ... bench: 8,270 ns/iter (+/- 4,190)
test cosh_faster ... bench: 2,451 ns/iter (+/- 175)
test cosh_std ... bench: 4,407 ns/iter (+/- 798)
test digamma_fast ... bench: 4,644 ns/iter (+/- 1,126)
test digamma_faster ... bench: 3,770 ns/iter (+/- 417)
test digamma_special ... bench: 16,260 ns/iter (+/- 1,374)
test digamma_statrs ... bench: 14,401 ns/iter (+/- 3,198)
test erf_fast ... bench: 54,401 ns/iter (+/- 20,448)
test erf_faster ... bench: 2,359 ns/iter (+/- 426)
test erf_inv_fast ... bench: 5,958 ns/iter (+/- 2,794)
test erf_inv_faster ... bench: 2,113 ns/iter (+/- 153)
test erf_inv_statrs ... bench: 769 ns/iter (+/- 83)
test erf_special ... bench: 4,948 ns/iter (+/- 1,443)
test erf_statrs ... bench: 6,287 ns/iter (+/- 246)
test erfc_fast ... bench: 54,201 ns/iter (+/- 6,307)
test erfc_faster ... bench: 2,052 ns/iter (+/- 112)
test erfc_special ... bench: 4,887 ns/iter (+/- 362)
test exp_fast ... bench: 3,774 ns/iter (+/- 235)
test exp_faster ... bench: 1,400 ns/iter (+/- 260)
test exp_std ... bench: 2,760 ns/iter (+/- 202)
test lambertw_fast ... bench: 21,040 ns/iter (+/- 2,523)
test lambertw_faster ... bench: 24,840 ns/iter (+/- 8,939)
test lambertwexpx_fast ... bench: 13,240 ns/iter (+/- 858)
test lambertwexpx_faster ... bench: 8,857 ns/iter (+/- 1,439)
test ln_fast ... bench: 2,087 ns/iter (+/- 528)
test ln_faster ... bench: 1,214 ns/iter (+/- 447)
test ln_gamma_fast ... bench: 6,193 ns/iter (+/- 901)
test ln_gamma_faster ... bench: 2,952 ns/iter (+/- 211)
test ln_gamma_special ... bench: 36,726 ns/iter (+/- 846)
test ln_gamma_statrs ... bench: 56,295 ns/iter (+/- 973)
test ln_std ... bench: 5,175 ns/iter (+/- 321)
test log2_fast ... bench: 1,998 ns/iter (+/- 335)
test log2_faster ... bench: 1,206 ns/iter (+/- 188)
test log2_std ... bench: 5,087 ns/iter (+/- 1,736)
test pow2_fast ... bench: 3,472 ns/iter (+/- 192)
test pow2_faster ... bench: 1,069 ns/iter (+/- 356)
test pow2_std ... bench: 2,942 ns/iter (+/- 172)
test pow_fast ... bench: 6,769 ns/iter (+/- 1,460)
test pow_faster ... bench: 2,365 ns/iter (+/- 293)
test pow_std ... bench: 13,147 ns/iter (+/- 1,000)
test sigmoid_fast ... bench: 4,818 ns/iter (+/- 428)
test sigmoid_faster ... bench: 1,869 ns/iter (+/- 56)
test sigmoid_std ... bench: 3,312 ns/iter (+/- 131)
test sin_fast ... bench: 3,038 ns/iter (+/- 685)
test sin_faster ... bench: 1,875 ns/iter (+/- 481)
test sin_std ... bench: 7,215 ns/iter (+/- 39)
test sinfull_fast ... bench: 6,483 ns/iter (+/- 405)
test sinfull_faster ... bench: 3,973 ns/iter (+/- 874)
test sinh_fast ... bench: 8,394 ns/iter (+/- 618)
test sinh_faster ... bench: 2,588 ns/iter (+/- 286)
test sinh_std ... bench: 4,434 ns/iter (+/- 329)
test tan_fast ... bench: 5,165 ns/iter (+/- 174)
test tan_faster ... bench: 3,423 ns/iter (+/- 1,083)
test tan_std ... bench: 7,695 ns/iter (+/- 453)
test tanfull_fast ... bench: 10,299 ns/iter (+/- 1,761)
test tanfull_faster ... bench: 6,214 ns/iter (+/- 524)
test tanh_fast ... bench: 5,598 ns/iter (+/- 709)
test tanh_faster ... bench: 1,921 ns/iter (+/- 445)
test tanh_std ... bench: 4,056 ns/iter (+/- 306)