diff --git a/example.py b/example.py index 6e97350..4ac709b 100644 --- a/example.py +++ b/example.py @@ -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() diff --git a/pykernels/__init__.py b/pykernels/__init__.py index 53f0736..de26884 100644 --- a/pykernels/__init__.py +++ b/pykernels/__init__.py @@ -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 diff --git a/pykernels/basic.py b/pykernels/basic.py index 0c72a67..3aa4261 100644 --- a/pykernels/basic.py +++ b/pykernels/basic.py @@ -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): """ diff --git a/pykernels/graph/__init__.py b/pykernels/graph/__init__.py index 0d777da..44ee814 100644 --- a/pykernels/graph/__init__.py +++ b/pykernels/graph/__init__.py @@ -1,3 +1,3 @@ -from randomwalk import RandomWalk -from allgraphlets import All34Graphlets -from shortestpath import ShortestPath \ No newline at end of file +from .randomwalk import RandomWalk +from .allgraphlets import All34Graphlets +from .shortestpath import ShortestPath diff --git a/pykernels/graph/allgraphlets.py b/pykernels/graph/allgraphlets.py index 4681328..6a88006 100644 --- a/pykernels/graph/allgraphlets.py +++ b/pykernels/graph/allgraphlets.py @@ -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""" diff --git a/pykernels/graph/basic.py b/pykernels/graph/basic.py index effd26c..82f07a1 100644 --- a/pykernels/graph/basic.py +++ b/pykernels/graph/basic.py @@ -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): diff --git a/pykernels/graph/randomwalk.py b/pykernels/graph/randomwalk.py index 7a69088..243a409 100644 --- a/pykernels/graph/randomwalk.py +++ b/pykernels/graph/randomwalk.py @@ -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""" diff --git a/pykernels/graph/shortestpath.py b/pykernels/graph/shortestpath.py index d62f627..a4f5d54 100644 --- a/pykernels/graph/shortestpath.py +++ b/pykernels/graph/shortestpath.py @@ -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 diff --git a/pykernels/regular.py b/pykernels/regular.py index c65f01e..8a9b03f 100644 --- a/pykernels/regular.py +++ b/pykernels/regular.py @@ -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): diff --git a/setup.py b/setup.py index ced23c5..f913b18 100644 --- a/setup.py +++ b/setup.py @@ -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',