diff --git a/.gitignore b/.gitignore index f377c56..5b924b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ venv .idea +tests \ No newline at end of file diff --git a/micromlgen/__pycache__/__init__.cpython-36.pyc b/micromlgen/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..bf85d49 Binary files /dev/null and b/micromlgen/__pycache__/__init__.cpython-36.pyc differ diff --git a/micromlgen/__pycache__/micromlgen.cpython-36.pyc b/micromlgen/__pycache__/micromlgen.cpython-36.pyc new file mode 100644 index 0000000..2b4cacd Binary files /dev/null and b/micromlgen/__pycache__/micromlgen.cpython-36.pyc differ diff --git a/micromlgen/micromlgen_test.py b/micromlgen/micromlgen_test.py deleted file mode 100644 index 60b3692..0000000 --- a/micromlgen/micromlgen_test.py +++ /dev/null @@ -1,22 +0,0 @@ -import pickle -from micromlgen import port -from sklearn.svm import SVC -from sklearn.datasets import load_iris - - -if __name__ == '__main__': - test_iris = True - if test_iris: - iris = load_iris() - X = iris.data - y = iris.target - clf = SVC(kernel='linear').fit(X, y) - print(port(clf)) - else: - with open('../svmporter/datasets/svm.clf', 'rb') as file: - payload = pickle.load(file) - clf = payload['clf'] - classmap = payload['classmap'] - # test_set = (payload['X_test'], payload['y_test']) - print(port(clf, classmap=classmap)) - diff --git a/micromlgen/templates/kernel_function.jinja b/micromlgen/templates/kernel_function.jinja index bc51f03..0ca4bb2 100644 --- a/micromlgen/templates/kernel_function.jinja +++ b/micromlgen/templates/kernel_function.jinja @@ -18,11 +18,11 @@ double compute_kernel(double x[{{ FEATURES_DIM }}], ...) { {% endif %} {% if KERNEL_TYPE == 'poly' %} - kernel = pow((KERNEL_GAMMA * kernel) + KERNEL_COEF, KERNEL_DEGREE); + kernel = pow(({{ KERNEL_GAMMA }} * kernel) + {{ KERNEL_COEF }}, {{ KERNEL_DEGREE }}); {% elif KERNEL_TYPE == 'rbf' %} kernel = exp(-{{ KERNEL_GAMMA }} * kernel); {% elif KERNEL_TYPE == 'sigmoid' %} - kernel = sigmoid((KERNEL_GAMMA * kernel) + KERNEL_COEF); + kernel = sigmoid(({{ KERNEL_GAMMA }} * kernel) + {{ KERNEL_COEF }}); {% endif %} return kernel;