随机森林准确率和分类器关系
发布日期:2021-07-01 02:13:16
浏览次数:2
分类:技术文章
本文共 809 字,大约阅读时间需要 2 分钟。
#!/usr/bin/python# -*- coding:utf-8 -*-import operatorimport numpy as npimport matplotlib.pyplot as pltimport matplotlib as mplfrom functools import reducefrom scipy.special import combprint('comb(10, 2) = ', comb(100, 30))def c(n, k): return reduce(operator.mul, list(range(n-k+1, n+1))) / reduce(operator.mul, list(range(1, k+1)))def bagging(n, p): s = 0 for i in range(n // 2 + 1, n + 1): s += comb(n, i) * p ** i * (1 - p) ** (n - i) return sif __name__ == "__main__": n = 100 x = np.arange(1, n, 2) y = np.empty_like(x, dtype=np.float) for i, t in enumerate(x): y[i] = bagging(t, 0.6) if t % 10 == 9: print(t, '个分类器的正确率:', y[i]) mpl.rcParams['font.sans-serif'] = 'simHei' mpl.rcParams['axes.unicode_minus'] = False plt.figure(facecolor='w'
转载地址:https://maoli.blog.csdn.net/article/details/89457493 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
网站不错 人气很旺了 加油
[***.192.178.218]2024年04月12日 00时51分12秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
跟踪sys_execve的执行过程
2019-05-01
分析schedule()的执行过程
2019-05-01
Linux内核学习收获
2019-05-01
optirun执行错误的解决办法
2019-05-01
pycharm无法识别pyqt的问题
2019-05-01
STLPort 哈希表 hash_map/hash_multimap 删除速度慢
2019-05-01
deepin系统没有声音的解决方法
2019-05-01
python学习笔记
2019-05-01
Ant内置任务之replace
2019-05-01
Ant内置任务之tstamp
2019-05-01
Ant内置任务之whichresource
2019-05-01
Ant内置任务之touch
2019-05-01
Ant内置任务之truncate
2019-05-01
Ant内置任务之sync
2019-05-01
Ant内置任务之symlink
2019-05-01
Ant内置任务之sound
2019-05-01
Ant内置任务之typedef
2019-05-01
jface databinding:部分实现POJO对象的监测
2019-05-01