# prediction system
# content = input("Enter your text: ")
# Access the text content instead of the csr_matrix element
text_content = X_train[20].toarray()[0]
# Assuming X_train contains text data; if not, adjust accordingly.
# Convert to a regular Python string if needed:
text_content = " ".join([str(element) for element in text_content if element != 0])
processed_content = preprocess_and_translate(text_content)
print("Processed content (English):", processed_content)
vectorizer = TfidfVectorizer()
vectorizer.fit_transform([processed_content])
input_data = vectorizer.transform([processed_content])
prediction = model.predict(input_data)
if prediction[0] == 1:
print('Fake news')
else:
print('Real news')
Подробнее здесь: https://stackoverflow.com/questions/790 ... 28-feature
ValueError: X имеет 14 функций, но LogisticReгрессия ожидает 17128 функций в качестве входных данных. ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
ValueError: x имеет 7 функций, но Collontransformer ожидает 13 функций
Anonymous » » в форуме Python - 0 Ответы
- 20 Просмотры
-
Последнее сообщение Anonymous
-
-
-
ValueError: x имеет 7 функций, но Collontransformer ожидает 13 функций
Anonymous » » в форуме Python - 0 Ответы
- 14 Просмотры
-
Последнее сообщение Anonymous
-
-
-
ValueError: x имеет 7 функций, но Collontransformer ожидает 13 функций
Anonymous » » в форуме Python - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-