Question

Exercise 3 Based on the KDE function: Compute the probablity density at [e,e], i.e., f((0, 0)). This should return a scalar v

I'm being asked to compute the probablity density at (0,0) using the above KDE function. i finished the previous related part. Not entirely sure of the syntax needed to enter the equation using NumPy.

Code for previous related part for reference:

i We turn our attention to another question, what is the probability distribution of data? A powerful method is kernel densit

Exercise 3 Based on the KDE function: Compute the probablity density at [e,e], i.e., f((0, 0)). This should return a scalar value. (2 points) : def compute (data, h): ##CODE HERE## return x
i We turn our attention to another question, what is the probability distribution of data? A powerful method is kernel density estimation (KDE). The probability density function is given by where K(z) = exp(-1 r) is a kernel function and 2 i the squared euclidean norm). Hint: You can use z numpy.linal g. norm Exercise 2 Implement K(Z) based on the above kernel function. Return a numpy array with shape (500,) (2 points) def kernel(z): # z: (N, 2) numpy . array # returns (N. 1) numpy.array kzeet[] for i in range (e,len(z)): dat-z[i] norm-np.linalg.norm(dat, ord-2) kzee.append ( (1/(np.sqrt (2"math.pi)))*np.exp ( -(norm* *2/2))) return np.array(k_zee)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please let me know if you require any further assistance.

The symbol Σ (f(x)) over a range simply means that you need to sum f(x) for a certain range (1 to N in this case). Therefore Σ doesn't require any special function and thus can be done using a simple 'for' loop. Although it can be made more complicated by doing it using lambda functions etc.

Here is how you will code it simply without any specialized functions.

In your case suppose you want to store the result of the above summation in a variable 'Sum' then -:

                    Sum=0

                    for i in range(1,N+1):                                                       # n+1 since range(x,y) y is not inclusive

                        Sum= Sum+(1/N)(K)((x-xi)/h)                                       # Remember to put accurate values of the various       # variables(K , x , xi and h) by calling their respective functions/values

Add a comment
Know the answer?
Add Answer to:
I'm being asked to compute the probablity density at (0,0) using the above KDE function. i finish...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT