Есть-ли какие-то метрики, с помощью которых можно определить какая векторизация лучше?
Есть-ли какие-то метрики, с помощью которых можно определить какая векторизация лучше? Единственная метрика про которую я слышал - accurancy, есть-ли какие-то другие?
from sklearn.model_selection import train_test_split
y = df['Color'].values
X = df['Label'].values
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, stratify=y)
print("Train data", X_train.shape, y_train.shape)
print("Test data", X_test.shape, y_test.shape)
обучение тестовой выборки
from sklearn.feature_extraction.text import CountVectorizer
vect_bow = CountVectorizer(min_df=16)
X_train_bow = vect_bow.fit_transform(X_train)
X_test_bow = vect_bow.transform(X_test)
print('X_train_bow shape:', X_train_bow.shape)
print('X_test_bow shape:', X_test_bow.shape)
Векторизация - BoW
from sklearn.feature_extraction.text import TfidfVectorizer
vect_tfidf = TfidfVectorizer(min_df=16)
X_train_tfidf = vect_tfidf.fit_transform(X_train)
X_test_tfidf = vect_tfidf.transform(X_test)
print('X_train_bow shape:', X_train_tfidf.shape)
print('X_test_bow shape:', X_test_tfidf.shape)
Векторизация - TF-IDF
y_train_encoded = label_encoder.fit_transform(y_train)
y_test_encoded = label_encoder.transform(y_test)
Приведение к числовым значениям