Implement radial basis network function with gaussian kernel

Assignment Help Python Programming
Reference no: EM133302077

Part 1:

Assignment 1

Consider the data set D = {(xn, tn)}Nn=1, where the ordered pairs are formed by feature vectors xn ∈ Rd and labels tn ∈ {-1, +1}. By Bayes Theorem we have that the posterior probability P(t|x) for the class t is given by:

P(t|x) = P(x|t)P(t)/P(x| - 1)P(-1) + P(x| + 1)P(+1)

where the priors P(t) satisfy that P(-1) + P(+1) = 1. If we model the distri- bution of features inside class t by a Gaussian distribution with mean µt and covariance matrix Σt,demonstrate that:

1. The function σ : Rd → {-1, 0, 1} defined as:

σ(x) = sgn(log P(x| + 1) - log P(x| - 1) + log P(+1)/1-P(+1) where sgn(x) = 1 if x > 0, -1 if x < 0, and 0 otherwise, is a discriminant function.

2. The boundary of classification is a determined by a quadratic form.

covariance matrix, i.e. Σ+1 = Σ-1 = Σ then the boundary of classification. If the dispersion of points inside each class can be described by the same tion is given by the linear equation

0 = wTx + w0,

where

w = Σ-1+1 - µ-1)

w0 = -1/2 [µT+1Σ-1µ+1

- µT-1Σ-1µ-1] + log P(+1)/1-P(+1).

Hint: The multivariate Gaussian centered at µt with covariance Σt is given by the expression:

P(x|t) = 1/(2Π)d/2√det(Σ) exp {-1/2(x-ut)TΣ-1(x - µt)}

Assignment 2

Four temperature censors were tted in the four corners of a room. Each of them take a temperature reading every 30 minutes. There is a door in the front of the room, that we suspect was opened at some point during the measurement. Your task is to determine, by using PCA and K -means, whether the door was open or not. The measurements were stored in the le 'room-temperature.csv'. Each line of the le is composed by ve entries, a time-stamp and readings from four sensors: front-left reading, front-right reading, back-left reading, and back-right reading.

1. Load the le 'room-temperature.csv' and plot the readings against time (do not use the time-stamp, use the order index as time variable).

2. Proceed to the PCA analysis keeping the components responsible for 93% of the variance. Plot these two components against time.

3. Plot the readings of the back-left sensor against the fron-left sensor and the readings of the back-right sensor against the front-right sensor. Discuss your observations.

4. Perform a K-means test for k = 2, 3, 4, 5 and, by using a suitable criterion, decide which k better represents the data.

5. Did somebody open the door during the measurement? Why?

Assignment 3

Question 1. Show that for the polynomial kernel function K : R2 × R2 → R defined as

K(x, y) = (xTy + 1)2

can be expressed as

K(x, y) = φ(x)Tφ(y),

where φ : R2 → R6 is defined by:

φ(x) = 1946_kernel function.jpg

Question 2. Consider the le 'support.csv'. In each of its 3000 rows you may nd the coordinates of a point in R2 and its classi cation (+1 or -1). Plot the points on a scatter graph and decide whether the problem is linearly separable or not.

Question 3. By using the kernel function described in item 1, nd the vector wY by training a Support Vector Machine that reproduces the correct classification.

Hint: You may use packages like SciKit-Learn to perform this last task.

Part 2: Multilayer Networks and EBP

(a) Given the dataset in the le 'cloud.dat', formed by 1000 two-dimensional vectors rT = (x, y), construct and train a neural network that models the probability density (y x). Report your results in form of graphs of the parameters of your models vs the variable x.

Hint: Consider a mixture model of the form:

P(y|x) = α1(x)N (y|µ1(x), σ12 (x)) + α2(x)N (y|µ2(x), σ22 (x)),

where 0 < αi < 1 and α1 + α2 = 1 for all x.

(b) Use the maximum likelihood principle to nd the values of the parameters r0 and σ2 in the following model:

P(r) = 1/2Π.1/√2Πσ2 exp{-1/2 (r - r0)22 ,

where r = x2 + (y-1)2.

Optimization:

Consider the functional entropy defined as

S[p] ≡ - ∫dxp(x) log p(x)

where p(x) is a well defined probability density for x∈R+U{0}. Suppose that all the knowledge we have about p(x) is summarized in the following properties:
1 = ∫ dxp(x)
µ = ∫ dxp(x)x

where µ∈R is known. By using the de nition of the functional derivative of a functional F (introduced in lecture 7):

δF[p]/δp(x0) ≡ d/dλ.F[p(x) + λδ(x - x0)]λ=0

where p is a suitable probability density, λ ∈ R is a real number and δ(x - x0) is the Dirac's delta function centered at x0, demonstrate that the probability density that minimizes the functional entropy (1) subject to the constraints (2) and (3) is an exponential distribution:

P(x|µ) = 1/µ.e-x/µ.

3. Radial Basis Functions and Regularization

x

y

0

0.4556

0.1

0.8110

0.2

0.9515

0.3

0.8871

0.4

0.8281

0.5

0.4509

0.6

0.2219

0.7

0.1530

0.8

0.1501

0.9

0.2019

1.0

0.5981

Table 1: Data set for problem 3 b).

(a) Consider general Gaussian basis function of the form:

φj(x) =1/2Π √det(Σ) exp {-1/2 (x - µj)TΣ-1(x - µj)}

Σ = 1154_kernel function1.jpg

Show that the mapping represented by such a network is equivalent to a that of a function:

2460_kernel function2.jpg

 

(b) Implement the radial basis network function with Gaussian kernels (with variance σ2 = 0.1)) that interpolates the data set presented in Table 1.

Reference no: EM133302077

Questions Cloud

Demonstrates careful reading and inquiry into the subject : Demonstrates careful reading & inquiry into the subject. Shows original, relevant and critical ideas rather than merely repetitive and obvious ideas
Critically review the role of defect metric : Critically review the role of defect metric in evaluating the quality of the proposed software given in the scenario
Why in this case should you be moral : Why, in this case, should you be moral?Will you do what is good, fair, and right, or the contrary? What are your reasons for your choice?
How dunn condenses background knowledge for a audience : Identify the passages in which you learn something new. Explain, if you can, how Dunn condenses background knowledge for a general audience.
Implement radial basis network function with gaussian kernel : Perform a K-means test for k = 2, 3, 4, 5 and, by using a suitable criterion, decide which k better represents the data and Plot the readings of the back-left
What was your childhood memory of playing outdoors : What was your childhood memory of playing outdoors?How did you feel when playing outdoors? Why do you think you felt that way when you were playing outdoors?
Who are the authors of the article : Who are the authors of the article? In what journal was the article published?When was the article published?What is the prevalence of bullying?
Make an outline for essay and inlcude a thesis statement : an outline for my essay. So my topic is how Dumpster Diving is a recycled happiness.One man's treasure is another man's gold, the only difference is perspective
Example of voluntary transnational migration : Which of the following is the best example of voluntary transnational migration?

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd