Orange学习-2 第一个简单的案列

目录

1. 使用Model下的Tree

2. 操作步骤

2.1 新建File,导入数据集

2.2 查看数据

2.3 进入到Tree模型 

 2.4 进入到Tree Viewer

2.5 进行Test and Score

 2.6 保存一下文件



使用决策树(Tree)模型对鸢尾花数据进行预测

1. 使用Model下的Tree

使用的数据集:鸢尾花数据集(这是很经典的机器学习的数据集 sklearn中的)是classification问题

Tree 模型,也就是常说的决策树模型,可处理离散型数据与连续型数据,可用于classification和Regression

英文介绍:

Tree is a simple algorithm that splits the data into nodes by class purity (information gain for categorical and MSE for numeric target variable). It is a precursor to Random Forest. Tree in Orange is designed in-house and can handle both categorical and numeric datasets.

2. 操作步骤

2.1 新建File,导入数据集

 双击进入File,显示如下图所示:

 鸢尾花数据集是Orange所带的,可以直接load,如果是自己的数据,可以直接选择自己的文件即可

从上图可看出,Feature有四个,分别为sepal length\sepal width\petal length\petal witdth,它们的类型为numeric(数值型)target为iris,value分别为Iris-virginica\vesicolor\setosa

点击Apply,进入下一步

2.2 查看数据

双击Data Table,即可进入到如下图所示的界面,整个数据集如下:

2.3 进入到Tree模型 

双击进入到Tree模型

 Tree parameters 介绍:

  1. Induce binary tree:build a binary tree  建立一个二叉树
  2. Min. number of instances in leaves: if checked, the algorithm will never construct a split which would put less than the specified number of training examples into any of the branches.                                    一个叶节点要存在所需要的最小样本量。一个节点在分支后的每一个子节点中,必须包含至少   Min. number of instances in leaves  个训练样本,否则分支就不会发生。这个参数可能会使得模型更平滑,尤其是在Regression中
  3. Do not split subsets smaller than: forbids the algorithm to split the nodes with less than the given number of instances            是一个中间节点要分支所需要的最小的样本量,如果一个节点包含的样本量小于Do not split subsets smaller than 中所填写的数字,这个节点分支就不会发生,也就是说,这个节点一定会成为一个叶子节点
  4. Limit the maximal tree depth: limits the depth of the classification tree to the specified number of node levels.      树的最大深度,这个参数越大,树的分支就会越多,计算量就会越大,会出现过拟合的现象,这个参数与Do not split subsets smaller than共同作用,先满足哪个限制条件,都会停止继续分支
  5. Stop when majority reaches [%]: stop splitting the nodes after a specified majority threshold is reached

 2.4 进入到Tree Viewer

添加Tree Viewer到流程中,如下图所示:

 如图左上角所示:

9 nodes, 5leaves:  说明分了九个节点,5个叶子(个人理解,如图中所示,蓝色的没有继续往下进行分支的为叶子,leaves是nodes的一种),可以调试Tree中的不同参数,看一下不同参数对这个Tree的影响

Zoom\width是调节显示的,可以自行调节看一下区别

Tree viewer可以接DataTable和Scatter Plot模块

 在Tree Viewer后面是Selected data --->data 

以Scatter Plot为例,双击之后显示如下图所示:

 没有显示什么信息

这时,双击Selected data --->data,如下图所示,

 拖拽中间线的起点终点即可改成下图:

 此时,再双击Scatter Plot,显示如下图所示:

 更改左侧的参数,调节不同显示效果

2.5 进行Test and Score

那么模型建好了,如何来看模型的效果呢?

这个时候,我们选用Test and Score 模块,我是基于之前的步骤,继续进行,添加Test and Score模块,如下图所示

 双击Testa and Score,重要参数有cross validation 就是交叉验证,具体参数,这里不做详细介绍

number of folds   是指验证的次数

 重要的结果参数:

  • Area under ROC is the area under the receiver-operating curve.
  • Classification accuracy is the proportion of correctly classified examples.
  • F-1 is a weighted harmonic mean of precision and recall (see below).
  • Precision is the proportion of true positives among instances classified as positive, e.g. the proportion of Iris virginica correctly identified as Iris virginica.
  • Recall is the proportion of true positives among all positive instances in the data, e.g. the number of sick among all diagnosed as sick.
  • Specificity is the proportion of true negatives among all negative instances, e.g. the number of non-sick among all diagnosed as non-sick.
  • LogLoss or cross-entropy loss takes into account the uncertainty of your prediction based on how much it varies from the actual label.

目前我也只了解CA (Classification accuracy)这个数,越大越精准,后续随着学习,会对这方面做一个更明晰的解释。可看出,该模型预测准确度在95.3%

在Test and Score之后,可添加Condfusion Matrix,看可视化的再现模拟的结果

 双击Confusion Matrix,如下图所示,Actual代表实际的真实的,Predicted代表模型预测的

Iris-setosa实际有50个,模型预测50个

Iris-versicolor实际50个,模型预测结果是51个,其中包括47个Iris-versicolor和4个错误的Iris-virginica

Iris-virginica实际50个,模型预测结果是49个,其中包括46个Iris-virginica和3个错误的Iris-versicolor

 2.6 保存一下文件

3 结语

今日份学习到此结束

  • 3
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
编译 Linux 内核需要以下步骤: 1. 获取 Linux 内核源代码。你可以从官方网站或 GitHub 上下载最新的内核源代码。 2. 安装交叉编译工具链。如果你的开发环境是 x86 架构的,你需要安装交叉编译工具链来编译适用于 ARM 架构的内核。你可以使用 apt-get 命令或其他包管理器来安装工具链。例如,在 Ubuntu 或 Debian 上,你可以使用以下命令来安装: ``` sudo apt-get install gcc-arm-linux-gnueabihf ``` 3. 配置内核。进入内核源代码目录,使用以下命令来配置内核: ``` make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- orangepi_zero2_defconfig ``` 这将使用默认配置文件来配置内核。 4. 编译内核。使用以下命令来编译内核: ``` make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage dtbs modules ``` 这将编译内核镜像、设备树和内核模块。 5. 安装内核。将编译好的内核镜像和设备树文件复制到 SD 卡的 boot 分区中。例如,在 Ubuntu 或 Debian 上,你可以使用以下命令来安装: ``` sudo cp arch/arm/boot/zImage /media/boot/ sudo cp arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero2.dtb /media/boot/ ``` 6. 配置引导加载程序。编辑 SD 卡的 boot 分区中的 boot.cmd 文件,并添加以下内容: ``` setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 fatload mmc 0:1 ${kernel_addr_r} zImage fatload mmc 0:1 ${fdt_addr_r} sun8i-h2-plus-orangepi-zero2.dtb bootz ${kernel_addr_r} - ${fdt_addr_r} ``` 这将配置引导加载程序以加载内核镜像和设备树,并指定内核参数。 7. 生成引导加载程序镜像。使用以下命令来生成引导加载程序镜像: ``` mkimage -C none -A arm -T script -d boot.cmd boot.scr ``` 这将生成一个名为 boot.scr 的文件,它是引导加载程序镜像。 8. 将引导加载程序镜像复制到 SD 卡的 boot 分区中: ``` sudo cp boot.scr /media/boot/ ``` 9. 将 SD 卡插入 Orange Pi Zero 2 开发板,并启动板子。如果一切正常,你应该看到内核启动信息在串口终端中输出。 注意:这只是一个简单的指南,实际的操作可能会因环境和设备而有所不同。请确保你熟悉 Linux 内核编译和 Orange Pi Zero 2 开发板的使用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

每天都要丰富自己

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值