Answered step by step
Verified Expert Solution
Question
1 Approved Answer
B Naive Bayesian classifier The Naive Bayesian Classifier algorithm is a classification algorithm based on calculating the probability of belonging to each class. That is
B Naive Bayesian classifier The Naive Bayesian Classifier algorithm is a classification algorithm based on calculating the probability of belonging to each class. That is to say that the test data to be classified will be assigned to the most likely class. The probability of belonging to each class is calculated from the W learning data as follows: classx argmax IPP Here P is the a priori probability of belonging to the class k in other words its the probability of obtaining a data of class k if we draw a data at random. P is the probability that a data x has the value x for the variable i if we know its class w Here we will calculate this probability by calculating the distance between the data x and each barycenter of the classes i e the class average divided by the sum distances between this data and each barycenter. List of useful functions: mean, sum: calculate the mean and the sum of a list of values. unique: returns the list of list values, without repeating values. asarray: transforms a list into a vector. vector.prod: makes the product of the values of a vector. naive bayes.GaussianNB: the naive Bayesian Classifier from sklearn. Create a CBN X Y function that takes x data and labels as input Y and which returns a label, for each data, predicted from class la more likely according to equation Here again, we take each data, one by one, as test data and we consider all data as training data. It is advisable to first calculate the barycentres and the a priori probabilities P for each class, then calculate the conditional probabilities P for each class and each variable.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started