LFD Book Forum  

Go Back   LFD Book Forum > Book Feedback - Learning From Data > Chapter 3 - The Linear Model

Reply
 
Thread Tools Display Modes
  #1  
Old 10-12-2012, 10:36 AM
erezarnon erezarnon is offline
Junior Member
 
Join Date: Oct 2012
Posts: 3
Default Problem 3.3 Typo

In part e, I believe it should ask us to repeat parts b and c
Reply With Quote
  #2  
Old 10-12-2012, 02:32 PM
magdon's Avatar
magdon magdon is offline
RPI
 
Join Date: Aug 2009
Location: Troy, NY, USA.
Posts: 595
Default Re: Problem 3.3 Typo

Yes, thank you.

Quote:
Originally Posted by erezarnon View Post
In part e, I believe it should ask us to repeat parts b and c
__________________
Have faith in probability
Reply With Quote
  #3  
Old 10-13-2012, 02:15 AM
rpistu rpistu is offline
Member
 
Join Date: Oct 2012
Posts: 10
Default Re: Problem 3.3 Typo

For part e, when plotting the data and the final hypothesis learnt from a 3rd order polynomial feature transform, the shape of the nonlinear hypothesis is almost like a line. Is that true? Actually, I didn't find an effective way to plot the nonlinear hypothesis.
Reply With Quote
  #4  
Old 10-13-2012, 06:12 AM
magdon's Avatar
magdon magdon is offline
RPI
 
Join Date: Aug 2009
Location: Troy, NY, USA.
Posts: 595
Default Re: Problem 3.3 Typo

A simple way to plot a nonlinear classification hypothesis, which is actually the way used for all the figures in the book, is the brute force approach. Construct a grid of points, for example:

x1={0,0.01,0.02,...,1}
x2={0,0.01,0.02,...,1}

So every pair (x1,x2) from each set is a point in 2 dimensions. Now, for every such pair, evaluate the hypothesis h(x1,x2) and plot a red point if h=-1 and a blue point if h=+1. Note h can be any hypothesis, 3rd order polynomial, etc.

It is slow but it works.

Quote:
Originally Posted by rpistu View Post
For part e, when plotting the data and the final hypothesis learnt from a 3rd order polynomial feature transform, the shape of the nonlinear hypothesis is almost like a line. Is that true? Actually, I didn't find an effective way to plot the nonlinear hypothesis.
__________________
Have faith in probability
Reply With Quote
  #5  
Old 10-13-2012, 10:19 AM
rpistu rpistu is offline
Member
 
Join Date: Oct 2012
Posts: 10
Default Re: Problem 3.3 Typo

Thanks. It seems like what you said is to plot the data that classified based on the hypothesis. However, the problem requires us to plot the original data and the final hypothesis. For linear classification, the hypothesis is a line, so it's easy to plot. But for nonliear classification, for example the 3rd order polynomial feature transform here, I think it really hard to find the corresponding x2 if given x1 for h(x1, x2): x->ᶲ3. I cannot imagine by using the brute force approach.

Quote:
Originally Posted by magdon View Post
A simple way to plot a nonlinear classification hypothesis, which is actually the way used for all the figures in the book, is the brute force approach. Construct a grid of points, for example:

x1={0,0.01,0.02,...,1}
x2={0,0.01,0.02,...,1}

So every pair (x1,x2) from each set is a point in 2 dimensions. Now, for every such pair, evaluate the hypothesis h(x1,x2) and plot a red point if h=-1 and a blue point if h=+1. Note h can be any hypothesis, 3rd order polynomial, etc.

It is slow but it works.
Reply With Quote
  #6  
Old 10-13-2012, 07:50 PM
magdon's Avatar
magdon magdon is offline
RPI
 
Join Date: Aug 2009
Location: Troy, NY, USA.
Posts: 595
Default Re: Problem 3.3 Typo

The hypothesis is not a line. The hypothesis is a region on the 2-dimensional space that is +1 and the complement of that region is -1. The boundary that separates the +1 from the -1 region is a line for linear classification. For nonlinear classification the boundary is something else. In either case you can identify the boundary by identifying the regions which are +1 and the regions which are -1.

For nonlinear boundary, there may be more than one x2 for a given x1 or even no x2 for a given x1. This is why the brute force approach is the simplest for identifying the boundary.

Quote:
Originally Posted by rpistu View Post
Thanks. It seems like what you said is to plot the data that classified based on the hypothesis. However, the problem requires us to plot the original data and the final hypothesis. For linear classification, the hypothesis is a line, so it's easy to plot. But for nonliear classification, for example the 3rd order polynomial feature transform here, I think it really hard to find the corresponding x2 if given x1 for h(x1, x2): x->ᶲ3. I cannot imagine by using the brute force approach.
__________________
Have faith in probability
Reply With Quote
  #7  
Old 10-14-2012, 06:44 PM
rpistu rpistu is offline
Member
 
Join Date: Oct 2012
Posts: 10
Default Re: Problem 3.3 Typo

I used the brute force method as you said, however, it still seems like the two regions are separated by a line (maybe a little curve). Also, I get the same plot by using the Matlab function fsolve. It's a little strange.

Quote:
Originally Posted by magdon View Post
The hypothesis is not a line. The hypothesis is a region on the 2-dimensional space that is +1 and the complement of that region is -1. The boundary that separates the +1 from the -1 region is a line for linear classification. For nonlinear classification the boundary is something else. In either case you can identify the boundary by identifying the regions which are +1 and the regions which are -1.

For nonlinear boundary, there may be more than one x2 for a given x1 or even no x2 for a given x1. This is why the brute force approach is the simplest for identifying the boundary.
Reply With Quote
  #8  
Old 07-26-2013, 11:33 AM
BojanVujatovic BojanVujatovic is offline
Member
 
Join Date: Jan 2013
Posts: 13
Default Re: Problem 3.3 Typo

It is also possible to draw these hypothesis (if one is using Matlab as a programming language) using symbolic variables and ezplot:
Code:
syms x y;
ezplot('curve for plotting as a string');
And also similar options exist if working with other programming languages.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:50 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.