Skip to content

Commit

Permalink
fix a couple of issues like in applications
Browse files Browse the repository at this point in the history
most notably the SVM object is gone and replaced by KernelMachine
  • Loading branch information
Soeren Sonnenburg committed Mar 19, 2012
1 parent d4bb942 commit eca0d2d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions applications/arts/signal_sensor.py
Expand Up @@ -16,7 +16,7 @@
from shogun.Kernel import CombinedKernel, WeightedDegreePositionStringKernel
from shogun.Kernel import K_COMMWORDSTRING, CommWordStringKernel, IdentityKernelNormalizer
from shogun.Preprocessor import SortWordString
from shogun.Classifier import SVM
from shogun.Classifier import KernelMachine


class Sensor(object):
Expand Down Expand Up @@ -156,7 +156,7 @@ def from_file(self, file):
self.svs.append_feature_obj(f)

self.kernel.init(self.svs, self.svs)
self.svm = SVM(self.kernel, alphas,
self.svm = KernelMachine(self.kernel, alphas,
numpy.arange(len(alphas), dtype=numpy.int32), bias)
self.svm.io.set_target_to_stderr()
self.svm.io.enable_progress()
Expand Down
6 changes: 2 additions & 4 deletions applications/msplicer/signal_detectors.py
Expand Up @@ -13,9 +13,7 @@
import numpy
import seqdict

from shogun.Classifier import SVM
from shogun.Features import StringCharFeatures,DNA
from shogun.Kernel import WeightedDegreeStringKernel
from modshogun import KernelMachine,StringCharFeatures,DNA,WeightedDegreeStringKernel

class svm_splice_model(object):
def __init__(self, order, traindat, alphas, b, (window_left,offset,window_right), consensus):
Expand All @@ -25,7 +23,7 @@ def __init__(self, order, traindat, alphas, b, (window_left,offset,window_right)
wd_kernel = WeightedDegreeStringKernel(f,f, int(order))
wd_kernel.io.set_target_to_stderr()

self.svm=SVM(wd_kernel, alphas, numpy.arange(len(alphas), dtype=numpy.int32), b)
self.svm=KernelMachine(wd_kernel, alphas, numpy.arange(len(alphas), dtype=numpy.int32), b)
self.svm.io.set_target_to_stderr()
self.svm.parallel.set_num_threads(self.svm.parallel.get_num_cpus())
self.svm.set_linadd_enabled(False)
Expand Down
12 changes: 3 additions & 9 deletions applications/ocr/Ai.py
@@ -1,15 +1,9 @@
# File : $HeadURL$
# Version: $Id$

try:
# different import paths were used during development...
from Features import RealFeatures, Labels
from Kernel import GaussianKernel
from Classifier import GMNPSVM
except ImportError:
from modshogun import RealFeatures, Labels
from modshogun import GaussianKernel
from modshogun import GMNPSVM
from modshogun import RealFeatures, Labels
from modshogun import GaussianKernel
from modshogun import GMNPSVM

import numpy as np
import gzip as gz
Expand Down
3 changes: 2 additions & 1 deletion applications/sailfish/Makefile
@@ -1,6 +1,7 @@
CXXFLAGS=-O9 -g $(INCLUDES)
LINKFLAGS=-lshogun
TARGETS = sailfish
COMP = g++

all: $(TARGETS)

Expand All @@ -10,4 +11,4 @@ clean:
$(TARGETS): $(foreach t, $(TARGET), $t.cpp)

%: %.cpp
gcc $(CXXFLAGS) $< $(LINKFLAGS) -lshogun -o $@
$(COMP) $(CXXFLAGS) $< $(LINKFLAGS) -o $@

0 comments on commit eca0d2d

Please sign in to comment.