Advertisement

核心算法 - 鸢尾花数据集分类问题 - 随机森林方法

阅读量:

代码

复制代码
    # 鸢尾花数据分类-随机森林
    # 结果为6个随机森林得到的结果
    
    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt
    import matplotlib as mpl
    from sklearn.ensemble import RandomForestClassifier
    
    
    # def iris_type(s):
    #     it = {'Iris-setosa': 0, 'Iris-versicolor': 1, 'Iris-virginica': 2}
    #     return it[s]
    
    # 'sepal length', 'sepal width', 'petal length', 'petal width'
    iris_feature = u'花萼长度', u'花萼宽度', u'花瓣长度', u'花瓣宽度'
    
    if __name__ == "__main__":
    
    mpl.rcParams['font.sans-serif'] = [u'SimHei']  # 黑体 FangSong/KaiTi

全部评论 (0)

还没有任何评论哟~