1. 程式人生 > >problem about degree of freedom

problem about degree of freedom

Dear Professor Ricco RAKOTOMALALA:

the Reference is:
<An Empirical Comparison of Selection Measures for Decision-Tree Induction>

The following datasets from above reference
try to find what feature is relevant to Cancer Recurrence.

Datasets(totally 10 items):

Radiation menopause Class
No <60 Recur
No ≥60 Recur
No <60 Recur
No NOT Recur
Yes ≥60 Not Recur
Yes <60 Not Recur
Yes ≥60 Not Recur
No NOT Not Recur
No <60 Not Recur
No <60 Recur

for datasets as follows:
在這裡插入圖片描述
we have Chi-square Test formula:
χ2=i=1rj=1s(NijEij)2Eij=i=1rj=1s(NijNiNjn)2NiNjn \chi^2=\sum_{i=1}^r \sum_{j=1}^{s} \frac{(N_{ij}-E_{ij})^2}{E_{ij}}=\sum_{i=1}^r\sum_{j=1}^s \frac{(N_{ij}-\frac{N_{i·}N_{·j}}{n})^2 }{\frac{N_{i·}N_{·j}}{n}}

where Eij=NiNjNE_{ij}=\frac{N_{i·}N_{·j}}{N}
-------------------All the following computation are identical with the above article(skip please)-----------

For Radiation:

Radiation\Class Recur Not Recur Total
Yes 0 3 3
No 5 2 7
Total 5 5 10

χ2=(N11E11)2E11+(N12E12)2E12+(N22E22)2E22+(N21E21)2E21\chi^2= \frac{(N_{11}-E_{11})^2}{E_{11}}+ \frac{(N_{12}-E_{12})^2}{E_{12}}+ \frac{(N_{22}-E_{22})^2}{E_{22}}+ \frac{(N_{21}-E_{21})^2}{E_{21}}
where
N11=0N_{11}=0
N12=3N_{12}=3
N21=5N_{21}=5
N22=2N_{22}=2

E11=N1N1N=3510=1.5E_{11}=\frac{N_{1·}N_{·1}}{N}=\frac{3·5}{10}=1.5
E12=N1N2N=3510=1.5E_{12}=\frac{N_{1·}N_{·2}}{N}=\frac{3·5}{10}=1.5
E21=N2N1N=7510=3.5E_{21}=\frac{N_{2·}N_{·1}}{N}=\frac{7·5}{10}=3.5
E22=N2N2N=7510=3.5E_{22}=\frac{N_{2·}N_{·2}}{N}=\frac{7·5}{10}=3.5

χ2=(N11E11)2E11+(N12E12)2E12+(N22E22)2E22+(N21E21)2E21=(01.5)21.5+(31.5)21.5+(53.5)23.5+(23.5)23.5=4.285713\chi^2= \frac{(N_{11}-E_{11})^2}{E_{11}}+ \frac{(N_{12}-E_{12})^2}{E_{12}}+ \frac{(N_{22}-E_{22})^2}{E_{22}}+ \frac{(N_{21}-E_{21})^2}{E_{21}} \\=\frac{(0-1.5)^2}{1.5}+\frac{(3-1.5)^2}{1.5}+\frac{(5-3.5)^2}{3.5}+\frac{(2-3.5)^2}{3.5}=4.285713

相關推薦

problem about degree of freedom

Dear Professor Ricco RAKOTOMALALA: the Reference is: <An Empirical Comparison of Selection Measures for Decision-Tree Induction&

[LeetCode&Python] Problem 697. Degree of an Array

Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its

A Simple Problem About Truth Table

函數定義 進制轉換 blog binary expr cas 初始化 表達 n) 源代碼: #include<iostream> #include<string> #include<cmath> using namespace std

[LeetCode] Degree of an Array

重復 his out pub this lock put second 可能 Given a non-empty array of non-negative integers nums, the degree of this array is defined as the

[LeetCode] Degree of an Array 數組的度

same have this oss ret ear test nat cau Given a non-empty array of non-negative integers nums, the degree of this array is defined

leetcode-697-Degree of an Array

暴力 example 元素 fine lan 代碼 empty because 分享 題目描述: Given a non-empty array of non-negative integers nums, the degree of this array is defin

LeetCode # Array # Easy # 697 Degree of an Array

pre array sub 次數 etc gre leet miss iss 題意:給定一個數組,數組的度是其中出現最多次數的元素。求,最小連續子數組的度和原數組一致。 思路:(參考最佳答案) 遍歷數組,找到數組最大值,然後根據最大值設置三個長度為max+1的數組lef

Degree of an Array

nds nta ive div lan not gre lse public Given a non-empty array of non-negative integers nums, the degree of this array is defined as the

[LeetCode&Python] Problem 806. Number of Lines To Write String

abcde rst leetcode letter leet The nbsp abcd let We are to write the letters of a given string S, from left to right into lines. Each lin

Leetcode697.Degree of an Array陣列的度

給定一個非空且只包含非負數的整數陣列 nums, 陣列的度的定義是指數組裡任一元素出現頻數的最大值。 你的任務是找到與 nums 擁有相同大小的度的最短連續子陣列,返回其長度。 示例 1: 輸入: [1, 2, 2, 3, 1] 輸出: 2 解釋: 輸入

[LeetCode&Python] Problem 637. Average of Levels in Binary Tree

Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 /

Problem About Oracle Database ! I am Headache!

前提:在Oracle 儲存過程中. 遇到問題:在使用到 insert into  select 語句的時候,我驚然的發現這個語句有以下不可原諒的Bug特徵: 1、不可以巢狀子查詢; 2、查詢欄位 不可以用邏輯判斷函式包裝,諸如 decode函式; MMP,老子對Oralce

[LeetCode&Python] Problem 830. Positions of Large Groups

In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "a

[LeetCode&Python] Problem 543. Diameter of Binary Tree

Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest&nbs

[LeetCode&Python] Problem 350. Intersection of Two Arrays II

Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Inpu

[GeeksForGeeks] Bin Packing Problem (Minimize number of used Bins)

Given n items of different weights and bins each of capacity c, assign each item to a bin such that n

Problem B. Harvest of Apples 組合數求和(莫隊沒怎麼看懂)

Problem B. Harvest of Apples Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submiss

LeetCode 697. Degree of an Array

一、問題描述     Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of a

LeetCode#697: Degree of an Array

Description Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of

DAY 30 Why half a degree of global warming is a big deal

今日導讀 聯合國政府間氣候變化專門委員會(IPCC)在近期發出一份關於全球變暖的報告,報告指出如果氣候變暖以目前的速度持續下去,預計全球氣溫可能在 2030 至 2052 年間氣候比工業時代前變暖 1.5 攝氏度,這引起了學術界的高度緊張。1.5 度聽上去是個