• No results found

In this illusteration property file in figure (B.1) is passed as a command line argu- ment to an application wanting to use the SVM engine. The SVM engine can be initialized as demonstrated in figure (B.2). Note that the training data format and SVM parameter inputs are parsed using the corresponding factory objects.

# SVM e n g i n e c o n f i g u r a t i o n e n g i n e = SMO c v a l = 1 . 5 e p s i l o n = 0 . 0 0 1 t o l e r a n c e = 0 . 0 0 1 m a x i t e r = 1000 random . s e e d = 1213654164793 # Data c o n f i g u r a t i o n

data . t e s t . typ e = SINGLE DNA TRAIN

data . t e s t . f i l e = /home/ sammerat / workspace /SWSVM/ data /9 bphp/8GC9CG . t r a i n

data . t e s t . typ e = SINGLE DNA TEST

data . t e s t . f i l e = /home/ sammerat / workspace /SWSVM/ data /9 bphp/8GC9CG . t e s t

# K er n el c o n f i g u r a t i o n c l a s s = ABSDIFF

sigma = 2

# SVMR e l a b e l e r p a r a m e t e r s

r e l a b e l e r . p r oc = SYM PERC REL PROC r e l a b e l e r . m a x i t e r = 30

r e l a b e l e r . r e l f a c t o r =0.15

r e l a b e l e r . s a . temp . p r oc = EXP COOL r e l a b e l e r . s a . temp . i n i t = 6 . 0

r e l a b e l e r . s a . m a x i t e r = 1 0 . 0

Figure B.1: Example property file to configure data, train and test using an SMO SVM engine, and cluster using the SVM-Relabeler engine

SMO = edu . uno . c s . b i o i n f o r m a t i c s . svm . e n g i n e . SMOParameters ABSDIFF = edu . uno . c s . b i o i n f o r m a t i c s . k e r n e l . A b s d i f f K e r n e l GAUSSIAN = edu . uno . c s . b i o i n f o r m a t i c s . k e r n e l . Gau s s ian Ker n el SINGLE DNA TRAIN = edu . uno . c s . b i o i n f o r m a t i c s . data .

S in gleFileDNAT es tin gD a ta Fa c to r y

SYM PERC REL PROC = edu . uno . c s . b i o i n f o r m a t i c s . svm . c l u s t e r . r e l a b e l e r . S y m m e t r i c P e r c e n t i l e P r o c e d u r e F a c t o r y

EXP COOL = edu . uno . c s . b i o i n f o r m a t i c s . svm . c l u s t e r . r e l a b e l e r . s a . E x p o n e n t i a l C o o l i n g F a c t o r y

Figure B.2: Example java class mapping file.

P r o p e r t i e s C o n f i g u r a t i o n propConf = n u l l; try { propConf = new P r o p e r t i e s C o n f i g u r a t i o n ( a r g s [ 0 ] ) ; }catch ( C o n f i g u r a t i o n E x c e p t i o n ce ) { l o g g e r . e r r o r ( a r g s [ 0 ] + ” p r o p e r t y f i l e not found . ” , ce ) ; } T r ain in gData t r a i n i n g D a t a = n u l l; SVMParameters svmParams = n u l l; try { t r a i n i n g D a t a = T r ain in gDataFa c to r y . g e t T r a i n T r a i n i n g D a t a F a c t o r y ( propConf ) . g e t T r a i n i n g D a t a ( ) ; svmParams = SVMParametersBuilder . getSVMParameters ( propConf ) ; }catch( P r o p e r t y E x c e p t i o n pce ) {

l o g g e r . e r r o r ( pce . getMes s age ( ) , pce ) ;

return;

}

Learning and prediction using SVM is then demonstrated in figures (B.2) and (B.2).

SVMLearner svmLearner = svmParams . getSVMLearner ( ) ;

SVMModel svmModel = svmLearner . learnSVM ( t r a i n i n g D a t a , svmParams ) ;

Figure B.4: Learning using the SVM engine.

SVMPredictionData pred = new SVMPredictor ( svmModel , t e s t D a t a ) . p r e d i c t ( ) ;

Figure B.5: Prediction using the SVM engine.

Related documents