Fake News Detection
Getting Started Notebook for Fake News Detection Challenge
A getting started notebook with random submission for the challenge.
Getting Started Notebook for Fake News Detection Challenge¶
This notebook creates a random prediction for the test data and takes you through the workflow of how to download data and submit directly via the notebook.
Note: Create a copy of the notebook and use the copy for submission. Go to File > Save a Copy in Drive to create a new copy
In [ ]:
!pip install aicrowd-cli
%load_ext aicrowd.magic
Login to AIcrowd ㊗¶
In [ ]:
%aicrowd login
Download Dataset and Unzip¶
We will create a folder name data
and download and unzip the files there.
In [ ]:
# Downloading the Dataset
!rm -rf data
!mkdir data
%aicrowd ds dl -c fake-news-detection -o data
In [ ]:
!unzip data/train -d data/train > /dev/null
!unzip data/test -d data/test > /dev/null
Generating Random Submission ⚙️¶
Making a submission with random predictions. We will randomly select 'real' and 'fake' for the news article.
In [ ]:
# Imporitng libraries
import pandas as pd
import os
import random
random.seed(42)
In [ ]:
# Reading the testing dataset
test_dataframe = pd.read_csv(os.path.join("data", "test", "test.csv"))
test_dataframe
Out[ ]:
In [ ]:
# Adding random predictions in the test dataframe
test_dataframe['label'] = [random.choice(['fake', 'real']) for _ in range(test_dataframe.shape[0])]
test_dataframe
Out[ ]:
In [ ]:
# Saving the dataframe to csv
test_dataframe.to_csv("submission.csv", index=False)
Submitting the predictions to AIcrowd¶
We will use aicrowd cli to make submission directly via this notebook.
In [ ]:
# Submitting the Predictions
!aicrowd submission create -c fake-news-detection -f submission.csv
In [ ]:
Content
Comments
You must login before you can post a comment.