随机森林准确率和分类器关系
发布日期: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秒