The document outlines a Python script for training a Naive Bayes classifier using a dataset loaded from a CSV file. It processes text data from the 'Title' column to predict the 'Type' column, splitting the data into training and testing sets. The script evaluates the model's performance using a classification report and accuracy score.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
9 views
Clp
The document outlines a Python script for training a Naive Bayes classifier using a dataset loaded from a CSV file. It processes text data from the 'Title' column to predict the 'Type' column, splitting the data into training and testing sets. The script evaluates the model's performance using a classification report and accuracy score.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import classification_report, accuracy_score
# Load the dataset
file_path = 'dataset.csv' # Adjust the path as needed dataset = pd.read_csv('/dataset.csv')