BestPromptFinder
HomeCoding › Below is an instruction that describes a task. Write a respo...

Below is an instruction that describes a task. Write a respo...

Coding · Gemini, GPT-5.6, Claude · Coding
52Quality
89%Useful
86Reliability

The prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Develop a machine learning model in Python to identify the author of a given article. ### Input: ### Output: from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import GaussianNB from sklearn.pipeline import Pipeline from sklearn.model_selection import train_test_split # load data samples = [ "sample 1 from AuthorA", "sample 2 from AuthorA", "sample 1 from AuthorB", "sample 2 from AuthorB" ] labels = [ "AuthorA", "AuthorA", "AuthorB", "AuthorB" ] # build the model model = Pipeline([ ('tfidf', TfidfVectorizer()), ('clf', GaussianNB()) ]) # train the model X_train, X_test, y_train, y_test = train_test_split(samples, labels, test_size=0.3) model.fit(X_train, y_train) # evalulate the model score = model.score(X_test, y_test) print(f'model score: {score}')
Find similar in the app →

Why this prompt

Source

Hugging Face

Related Coding prompts

PRD to MVP Technical Plan
Quality 93 · Claude Code
Full-Stack CRUD App Builder
Quality 93 · Claude Code
Legacy Refactor Planner
Quality 93 · Claude Code
Test Suite Generator
Quality 93 · Claude Code
Third-Party API Integration
Quality 93 · Claude Code
Database Schema and Migration
Quality 93 · Claude Code