5BE2597F-F3D1-4E90-ADF3-FECE9F1A4E53

pdf

School

New Jersey Institute Of Technology *

*We aren’t endorsed by this school

Course

634

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

5

Uploaded by DeaconLightning13472

Report
Homework 3 Name:Tarun Tarikere Venkatesha UCID:tt383 1)Rule-Based-Classifier Consider a training set that contains 70 positive examples and 200 negative examples. For each of the following candidate rules, 𝑅 1: ? → +( ??𝑣??? 9 ???𝑖?𝑖𝑣? 𝑎?? 0 ??𝑔𝑎?𝑖𝑣?? ) 𝑅 2: ? → +( ??𝑣??? 65 ???𝑖?𝑖𝑣? 𝑎?? 40 ??𝑔𝑎?𝑖𝑣?? ) determine the best and the worst candidate rule according to the rule accuracy, and coverage. Accuracy Rule Accuracy = (no. of correctly identified inst by rule/Total inst identified by the rule)* 100 For R1, R = 9/(9+0) * 100 = 100% For R2, R = 65/(65+40) * 100 =(65/105)*100 =(13/21)*100 =1300/21 = 61.9 =61.9% In accuracy R1>R2 Coverage = (Total inst covered by the rule/Total inst in data) For R1, Coverage = 9/270 * 100 =10/3 = 3.33% For R2, Coverage = (65+40)/(70+200) * 100 = 28.5% R2 has more coverage as compared to R1
According to accuracy rule,R1 is the best candidate whereas R2 is the worst candidate According to coverage:R2 is the best candidate whereas R1 is the worst candidate 2) a) Estimate the conditional probability for P(A = 1|+); P(B = 1|+); P(C =1|+); P(A = 1|-); P(B = 1|-) and P(C = 1|-). Given Probabilities a) Conditional Probabilities: For the '+' class: P(A=1|+)= 5/7 = 0.714 P(B=1|+)= 4/7 = 0.571 P(C=1|+)= 1/7 = 0.081 P(A=1|-)= 1/3 = 0.333 P(B=1|-)= 1/3 = 0.333 P(C=1|-)= 3/3 = 1
b) Predict the class label for the test sample (A = 0, B = 1, C = 1) P(A = 0, B = 1, C = 1) = K P(+|A=0,B=1,C=1) P(A=0,B=1,C=1+)*P(+)/K (2/7)x(4/7)x(1/7)x(7/10)/K = 0.0163/K P(-A=0,B=1,C=1) P(A=0,B=1,C=1|-)*P(-)/K P(-|A=0)xP(-|B-1)xP(-C=1)xP(-)/K =(2/3)x(1/3)x(3/3)x(3/10)/K =1/15k =0.066/K Correct prediction (A=0,B=1,C=1) would be negative(-ve), since the probability for the negative class is higher using the provided conditional probabilities. c) What is the time complexity for training Naive Bayes classifier? =O(n x m) n-instances, m-features The training time complexity of the Naive Bayes classifier, indicated by the notation O(n * m), exhibits a linear growth pattern in relation to the number of instances (n) and features (m) involved. This classifier meticulously examines the attributes of each instance in order to calculate probabilities. d) What is the testing time complexity of Naive Bayes classifier? = O(k x m) k-classes,m-features Naive Bayes classifier boasts a testing time complexity that is both linear and impressively efficient, denoted as O(k * m). Just like the training phase, it takes into account the number of classes (k) and features (m), and calculates probabilities for each class by analyzing the features of the test instance. This approach meticulously evaluates every feature against each class in order to estimate the probability of classification, all within a linear timeframe.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3) . P(mil=Hi)=20/40 =0.5 P(air cond=working)=25/40= 0.625 P(Engine=good|mil=Hi)=10/20 =0.5 P(engine=good|mil=lo)=15/20 =0.75 P(val=High|eng=good, air cond=working)=12/16 =0.75 P(val=high|eng=good,air cond=broken)=6/9 =0.667 P(val=high|eng=Bad,air cond=working)=2/9 =0.22 P(val=high|engine=bad,air cond=broken)=0/6 =0 Probability for given condition: P(engine=Bad,Air cond=broken)
= P(Engine=Bad,Air condition=Broken,Milage= ) αβ α, 𝑉𝑎𝑙𝑢𝑒 = β = P( |Engine=Bad,Air condition=Broken) x P(Engine=Bad|Milage= ) x ( αβ 𝑉𝑎𝑙𝑢𝑒 = β α P(Milage= )P(Air condition=Broken) ) α =[ P(val=high|engine=bad,air cond=broken) ]+[ P(val=low|engine=bad,air cond=broken)] [P(Value = Hi | Engine = Bad, Air Conditioner = Broken)*((P(Engine = Bad Mileage = Hi) *P(Mileage = Hi) *P(Air Conditioner = Broken)) + (P(Engine = Bad| Mileage = Low) * P(Mileage=Hi)* P(Air Conditioner = Broken)))] + [P(Value = Low | Engine = Bad, Air Conditioner = Broken)+((Engine = Bad| Mileage = Hi) *(Mileage = Hi)* (Air Conditioner = Broken)) + ((Engine = Bad | Mileage = Low) * (Mileage = Hi)* (Air Conditioner = Broken)))] =0/6*((10/20)(20/40)*(15/40)+(5/20)*(20/40) (15/40)) 0(0.09375+0.046875)+1 (0.09375 +0.046875) =0.1406