From 3e28e6e615687f9eb958a1fdae2f5c30a0a1c502 Mon Sep 17 00:00:00 2001 From: Advaith Rao Date: Tue, 7 Nov 2023 22:44:22 -0500 Subject: [PATCH] Fixed word2vec vectorizer for SVM model --- detector/modeler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/detector/modeler.py b/detector/modeler.py index b629bce..c708070 100644 --- a/detector/modeler.py +++ b/detector/modeler.py @@ -339,8 +339,8 @@ def train( label = label.tolist() # Vectorize the input texts - X = self.vectorizer.fit_transform(body) - y = np.array(label) + X = [self.vectorizer.fit_transform(doc) for doc in body] + y = label # Train the SVM model self.model.fit(X, y) @@ -361,7 +361,7 @@ def predict( body = body.tolist() # Vectorize the input texts - X = self.vectorizer.transform(body) + X = [self.vectorizer.fit_transform(doc) for doc in body] # Make predictions using the trained SVM model predictions = self.model.predict(X)