0
$\begingroup$
#these are classifier and  vectorizer

vectorizer = CountVectorizer(tokenizer = spacy_tokenizer, ngram_range=(1,1))
classifier = LinearSVC()

I have created a Pipeline as shown below

# Create the  pipeline to clean, tokenize, vectorize, and classify
pipe = Pipeline([("cleaner", predictors()),
                 ('vectorizer', vectorizer),
                  ('classifier', classifier)])

while predicting the test dataset, im facing this issue.

sample_prediction = pipe.predict(X_test)

ERROR : sklearn.exceptions.NotFittedError: CountVectorizer - Vocabulary wasn't fitted.

Can anyone help ?

$\endgroup$

1 Answer 1

1
$\begingroup$

You have to give your training set to the model to be trained

_= pipe.fit(triningSet.data, triningSet.target)

I don't see any training dataset here. you have to fit the CountVectoriser to your data set.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.