Skip to content

Commit

Permalink
Update imports in applications
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jul 5, 2017
1 parent ea53b8b commit 6d9464e
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 48 deletions.
10 changes: 5 additions & 5 deletions applications/arts/signal_sensor.py
Expand Up @@ -12,11 +12,11 @@

from util import *

from shogun.Features import StringCharFeatures, StringWordFeatures, CombinedFeatures, DNA
from shogun.Kernel import CombinedKernel, WeightedDegreePositionStringKernel
from shogun.Kernel import K_COMMWORDSTRING, CommWordStringKernel, IdentityKernelNormalizer
from shogun.Preprocessor import SortWordString
from shogun.Classifier import KernelMachine
from shogun import StringCharFeatures, StringWordFeatures, CombinedFeatures, DNA
from shogun import CombinedKernel, WeightedDegreePositionStringKernel
from shogun import K_COMMWORDSTRING, CommWordStringKernel, IdentityKernelNormalizer
from shogun import SortWordString
from shogun import KernelMachine


class Sensor(object):
Expand Down
4 changes: 2 additions & 2 deletions applications/asp/asp
Expand Up @@ -24,9 +24,9 @@ try:
import genomic
import model
import seqdict
import shogun.Kernel
import shogun

d=shogun.Kernel.WeightedDegreeStringKernel(1)
d=shogun.WeightedDegreeStringKernel(1)
if (d.version.get_version_revision() < 2997):
print
print "ERROR: SHOGUN VERSION 0.6.2 or later required"
Expand Down
8 changes: 4 additions & 4 deletions applications/asp/signal_detectors.py
Expand Up @@ -13,10 +13,10 @@
import numpy
import seqdict

from shogun.Classifier import LibSVM
from shogun.Features import StringCharFeatures,DNA
from shogun.Kernel import WeightedDegreeStringKernel
from shogun.Library import DynamicIntArray
from shogun import LibSVM
from shogun import StringCharFeatures,DNA
from shogun import WeightedDegreeStringKernel
from shogun import DynamicIntArray

class svm_splice_model(object):
def __init__(self, order, traindat, alphas, b, (window_left,offset,window_right), consensus):
Expand Down
26 changes: 13 additions & 13 deletions applications/easysvm/esvm/experiment.py
Expand Up @@ -28,28 +28,28 @@
from poim import compute_poims

import shogun
from shogun.Kernel import GaussianKernel, WeightedDegreePositionStringKernel
from shogun.Kernel import WeightedDegreeStringKernel
from shogun.Kernel import LinearKernel, PolyKernel, LocalAlignmentStringKernel
from shogun.Kernel import LocalityImprovedStringKernel
from shogun.Kernel import CommWordStringKernel, WeightedCommWordStringKernel, CommUlongStringKernel
from shogun.Kernel import CombinedKernel
from shogun.Kernel import SLOWBUTMEMEFFICIENT
from shogun.Kernel import AvgDiagKernelNormalizer
from shogun.Features import RealFeatures, Labels, StringCharFeatures, DNA, StringWordFeatures, StringUlongFeatures, PROTEIN
from shogun.Features import CombinedFeatures
from shogun.Classifier import LibSVM,GPBTSVM
from shogun import GaussianKernel, WeightedDegreePositionStringKernel
from shogun import WeightedDegreeStringKernel
from shogun import LinearKernel, PolyKernel, LocalAlignmentStringKernel
from shogun import LocalityImprovedStringKernel
from shogun import CommWordStringKernel, WeightedCommWordStringKernel, CommUlongStringKernel
from shogun import CombinedKernel
from shogun import SLOWBUTMEMEFFICIENT
from shogun import AvgDiagKernelNormalizer
from shogun import RealFeatures, Labels, StringCharFeatures, DNA, StringWordFeatures, StringUlongFeatures, PROTEIN
from shogun import CombinedFeatures
from shogun import LibSVM,GPBTSVM

DefaultSVM = LibSVM
try:
from shogun.Classifier import SVMLight
from shogun import SVMLight
LinAddSVM = SVMLight
LinearSVM = SVMLight
except:
LinAddSVM = GPBTSVM
LinearSVM = LibSVM

from shogun.Preprocessor import SortWordString, SortUlongString
from shogun import SortWordString, SortUlongString

from utils import calcprc, calcroc, accuracy
from utils import getPartitionedSet, getCurrentSplit
Expand Down
4 changes: 2 additions & 2 deletions applications/easysvm/esvm/plots.py
Expand Up @@ -27,8 +27,8 @@
import warnings
import shutil

from shogun.Features import Labels
from shogun.Evaluation import *
from shogun import Labels
from shogun import *

def plotroc(output, LTE, draw_random=False, figure_fname="", roc_label='ROC'):
"""Plot the receiver operating characteristic curve"""
Expand Down
4 changes: 2 additions & 2 deletions applications/easysvm/esvm/utils.py
Expand Up @@ -23,8 +23,8 @@
import warnings
import shutil

from shogun.Features import Labels
from shogun.Evaluation import *
from shogun import Labels
from shogun import *

################################################################################
# evaluation functions
Expand Down
6 changes: 3 additions & 3 deletions applications/easysvm/tutpaper/svm_params.py
Expand Up @@ -14,9 +14,9 @@

import numpy
import shogun
from shogun.Kernel import GaussianKernel, LinearKernel, PolyKernel
from shogun.Features import RealFeatures, BinaryLabels
from shogun.Classifier import LibSVM
from shogun import GaussianKernel, LinearKernel, PolyKernel
from shogun import RealFeatures, BinaryLabels
from shogun import LibSVM

from numpy import arange
import matplotlib
Expand Down
10 changes: 5 additions & 5 deletions applications/msplicer/msplicer
Expand Up @@ -22,9 +22,9 @@ try:
import genomic
import model
import seqdict
import shogun.Structure
import shogun

d=shogun.Structure.DynProg()
d=shogun.DynProg()
if (d.version.get_version_revision() < 2997):
print
print "ERROR: SHOGUN VERSION 0.6.2 or later required"
Expand Down Expand Up @@ -152,7 +152,7 @@ class msplicer:


def initialize_dynprog(self, seq):
dyn=shogun.Structure.DynProg()
dyn=shogun.DynProg()

self.content.initialize_content(dyn)

Expand Down Expand Up @@ -266,7 +266,7 @@ class msplicer:
dyn.best_path_set_my_state_seq(my_states)
dyn.best_path_set_my_pos_seq(my_pos)

dyn.io.set_loglevel(shogun.Structure.M_DEBUG)
dyn.io.set_loglevel(shogun.M_DEBUG)
dyn.best_path_deriv_call()

def print_version():
Expand Down Expand Up @@ -348,7 +348,7 @@ WS160, WS160gc, orfWS160gc


if __name__ == '__main__':
dyn=shogun.Structure.DynProg()
dyn=shogun.DynProg()
(startstop, fafname, modelfname, outfile ) = parse_options()
p=msplicer()
p.load_model(modelfname);
Expand Down
6 changes: 3 additions & 3 deletions applications/msplicer/plif.py
Expand Up @@ -10,9 +10,9 @@
#

from numpy import array
from shogun.Structure import Plif
from shogun.Structure import PlifArray
from shogun.Library import DynamicPlifArray
from shogun import Plif
from shogun import PlifArray
from shogun import DynamicPlifArray

class plif:
def __init__(self, model):
Expand Down
18 changes: 9 additions & 9 deletions applications/tapkee/swissroll_embedding.py
Expand Up @@ -5,12 +5,12 @@
N = X.shape[1]
converters = []

from shogun.Converter import LocallyLinearEmbedding
from shogun import LocallyLinearEmbedding
lle = LocallyLinearEmbedding()
lle.set_k(9)
converters.append((lle, "LLE with k=%d" % lle.get_k()))

from shogun.Converter import MultidimensionalScaling
from shogun import MultidimensionalScaling
mds = MultidimensionalScaling()
converters.append((mds, "Classic MDS"))

Expand All @@ -19,29 +19,29 @@
lmds.set_landmark_number(20)
converters.append((lmds,"Landmark MDS with %d landmarks" % lmds.get_landmark_number()))

from shogun.Converter import Isomap
from shogun import Isomap
cisomap = Isomap()
cisomap.set_k(9)
converters.append((cisomap,"Isomap with k=%d" % cisomap.get_k()))

from shogun.Converter import DiffusionMaps
from shogun.Kernel import GaussianKernel
from shogun import DiffusionMaps
from shogun import GaussianKernel
dm = DiffusionMaps()
dm.set_t(2)
dm.set_width(1000.0)
converters.append((dm,"Diffusion Maps with t=%d, sigma=%.1f" % (dm.get_t(),dm.get_width())))

from shogun.Converter import HessianLocallyLinearEmbedding
from shogun import HessianLocallyLinearEmbedding
hlle = HessianLocallyLinearEmbedding()
hlle.set_k(6)
converters.append((hlle,"Hessian LLE with k=%d" % (hlle.get_k())))

from shogun.Converter import LocalTangentSpaceAlignment
from shogun import LocalTangentSpaceAlignment
ltsa = LocalTangentSpaceAlignment()
ltsa.set_k(6)
converters.append((ltsa,"LTSA with k=%d" % (ltsa.get_k())))

from shogun.Converter import LaplacianEigenmaps
from shogun import LaplacianEigenmaps
le = LaplacianEigenmaps()
le.set_k(20)
le.set_tau(100.0)
Expand All @@ -67,7 +67,7 @@
plt.suptitle('Swissroll embedding',fontsize=9)
plt.subplots_adjust(hspace=0.4)

from shogun.Features import RealFeatures
from shogun import RealFeatures

for (i, (converter, label)) in enumerate(converters):
X = numpy.genfromtxt('../../data/toy/swissroll.dat',unpack=True).T
Expand Down

0 comments on commit 6d9464e

Please sign in to comment.