TypeError at /predict/ predict_view() missing 2 required positional arguments: 'user_skills' и 'project_skills'
def predict_view(request, user_skills, project_skills):
# Fetch data from the database
freelancer_data = freelancer_info.objects.get(skills=user_skills)
freelancer_data.save()
project_data = project_info.objects.get(required_skills=project_skills)
project_data.save()
# Convert data to DataFrame
freelancer_df = pd.DataFrame(list(freelancer_data))
project_df = pd.DataFrame(list(project_data))
# Add labels
freelancer_df['label'] = 'freelancer'
project_df['label'] = 'project'
# Combine data
combined_df = pd.concat([freelancer_df, project_df])
combined_df.columns = ['text', 'label']
# Feature extraction
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(combined_df['text'])
y = combined_df['label']
# Split the data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
# Train the Naive Bayes model
model = MultinomialNB()
model.fit(X_train, y_train)
# Make predictions
y_pred = model.predict(X_test)
# Evaluate the model
accuracy = accuracy_score(y_test, y_pred)
report = classification_report(y_test, y_pred)
# Render the results
context = {
'accuracy': accuracy,
'report': report,
}
return render(request, 'frontend/predict.html', context)
Это мой код для составления прогноза с использованием алгоритма наивного байеса, но я получаю.
TypeError at /predict/
predict_view() missing 2 required positional arguments: 'user_skills' and 'project_skills'
Как мне преодолеть эту проблему?