Skip to content

Commit

Permalink
Merge pull request #403 from pluskid/gsoc-pullrequest-1
Browse files Browse the repository at this point in the history
Make the testsuite data generation script run again.
  • Loading branch information
Soeren Sonnenburg committed Mar 30, 2012
2 parents afb8b5e + d22dd40 commit 25f5321
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion testsuite/generator/classifier.py
Expand Up @@ -122,7 +122,7 @@ def _compute_svm (params, labels, feats, kernel, pout):
elif params['type']=='linear' or params['type']=='wdsvmocas':
svm.set_features(feats['test'])

params['classified']=svm.classify().get_labels()
params['classified']=svm.apply().get_labels()

output=fileop.get_output(category.CLASSIFIER, params)
if pout:
Expand Down
8 changes: 4 additions & 4 deletions testsuite/generator/featop.py
Expand Up @@ -136,10 +136,10 @@ def add_preproc (name, feats, *args):
fun=eval('preproc.'+name)
preproc=fun(*args)
preproc.init(feats['train'])
feats['train'].add_preproc(preproc)
feats['train'].apply_preproc()
feats['test'].add_preproc(preproc)
feats['test'].apply_preproc()
feats['train'].add_preprocessor(preproc)
feats['train'].apply_preprocessor()
feats['test'].add_preprocessor(preproc)
feats['test'].apply_preprocessor()

return feats

14 changes: 7 additions & 7 deletions testsuite/generator/kernel.py
Expand Up @@ -11,7 +11,7 @@
from shogun.Features import CombinedFeatures, TOPFeatures, FKFeatures, CUBE, RAWBYTE
from shogun.Classifier import PluginEstimate
from shogun.Distance import CanberraMetric
from shogun.Distribution import HMM, Model, LinearHMM, BW_NORMAL
from shogun.Distribution import HMM, LinearHMM, BW_NORMAL
from shogun.Library import Math_init_random

import fileop
Expand Down Expand Up @@ -47,7 +47,7 @@ def _compute_pie (feats, params):
pie.set_features(feats['test'])
output['kernel_matrix_test']=kern.get_kernel_matrix()

classified=pie.classify().get_labels()
classified=pie.apply().get_labels()
output['classifier_classified']=classified

fileop.write(category.KERNEL, output)
Expand Down Expand Up @@ -277,7 +277,7 @@ def _run_feats_byte ():
"""Run kernel with ByteFeatures."""

params={
'name': 'LinearByte',
'name': 'Linear',
'accuracy': 1e-8,
'feature_class': 'simple',
'feature_type': 'Byte',
Expand Down Expand Up @@ -335,7 +335,7 @@ def _run_feats_real ():
}
_compute(feats, params)

params['name']='SparseGaussian'
params['name']='Gaussian'
params['args']={'key': ('size', 'width'), 'val': (10, 1.7)}
_compute(sparsefeats, params)

Expand Down Expand Up @@ -363,7 +363,7 @@ def _run_feats_real ():
_compute(feats, params)

params['accuracy']=1e-8
params['name']='SparsePoly'
params['name']='Poly'
params['args']={
'key': ('size', 'degree', 'inhomogene'),
'val': (10, 3, True)
Expand All @@ -386,7 +386,7 @@ def _run_feats_real ():
del params['args']
params['name']='Linear'
_compute(feats, params)
params['name']='SparseLinear'
params['name']='Linear'
_compute(sparsefeats, params)


Expand Down Expand Up @@ -463,7 +463,7 @@ def _run_feats_word ():

maxval=42
params={
'name': 'LinearWord',
'name': 'Linear',
'accuracy': 1e-8,
'feature_class': 'simple',
'feature_type': 'Word',
Expand Down
2 changes: 1 addition & 1 deletion testsuite/generator/preproc.py
Expand Up @@ -2,7 +2,7 @@

import shogun.Library as library
from shogun.Kernel import GaussianKernel, CommWordStringKernel, \
CommUlongStringKernel, LinearWordKernel
CommUlongStringKernel

import fileop
import featop
Expand Down
2 changes: 1 addition & 1 deletion testsuite/generator/regression.py
Expand Up @@ -47,7 +47,7 @@ def _compute (params, feats, kernel, pout):
params['sv_sum']+=item

kernel.init(feats['train'], feats['test'])
params['classified']=regression.classify().get_labels()
params['classified']=regression.apply().get_labels()

output=pout.copy()
output.update(fileop.get_output(category.REGRESSION, params))
Expand Down

0 comments on commit 25f5321

Please sign in to comment.