Skip to content

Commit

Permalink
ibrahimsharaf#14 added classifier class rest of abstract methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayatallah committed May 14, 2019
1 parent 1658426 commit 67d6ee9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions models/classifier_builder.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging
import numpy as np
import os
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, f1_score

from sklearn.externals import joblib
from .model_builder import ModelBuilder
from .doc2vec_builder import doc2VecBuilder
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
Expand All @@ -24,8 +25,12 @@ def train_model(self, d2v, training_vectors, training_labels):
logging.info('Training F1 score: {}'.format(f1_score(training_labels, training_predictions, average='weighted')))


def save_model(self):
pass
def save_model(self, filename):
joblib.dump(self.model,"./classifiers/"+ filename)

def load_model(self):
pass
def load_model(self,filename):
if (os.path.isfile('./classifiers/' + filename)):
loaded_model = joblib.load(filename)
self.model = loaded_model
else:
self.model = None

0 comments on commit 67d6ee9

Please sign in to comment.