当前位置:网站首页>AI operation ch8
AI operation ch8
2022-06-12 06:20:00 【JamSlade】
1
• [ Decision tree ] Based on information gain , Build a decision tree for the following data sets , Describe the process
The data needed for a decision-making classification of glasses , Data set containing 4 attribute :
age
astigmatism
trear-prod-rate For input features ,
contact-lenses Is a decision attribute .

The first feature
We can consider the following formula
G ( D , a ) = H ( D ) − ∑ v = 1 V ∣ D v ∣ D H ( D v ) G(D,a)=H(D)-\sum^V_{v=1}\frac{|D^v|}{D}H(D^v) G(D,a)=H(D)−v=1∑VD∣Dv∣H(Dv)
H ( D ) H(D) H(D) It has been decided when the data is confirmed , So we only need to consider the second half ∑ v = 1 V ∣ D v ∣ D \sum^V_{v=1}\frac{|D^v|}{D} ∑v=1VD∣Dv∣
Consider three eigenvalues first
- For age
| The eigenvalue | soft | hard | none | sum |
|---|---|---|---|---|
| young | 1 | 1 | 1 | 3 |
| pre-prebyopic | 1 | 1 | 3 | 5 |
| prebyopic | 0 | 1 | 3 | 4 |
It is not difficult to get through the formula
a g e = − [ 3 12 ( 1 3 l o g 2 1 3 + 1 3 l o g 2 1 3 + 1 3 l o g 2 1 3 ) + 5 12 ( 1 5 l o g 2 1 5 + 1 5 l o g 2 1 5 + 3 5 l o g 2 3 5 ) + 4 12 ( 1 4 l o g 2 1 4 + 3 4 l o g 2 3 4 ) ] = 1.238 \begin{aligned}age = &-[\frac{3}{12}(\frac{1}{3}log_2\frac{1}{3}+\frac{1}{3}log_2\frac{1}{3}+\frac{1}{3}log_2\frac{1}{3})\\ &+\frac{5}{12}(\frac{1}{5}log_2\frac{1}{5}+\frac{1}{5}log_2\frac{1}{5}+\frac{3}{5}log_2\frac{3}{5})\\&+\frac{4}{12}(\frac{1}{4}log_2\frac{1}{4}+\frac{3}{4}log_2\frac{3}{4})] = 1.238\end{aligned} age=−[123(31log231+31log231+31log231)+125(51log251+51log251+53log253)+124(41log241+43log243)]=1.238
- For astigmatism
| The eigenvalue | soft | hard | none | sum |
|---|---|---|---|---|
| yes | 0 | 3 | 4 | 7 |
| no | 1 | 1 | 3 | 5 |
Generation into the formula
a s t i g m a t i s m = 0.979 astigmatism = 0.979 astigmatism=0.979
- Tear production rate
| The eigenvalue | soft | hard | none | sum |
|---|---|---|---|---|
| reduced | 0 | 0 | 4 | 4 |
| normal | 2 | 3 | 3 | 8 |
Generation into the formula
t e a r _ p r o d u c t i o n _ r a t e = 1.041 tear\_production\_rate = 1.041 tear_production_rate=1.041
So we First take astigmatism You can maximize the function
Second feature
Then consider the remaining features
First be based on Yes situation Input characteristics under
| The eigenvalue | soft | hard | none | sum |
|---|---|---|---|---|
| young | 0 | 1 | 1 | 2 |
| pre-prebyopic | 0 | 1 | 2 | 3 |
| prebyopic | 0 | 1 | 1 | 2 |
| reduced | 0 | 0 | 2 | 2 |
| normal | 0 | 3 | 2 | 5 |
a g e = − [ 2 7 ( 1 2 l o g 2 1 2 + 1 2 l o g 2 1 2 ) + 3 7 ( 1 3 l o g 2 1 3 + 1 3 l o g 2 1 3 + 1 3 l o g 2 1 3 ) + 2 7 ( 1 2 l o g 2 1 2 + 1 2 l o g 2 1 2 ) ] = 0.965 \begin{aligned}age= &-[\frac{2}{7}(\frac{1}{2}log_2\frac{1}{2}+\frac{1}{2}log_2\frac{1}{2}) \\ & +\frac{3}{7}(\frac{1}{3}log_2\frac{1}{3}+\frac{1}{3}log_2\frac{1}{3}+\frac{1}{3}log_2\frac{1}{3})\\ &+\frac{2}{7}(\frac{1}{2}log_2\frac{1}{2}+\frac{1}{2}log_2\frac{1}{2})] = 0.965\end{aligned} age=−[72(21log221+21log221)+73(31log231+31log231+31log231)+72(21log221+21log221)]=0.965
t e a r _ p r o d u c t i o n _ r a t e = 0.694 tear\_production\_rate = 0.694 tear_production_rate=0.694
** take yes When to choose tear
**
be based on No The situation of
| The eigenvalue | soft | hard | none | sum |
|---|---|---|---|---|
| young | 1 | 0 | 0 | 1 |
| pre-prebyopic | 1 | 0 | 1 | 2 |
| prebyopic | 0 | 0 | 2 | 2 |
| reduced | 0 | 0 | 2 | 2 |
| normal | 2 | 0 | 1 | 3 |
a g e = 0.4 age = 0.4 age=0.4
t e a r = 0.551 tear=0.551 tear=0.551
take no You should choose age
The following decision tree can be obtained 
2.
[ Linear classification ] The following is derived logit function and logistic function Equivalent :
p ( X ) = e β 0 + β 1 X 1 + e β 0 + β 1 X p ( X ) 1 − p ( X ) = e β 0 + β 1 X p(X)=\frac{e^{\beta_0+\beta_1X}}{1+e^{\beta_0+\beta_1X}}\quad \frac{p(X)}{1-p(X)}=e^{\beta_0+\beta_1X} p(X)=1+eβ0+β1Xeβ0+β1X1−p(X)p(X)=eβ0+β1X
Exchange element , Make f ( X ) = p ( X ) 1 − p ( X ) , f ( X ) 1 − f ( X ) = p ( X ) f(X)=\frac{p(X)}{1-p(X)}, \frac{f(X)}{1-f(X)}=p(X) f(X)=1−p(X)p(X),1−f(X)f(X)=p(X)
p ( X ) 1 − p ( X ) = f ( X ) = e β 0 + β 1 X 1 + e β 0 + β 1 X 1 − e β 0 + β 1 X 1 + e β 0 + β 1 X = e β 0 + β 1 X 1 + e β 0 + β 1 X − ( e β 0 + β 1 X ) = e β 0 + β 1 X = f ( X ) 1 − f ( X ) = p ( X ) \left.\begin{aligned} \frac{p(X)}{1-p(X)}=f(X)& =\frac{\frac{e^{\beta_0+\beta_1X}}{1+e^{\beta_0+\beta_1X}}} {1- \frac{e^{\beta_0+\beta_1X}}{1+e^{\beta_0+\beta_1X}}}\\ \\ & =\frac{e^{\beta_0+\beta_1X}}{1+e^{\beta_0+\beta_1X} -(e^{\beta_0+\beta_1X}) }\\ &=e^{\beta_0+\beta_1X}\\ &=\frac{f(X)}{1-f(X)} = p(X) \end{aligned}\right. 1−p(X)p(X)=f(X)=1−1+eβ0+β1Xeβ0+β1X1+eβ0+β1Xeβ0+β1X=1+eβ0+β1X−(eβ0+β1X)eβ0+β1X=eβ0+β1X=1−f(X)f(X)=p(X)
To sum up, it is equivalent
边栏推荐
- Sqlite Cross - compile Dynamic Library
- 单通道图片的读入
- Leetcode-1705. Maximum number of apples to eat
- sqlite交叉編譯動態庫
- Using hidden Markov model to mark part of speech
- Computer composition and design work05 ——fifth verson
- Remap function of C different interval mapping
- CONDA create use virtual environment
- Houdini & UE4 programmed generation of mountains and multi vegetation scattering points
- Jetson TX2 machine brushing jetpack4.2 (self test successful version)
猜你喜欢

dlib 人脸检测

Findasync and include LINQ statements - findasync and include LINQ statements

哈工大信息内容安全实验

Simple spiral ladder generation for Houdini program modeling

LeetCode个人题解(剑指offer3-5)3.数组中重复的数字,4.二维数组中的查找,5.替换空格

Redis队列

为什么数据库不使用二叉树、红黑树、B树、Hash表? 而是使用了B+树

Guns framework multi data source configuration without modifying the configuration file

勤于奋寻找联盟程序方法介绍

Opencv_100问_第五章 (21-25)
随机推荐
为什么数据库不使用二叉树、红黑树、B树、Hash表? 而是使用了B+树
Leetcode-1535. Find the winner of the array game
基于报错的 SQL 注入
Understand Houdini's (heightfield) remap operation
Video fire detection based on Gaussian mixture model and multi-color
Nodemon cannot load the file c:\users\administrator\appdata\roaming\npm\nodemon PS1, because script execution is prohibited in this system
PDF. JS help file
Unity3d multi platform method for reading text files in streamingasset directory
CONDA create use virtual environment
前台展示LED数字(计算器上数字类型)
Houdini terrain creation
RNN model
【思维方法】之第一性原理
. Net core and Net framework comparison
About why GPU early-z reduces overdraw
468. verifying the IP address
Leetcode sword finger offer II 033 Modified phrase
sqlite交叉编译动态库
Leetcode-717. 1-bit and 2-bit characters (O (1) solution)
EBook editing and deleting