Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Write a function called labelBayes that takes in posting times for multiple birds as well as the learned parameters for the likelihoods and prior,

4. Write a function called labelBayes that takes in posting times for multiple birds as well as the learned parameters for the likelihoods and prior, and return the most probable class for each bird. Specifically, the function will be called as:

labelsOut = labelBayes(birdFeats,params,priors)

where birdFeats is a numpy array of shape (K,2) containing the 2 features for K birds, params is a numpy array with shape (M,2) matching the description of the output for 'learnParams' and priors is a numpy array with shape (M) matching the description of the output for 'learnPriors' ;

labelsOut is a numpy array with shape (K) containing the most probable label for each bird, where labelsOut[j] corresponds to birdFeats[j] .

Labels are computed using the Exponential Bayes classifier!

labelBayes(np.array([[0.5,5],[0.5,2],[2,8]]), np.array([[0.7,0.2],[0.4,0.1]]), np.array([0.4,0.6]))

would return np.array([0,0,1])

{ Note 1: function called 'learnPriors' that takes in a data set and returns the prior probability of each class. Specifically, the function will be called as:

priors=learnPriors(Data)

where Data is a numpy array with shape (N,3) where N is the number of data points and priors is a numpy array with shape (M) where there are M classes, priors[i] is the estimated prior probability for class i .

Note 2:

function called 'learnParams' that takes in a data set and returns the learned lambda parameter mean and standard deviation for each class for the two features. Specifically, the function will be called as:

params =learnParams(Data) where Data is a numpy array with shape (N,3) where N is the number of data points and params is a both paramsSpeed and paramsChirpDelay are numpy array with shape (M,2) where there are M classes, params[i,0] is the lambda for the speed for class i and params[i,1] is the lambda for the chirp delay of class i.}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago