Spaces:
Build error
Build error
File size: 494 Bytes
dda3dc2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
def build_tfidf_model():
model = Pipeline([
("tfidf", TfidfVectorizer(
max_features=20000,
ngram_range=(1, 2),
stop_words="english"
)),
("clf", LogisticRegression(
max_iter=1000,
class_weight="balanced"
))
])
return model
|