Skip to content

Commit

Permalink
fix ocr example and data for new shogun
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Aug 30, 2011
1 parent 312e97b commit f0b3121
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions applications/ocr/Ai.py
Expand Up @@ -7,9 +7,9 @@
from Kernel import GaussianKernel
from Classifier import GMNPSVM
except ImportError:
from shogun.Features import RealFeatures, Labels
from shogun.Kernel import GaussianKernel
from shogun.Classifier 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 Expand Up @@ -81,7 +81,7 @@ def train(self, kernel_width, c, epsilon):
def load_classifier(self): self.read_svm()

def classify(self, matrix):
cl = self.svm.classify(
cl = self.svm.apply(
RealFeatures(
np.reshape(matrix, newshape=(com.FEATURE_DIM, 1),
order='F')
Expand All @@ -92,7 +92,7 @@ def classify(self, matrix):

def get_test_error(self):
self.svm.io.enable_progress()
l = self.svm.classify(RealFeatures(self.x_test)).get_labels()
l = self.svm.apply(RealFeatures(self.x_test)).get_labels()
self.svm.io.disable_progress()

return 1.0 - np.mean(l == self.y_test)
Binary file modified applications/ocr/data/ocr.svm.gz
Binary file not shown.

0 comments on commit f0b3121

Please sign in to comment.