HOME FORUMS BROKERS SOFTWARE BOOKS CONTACT US
Elite Trader Your Account  •  Become a Member  •  Help  •  Search    
    Forums ›› Technically Speaking ›› Programming ›› Support Vector Machine  


Post A Reply
    Page 1 of 2:   1  2  
darwish4k
 

Registered: Jul 2012
Posts: 3

 

07-08-12 01:17 PM

Hello all,

I'm trying to develop a simple matlab code to do classification for me, i am aware that i can use svmclassify function in the matlab instead trying to write the code by myself, but i have to do this becuase it is part of my job goal. Here is the problem:

I am training the data set using the svmtrain function from the matlab and then trying to classify the new data by using my own code. From what i understand the svmtrain matlab returning the alpha, support vector and bias value which i can use to satisfy the hyperplane equation sign(w.x + b) for the new data.

So i calculated the w value with this equation w = sum(alpha*class label*support vector), now i have the w value. I also have the new data that i want to classify which i already know what is the class label. I'm doing this because i want to know whether my classifier is working or not. So i plug in the value and do the calculation, but it retun me the wrong class label for the new data. Can anyone check the code and help me if there is something that i miss out or do it wrongly. Attached is the code. Thanks for the help

matlab r2011b-2.jpg
This has been downloaded 126 time(s).

    Edit/Delete Quote Complain
hft_boy
 

Registered: Apr 2012
Posts: 177

 

07-08-12 04:44 PM


Quote from darwish4k:

Can anyone check the code and help me if there is something that i miss out or do it wrongly. Attached is the code. Thanks for the help



Not familiar with the MATLAB package. But, looks like it should be dot(w,x) - bias instead of dot(w,x) + bias, if I recall correctly.

EDIT
Well, apparently not. Looks like you're using the equation from http://www.mathworks.com/help/toolb...mclassify.html. In that case, I'd check to see that you're not somehow switching the two groups around; beyond that I'm afraid I'm not much help.

    Edit/Delete Quote Complain
darwish4k
 

Registered: Jul 2012
Posts: 3

 

07-10-12 12:45 AM


Quote from hft_boy:


EDIT

In that case, I'd check to see that you're not somehow switching the two groups around; beyond that I'm afraid I'm not much help.



I'm sorry, I don't really understand. What do you mean by switching the two groups around.

I'm stuck here for quite sometime, have been searching and trying. Still I didn't get any solution

    Edit/Delete Quote Complain
darwish4k
 

Registered: Jul 2012
Posts: 3

 

07-10-12 12:51 AM


Quote from hft_boy:
EDIT
In that case, I'd check to see that you're not somehow switching the two groups around; beyond that I'm afraid I'm not much help.



I'm sorry, I don't really understand what you're trying to tell me. What do you mean by switching the two groups?

I have been stuck here for few days. Been searching and trying, but still didn't found any solution

    Edit/Delete Quote Complain
hft_boy
 

Registered: Apr 2012
Posts: 177

 

07-10-12 03:31 AM


Quote from darwish4k:

I'm sorry, I don't really understand what you're trying to tell me. What do you mean by switching the two groups?

I have been stuck here for few days. Been searching and trying, but still didn't found any solution



Oh, something stupid like
if (sign(dot(w,x)+bias) > 0) {
class = "versicolor";
} else {
class = "virginica
}
(You might have a sign error)

Sorry, it's the best I can come up with. If you can show me more code/data, PM me and I may be able to help you more.

    Edit/Delete Quote Complain
bluelou
 

Registered: Nov 2006
Posts: 190

 

07-22-12 08:43 PM

I just had SVM as part of the Coursera/Stanford Univ. Machine Learning (ML) class. All the code is in Matlab/Octave. PM me if you want it. I can't post it here since it includes answers to homework problems.

    Edit/Delete Quote Complain
    Page 1 of 2:   1  2  
Post A Reply


Receive an email whenever a new post is added to this thread by subscribing to it.
 
Rate This Thread:

Forum Jump:
 

 

   Conduct Rules  -  Privacy Policy  -  Day Trader -  Day Trader Forum -  Best Trading Software -  Sitemap Copyright © 2013, Elite Trader. All rights reserved.    
 
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Brokerage & Clearing
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider