Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
X = np.array([[1,1], [0,0], [1,0], [0,1]])
y = np.array([1, 1, 0, 0])

print 'Testing XOR'
print ('Testing XOR')

for clf, name in [(SVC(kernel=RBF(), C=1000), 'pykernel'), (SVC(kernel='rbf', C=1000), 'sklearn')]:
clf.fit(X, y)
print name
print clf
print 'Predictions:', clf.predict(X)
print 'Accuracy:', accuracy_score(clf.predict(X), y)
print
print (name)
print (clf)
print ('Predictions:', clf.predict(X))
print( 'Accuracy:', accuracy_score(clf.predict(X), y))
print()
8 changes: 4 additions & 4 deletions pykernels/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from basic import Linear, Polynomial, RBF
from regular import Exponential, Laplacian, RationalQuadratic, InverseMultiquadratic, Cauchy, TStudent,\
from .basic import Linear, Polynomial, RBF
from .regular import Exponential, Laplacian, RationalQuadratic, InverseMultiquadratic, Cauchy, TStudent,\
ANOVA, Spline, Min, Log, Power, Chi2, AdditiveChi2, GeneralizedHistogramIntersection,\
Tanimoto, Sorensen, MinMax, Wavelet, Fourier
from graph.randomwalk import RandomWalk
from graph.allgraphlets import All34Graphlets
from .graph.randomwalk import RandomWalk
from .graph.allgraphlets import All34Graphlets
4 changes: 2 additions & 2 deletions pykernels/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

__author__ = 'lejlot'

from pykernels.base import Kernel
from .base import Kernel
import numpy as np
from utils import euclidean_dist_matrix
from .utils import euclidean_dist_matrix

class Linear(Kernel):
"""
Expand Down
6 changes: 3 additions & 3 deletions pykernels/graph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from randomwalk import RandomWalk
from allgraphlets import All34Graphlets
from shortestpath import ShortestPath
from .randomwalk import RandomWalk
from .allgraphlets import All34Graphlets
from .shortestpath import ShortestPath
2 changes: 1 addition & 1 deletion pykernels/graph/allgraphlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import itertools
import numpy as np
from pykernels.base import Kernel, GraphKernel
import basic
from . import basic

def dec2bin(k, bitlength=0):
"""Decimal to binary"""
Expand Down
4 changes: 2 additions & 2 deletions pykernels/graph/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def graphs_to_adjacency_lists(data):
try:
if data.ndim == 3:
return np.array(data)
except Exception, exc:
except Exception:
try:
return np.array([G.adjacency_matix for G in data])
except Exception, exc:
except Exception:
return np.array(data)

def relabel(data, data_2):
Expand Down
2 changes: 1 addition & 1 deletion pykernels/graph/randomwalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pykernels.base import Kernel, GraphKernel
from scipy.sparse import lil_matrix, kron,identity
from scipy.sparse.linalg import lsqr
import basic
from . import basic

def _norm(adj_mat):
"""Normalize adjacency matrix"""
Expand Down
2 changes: 1 addition & 1 deletion pykernels/graph/shortestpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
import numpy.matlib as matlib
import basic
from . import basic
from pykernels.base import Kernel, GraphKernel
from scipy.sparse import lil_matrix

Expand Down
4 changes: 2 additions & 2 deletions pykernels/regular.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

__author__ = 'lejlot'

from pykernels.base import Kernel
from .base import Kernel
import numpy as np
from utils import euclidean_dist_matrix
from .utils import euclidean_dist_matrix
import warnings

class Cossim(Kernel):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'Intended Audience :: Machine Learning Research',
'License :: OSI Approved ::' + LICENSE,
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering :: Machine Learning',
Expand Down