当前位置:网站首页>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
边栏推荐
- Highlight detection with pairwise deep ranking for first person video summary (thesis translation)
- Unity can realize the rotation, translation and scaling script of the camera around the target point on the mobile terminal device
- Chartextcnn (Ag dataset - news topic classification)
- Summary of some problems in sensor bring up
- 分段贝塞尔曲线
- Une explication du 80e match bihebdomadaire de leetcode
- Information content security experiment of Harbin Institute of Technology
- Redis data structure (VIII) -- Geo
- R语言大作业(四):上海市、东京 1997-2018 年GDP值分析
- (UE4 4.27) add globalshder to the plug-in
猜你喜欢

Introduction to the method of diligently searching for the alliance procedure

(UE4 4.27) customize globalshader

About why GPU early-z reduces overdraw

Pytorch implementation of regression model

What states do threads have?
![[reinstall system] 01 system startup USB flash disk production](/img/0d/9b3d4b8e286a75f8b58e35d02f261b.jpg)
[reinstall system] 01 system startup USB flash disk production

UE4 4.27 modify the mobile forward pipeline to support cluster multi light source culling

Project and build Publishing

Bert use

Nodemon cannot load the file c:\users\administrator\appdata\roaming\npm\nodemon PS1, because script execution is prohibited in this system
随机推荐
夜神模拟器adb查看log
English grammar_ Adverb_ With or without ly, the meaning is different
Automatic modeling of Interchange
Chartextcnn (Ag dataset - news topic classification)
MLP sensor
Opencv_100问_第五章 (21-25)
English语法_副词_有无ly,意义不同
n次贝塞尔曲线
Unity3d multi platform method for reading text files in streamingasset directory
Solution to the problem of the 80th fortnight competition of leetcode
Word vector training based on nnlm
The unity3d script searches for colliders with overlaps within the specified radius
Leetcode sword finger offer II 119 Longest continuous sequence
LeetCode-剑指Offer(第二版)个人题解完整版
Redis queue
姿态估计之2D人体姿态估计 - PifPaf:Composite Fields for Human Pose Estimation
Logistic regression model
Why doesn't the database use binary tree, red black tree, B tree and hash table? Instead, a b+ tree is used
为什么联合索引是最左匹配原则?
Simple spiral ladder generation for Houdini program modeling