diff --git a/server/nightr/strategies/svm_strat.py b/server/nightr/strategies/svm_strat.py index 81d1569..90fa84f 100644 --- a/server/nightr/strategies/svm_strat.py +++ b/server/nightr/strategies/svm_strat.py @@ -1,3 +1,5 @@ +from pathlib import Path + from sklearn import svm from sklearn.externals import joblib import requests @@ -36,7 +38,7 @@ def train(): joblib.dump(classifier, "nightness_classifier.pkl") def predict(X): - classifier = joblib.load("nightness_classifier.pkl") + classifier = joblib.load(str(Path(__file__).parent.joinpath("nightness_classifier.pkl"))) prob = classifier.predict_proba(np.array(X).reshape(1, -1)) return prob[0, 1]