<jupyter_start><jupyter_text><jupyter_code>import numpy as np
import pandas as pd
import seaborn as sns

from google.colab import files
uploaded = files.upload()
data = pd.read_csv('data.csv')
data.head()
data=data.drop(['URLs'],axis=1)
data = data.dropna()
data.head()
X = data.iloc[:,:-1].values
y = data.iloc[:,-1].values
y[0]
from sklearn.feature_extraction.text import CountVectorizer
cv = CountVectorizer(max_features=5000)
mat_body = cv.fit_transform(X[:,1]).todense()

cv_head = CountVectorizer(max_features=5000)
mat_head = cv_head.fit_transform(X[:,0]).todense()

X_mat = np.hstack((mat_head,mat_body))
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X_mat, y, test_size=0.2, random_state=0)
from sklearn.tree import DecisionTreeClassifier
dtc = DecisionTreeClassifier(criterion = 'entropy')
dtc.fit(X_train, y_train)
pred = dtc.predict(X_test)

from sklearn.metrics import accuracy_score
accuracy_score(y_test, pred)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1301775147928994, 'fraction_numerical': 0.016765285996055226, 'mean_word_length': 7.601694915254237, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '394963', 'license': 'MIT', 'n_tokens_mistral': 388, 'n_tokens_neox': 380, 'n_words': 73, 'path': 'NLP Fake News Detection/fake_news_detection.ipynb', 'repo_name': 'Zulfa-Varvani/ML-things', 'size': '1014'}