LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > Homework 8

Reply
 
Thread Tools Display Modes
  #1  
Old 05-26-2012, 12:41 PM
rohanag rohanag is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 94
Default scale or not

I'm getting different results for scaled and non scaled data. So can I get clarification, whether the data has to be scaled or not? Thank you.
Reply With Quote
  #2  
Old 05-26-2012, 07:43 PM
kkkkk kkkkk is offline
Invited Guest
 
Join Date: Mar 2012
Posts: 71
Default Re: scale or not

For libsvm, the user guide and README recommend scaling and using the same scaling factors for training and testing sets.

Libsvm can save the scaling factors from the training data and apply it to the test data:

svm-scale -s scaling_parameters train_data > scaled_train_data
svm-scale -r scaling_parameters test_data > scaled_test_data

For the 1 vs 5 classifier, it is still necessary to filter out the unused digits first.
Reply With Quote
  #3  
Old 05-26-2012, 09:57 PM
mic00 mic00 is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 49
Default Re: scale or not

I believe (though please correct me if I'm wrong) that scaling will change the effective meaning of C, so I'm hesitant to use it here. My impression is that scaling is generally recommended in the real world, but in terms of the answers for this homework, I'm not sure.
Reply With Quote
  #4  
Old 05-26-2012, 11:45 PM
yaser's Avatar
yaser yaser is offline
Caltech
 
Join Date: Aug 2009
Location: Pasadena, California, USA
Posts: 1,478
Default Re: scale or not

Quote:
Originally Posted by rohanag View Post
I'm getting different results for scaled and non scaled data. So can I get clarification, whether the data has to be scaled or not? Thank you.
One of the side effects of scaling {\bf x} is that the resulting kernel will not be the same as without scaling {\bf x}. The homework problems are stated in terms of a given kernel.
__________________
Where everyone thinks alike, no one thinks very much
Reply With Quote
  #5  
Old 05-27-2012, 01:48 AM
rohanag rohanag is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 94
Default Re: scale or not

Thank you professor.
Reply With Quote
  #6  
Old 05-27-2012, 04:33 AM
kurts kurts is offline
Invited Guest
 
Join Date: Apr 2012
Location: Portland, OR
Posts: 70
Default Re: scale or not

Quote:
Originally Posted by yaser View Post
One of the side effects of scaling {\bf x} is that the resulting kernel will not be the same as without scaling {\bf x}. The homework problems are stated in terms of a given kernel.
Apologies Professor, but I don't fully understand what you meant.

I understand that you are saying that the kernels are different whether you scale or not, but when you say the homework is stated in terms of a "given kernel", which kernel is that, scaled or not?

Everyone seems to take your statement as we should not scale, but it is not clear to me that is what you meant.

Again, sorry if I am being obtuse. Going on very little sleep, here
Reply With Quote
  #7  
Old 05-27-2012, 10:24 AM
yaser's Avatar
yaser yaser is offline
Caltech
 
Join Date: Aug 2009
Location: Pasadena, California, USA
Posts: 1,478
Default Re: scale or not

Quote:
Originally Posted by kurts View Post
Apologies Professor, but I don't fully understand what you meant.

I understand that you are saying that the kernels are different whether you scale or not, but when you say the homework is stated in terms of a "given kernel", which kernel is that, scaled or not?

Everyone seems to take your statement as we should not scale, but it is not clear to me that is what you meant.

Again, sorry if I am being obtuse. Going on very little sleep, here
Let's say that the input is scalar x and the kernel given in the problem is K(x,x'). If you take the inputs in the training data set x_1,\cdots,x_N and normalize them (say compute their sample mean and standard deviation, \mu,\sigma, then define your new input variables to be \hat x = {x-\mu \over \sigma}), then if you plug in these new variables in the kernel and use K(\hat x,\hat x') as your kernel (with ramifications on distances, margins, slack variables, etc.), you may be solving a different problem from the one without scaling.

Nothing wrong with scaling the training inputs in general, but the multiple-choice answers are based on the specific kernel and the C given in the problem statements. If you change things, make sure that you are still solving the same problem that was stated.
__________________
Where everyone thinks alike, no one thinks very much
Reply With Quote
Reply

Tags
hw8, scaling

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 12:28 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, 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.