24 Hr AI Challenge: Build AI Fake News Detector

share link

by kandikits dot icon Updated: Aug 21, 2023

technology logo
technology logo

1-Click Kit 1-Click Kit  


AI fake news detector helps detect fake news through binary classification methods. It builds better experiences by controlling the disinformation flow.


It's built on top of various powerful machine learning libraries. The tool works by training a neural network to spot fake articles based on their text content. When you run your own data through the tool, it gives you back a list of articles that it thinks are likely to be fake. You can then train the model further or decide if those results are acceptable or not. In addition to identifying fake news, this model can also be trained to identify real news. This allows you to compare the model's performance across different domains (e.g., politics vs. sports). The following installer and deployment instructions will walk you through the steps of creating an AI fake news detector by using fakenews-detection, jupyter, vscode, and pandas.


We will use fake news detection libraries (having fully modifiable source code) to customize and build a simple classifier that can detect fake news articles. kandi kit provides you with a fully deployable AI Fake News Detector. Source code included so that you can customize it for your requirement. With this kit, you can 1. Use a pre-trained model for detecting fake news. 2. Train the model on your custom dataset. 3. Expose the fake news detection as an API Add-on on examples are also included as given below 1. Use web scraper to automatically make your training dataset. 2. Visualise training and prediction data for useful insights.

Training and Certification - How to build fake news detection using machine learning

Watch this self-guided tutorial on how you can use training data, NLP pipeline, TF-IDF vectorizer, and text classifier to build your own AI fake new detector.

Completed the training? Apply for your Participation Certificate and Achievement Certificate now! Apply for Certification Tag us on social media with a screenshot or video of your working application for a chance to be featured as an Open Source Champion and get a verified badge.

Deployment Information

Fake News Predictor created using this kit are added in this section. The entire solution is available as a package to download from the source code repository.


For Windows OS, Download, extract and double-click the kit installer file to install the kit. Note: Do ensure to extract the zip file before running it. The installation may take from 2 to 10 minutes based on bandwidth.

1. When you're prompted during the installation of the kit, press Y to launch the app automatically and execute cells in the notebook by selecting Cell --> Run All from Menu bar

2. To run the app manually, press N when you're prompted and locate the zip file 'kit_installer.zip'

3. Extract the zip file and navigate to the directory 'fake-news-detection-main'

4. Open command prompt in the extracted directory 'fake-news-detection' and run the command 'jupyter notebook'


For other Operating System,

1. install python

2. download the repository

3. Extract the zip file and navigate to the directory 'fakenews-detection-main'

4. Open terminal in the extracted directory 'fakenews-detection-main'

5. Install dependencies by executing the command 'pip install -r requirements.txt'

6. Run the command ‘jupyter notebook’ and select the notebook ‘FakeNewsdetection-starter.ipynb’ on the browser window.

Instructions to Run

Follow the below instructions to run the solution. 1. Locate and open the FakeNewsDetection-starter.ipynb notebook from the Jupyter Notebook browser window. 2. Execute cells in the notebook by selecting Cell --> Run All from Menu bar 3. Once all the cells of the notebook are executed, the prediction result will be written to the file 'fake_news_test_output.csv' Training with your dataset: 1. Add news articles to a csv file under a column name 'news_text'. 2. Add corresponding labels as 'real' or 'fake' denoting whether a news article is real or not. 3. You can refer to the file 'fake_news_train.csv' for an example. 4. Set the variable for training file in the notebook under Variables section. Testing with your dataset: 1. Add news articles to a csv file under a column name 'news_text'. 2. You can refer to the file 'fake_news_test.csv' for an example. 3. Set the variable for testing file in the notebook under Variables section. You can execute the cells of notebook by selecting Cell from the menu bar. For any support, you can reach us at FAQ & Support

Kit Solution Source

fakenews-detectionby kandikits

Jupyter Notebook doticonstar image 0 doticonVersion:v1.0.0doticon
License: Permissive (Apache-2.0)

Fake News detection in news articles

Support
    Quality
      Security
        License
          Reuse

            fakenews-detectionby kandikits

            Jupyter Notebook doticon star image 0 doticonVersion:v1.0.0doticon License: Permissive (Apache-2.0)

            Fake News detection in news articles
            Support
              Quality
                Security
                  License
                    Reuse

                      Libraries useful for this solution

                      Development Environment

                      VSCode and Jupyter Notebook are used for development and debugging. Jupyter Notebook is a web based interactive environment often used for experiments, whereas VSCode is used to get a typical experience of IDE for developers. Jupyter Notebook is used for our development.

                      vscodeby microsoft

                      TypeScript doticonstar image 147328 doticonVersion:1.79.2doticon
                      License: Permissive (MIT)

                      Visual Studio Code

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                vscodeby microsoft

                                TypeScript doticon star image 147328 doticonVersion:1.79.2doticon License: Permissive (MIT)

                                Visual Studio Code
                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse

                                          notebookby jupyter

                                          Jupyter Notebook doticonstar image 10204 doticonVersion:v7.0.0b4doticon
                                          License: Permissive (BSD-3-Clause)

                                          Jupyter Interactive Notebook

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    notebookby jupyter

                                                    Jupyter Notebook doticon star image 10204 doticonVersion:v7.0.0b4doticon License: Permissive (BSD-3-Clause)

                                                    Jupyter Interactive Notebook
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              Exploratory Data Analysis

                                                              For extensive analysis and exploration of data, and to deal with arrays, these libraries are used. They are also used for performing scientific computation and data manipulation.

                                                              numpyby numpy

                                                              Python doticonstar image 23755 doticonVersion:v1.25.0rc1doticon
                                                              License: Permissive (BSD-3-Clause)

                                                              The fundamental package for scientific computing with Python.

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        numpyby numpy

                                                                        Python doticon star image 23755 doticonVersion:v1.25.0rc1doticon License: Permissive (BSD-3-Clause)

                                                                        The fundamental package for scientific computing with Python.
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  pandasby pandas-dev

                                                                                  Python doticonstar image 38689 doticonVersion:v2.0.2doticon
                                                                                  License: Permissive (BSD-3-Clause)

                                                                                  Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            pandasby pandas-dev

                                                                                            Python doticon star image 38689 doticonVersion:v2.0.2doticon License: Permissive (BSD-3-Clause)

                                                                                            Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      Text mining

                                                                                                      Libraries in this group are used for analysis and processing of unstructured natural language. The data, as in its original form aren't used as it has to go through processing pipeline to become suitable for applying machine learning techniques and algorithms.

                                                                                                      nltkby nltk

                                                                                                      Python doticonstar image 12020 doticonVersion:Currentdoticon
                                                                                                      License: Permissive (Apache-2.0)

                                                                                                      NLTK Source

                                                                                                      Support
                                                                                                        Quality
                                                                                                          Security
                                                                                                            License
                                                                                                              Reuse

                                                                                                                nltkby nltk

                                                                                                                Python doticon star image 12020 doticonVersion:Currentdoticon License: Permissive (Apache-2.0)

                                                                                                                NLTK Source
                                                                                                                Support
                                                                                                                  Quality
                                                                                                                    Security
                                                                                                                      License
                                                                                                                        Reuse

                                                                                                                          spaCyby explosion

                                                                                                                          Python doticonstar image 26383 doticonVersion:v3.2.6doticon
                                                                                                                          License: Permissive (MIT)

                                                                                                                          💫 Industrial-strength Natural Language Processing (NLP) in Python

                                                                                                                          Support
                                                                                                                            Quality
                                                                                                                              Security
                                                                                                                                License
                                                                                                                                  Reuse

                                                                                                                                    spaCyby explosion

                                                                                                                                    Python doticon star image 26383 doticonVersion:v3.2.6doticon License: Permissive (MIT)

                                                                                                                                    💫 Industrial-strength Natural Language Processing (NLP) in Python
                                                                                                                                    Support
                                                                                                                                      Quality
                                                                                                                                        Security
                                                                                                                                          License
                                                                                                                                            Reuse

                                                                                                                                              py-lingualyticsby lingualytics

                                                                                                                                              Python doticonstar image 32 doticonVersion:Currentdoticon
                                                                                                                                              License: Permissive (MIT)

                                                                                                                                              A text analytics library with support for codemixed data

                                                                                                                                              Support
                                                                                                                                                Quality
                                                                                                                                                  Security
                                                                                                                                                    License
                                                                                                                                                      Reuse

                                                                                                                                                        py-lingualyticsby lingualytics

                                                                                                                                                        Python doticon star image 32 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                                                                                                        A text analytics library with support for codemixed data
                                                                                                                                                        Support
                                                                                                                                                          Quality
                                                                                                                                                            Security
                                                                                                                                                              License
                                                                                                                                                                Reuse

                                                                                                                                                                  Machine Learning

                                                                                                                                                                  Machine learning libraries and frameworks here are helpful in providing state-of-the-art solutions using Machine learning.

                                                                                                                                                                  scikit-learnby scikit-learn

                                                                                                                                                                  Python doticonstar image 54584 doticonVersion:1.2.2doticon
                                                                                                                                                                  License: Permissive (BSD-3-Clause)

                                                                                                                                                                  scikit-learn: machine learning in Python

                                                                                                                                                                  Support
                                                                                                                                                                    Quality
                                                                                                                                                                      Security
                                                                                                                                                                        License
                                                                                                                                                                          Reuse

                                                                                                                                                                            scikit-learnby scikit-learn

                                                                                                                                                                            Python doticon star image 54584 doticonVersion:1.2.2doticon License: Permissive (BSD-3-Clause)

                                                                                                                                                                            scikit-learn: machine learning in Python
                                                                                                                                                                            Support
                                                                                                                                                                              Quality
                                                                                                                                                                                Security
                                                                                                                                                                                  License
                                                                                                                                                                                    Reuse

                                                                                                                                                                                      faissby facebookresearch

                                                                                                                                                                                      C++ doticonstar image 22571 doticonVersion:v1.7.4doticon
                                                                                                                                                                                      License: Permissive (MIT)

                                                                                                                                                                                      A library for efficient similarity search and clustering of dense vectors.

                                                                                                                                                                                      Support
                                                                                                                                                                                        Quality
                                                                                                                                                                                          Security
                                                                                                                                                                                            License
                                                                                                                                                                                              Reuse

                                                                                                                                                                                                faissby facebookresearch

                                                                                                                                                                                                C++ doticon star image 22571 doticonVersion:v1.7.4doticon License: Permissive (MIT)

                                                                                                                                                                                                A library for efficient similarity search and clustering of dense vectors.
                                                                                                                                                                                                Support
                                                                                                                                                                                                  Quality
                                                                                                                                                                                                    Security
                                                                                                                                                                                                      License
                                                                                                                                                                                                        Reuse
                                                                                                                                                                                                          Python doticonstar image 10938 doticonVersion:v2.2.2doticon
                                                                                                                                                                                                          License: Permissive (Apache-2.0)

                                                                                                                                                                                                          Multilingual Sentence & Image Embeddings with BERT

                                                                                                                                                                                                          Support
                                                                                                                                                                                                            Quality
                                                                                                                                                                                                              Security
                                                                                                                                                                                                                License
                                                                                                                                                                                                                  Reuse

                                                                                                                                                                                                                    sentence-transformersby UKPLab

                                                                                                                                                                                                                    Python doticon star image 10938 doticonVersion:v2.2.2doticon License: Permissive (Apache-2.0)

                                                                                                                                                                                                                    Multilingual Sentence & Image Embeddings with BERT
                                                                                                                                                                                                                    Support
                                                                                                                                                                                                                      Quality
                                                                                                                                                                                                                        Security
                                                                                                                                                                                                                          License
                                                                                                                                                                                                                            Reuse

                                                                                                                                                                                                                              Data Visualization

                                                                                                                                                                                                                              The patterns and relationships are identified by representing data visually and below libraries are used for generating visual plots of the data.

                                                                                                                                                                                                                              seabornby mwaskom

                                                                                                                                                                                                                              Python doticonstar image 10797 doticonVersion:v0.12.2doticon
                                                                                                                                                                                                                              License: Permissive (BSD-3-Clause)

                                                                                                                                                                                                                              Statistical data visualization in Python

                                                                                                                                                                                                                              Support
                                                                                                                                                                                                                                Quality
                                                                                                                                                                                                                                  Security
                                                                                                                                                                                                                                    License
                                                                                                                                                                                                                                      Reuse

                                                                                                                                                                                                                                        seabornby mwaskom

                                                                                                                                                                                                                                        Python doticon star image 10797 doticonVersion:v0.12.2doticon License: Permissive (BSD-3-Clause)

                                                                                                                                                                                                                                        Statistical data visualization in Python
                                                                                                                                                                                                                                        Support
                                                                                                                                                                                                                                          Quality
                                                                                                                                                                                                                                            Security
                                                                                                                                                                                                                                              License
                                                                                                                                                                                                                                                Reuse

                                                                                                                                                                                                                                                  matplotlibby matplotlib

                                                                                                                                                                                                                                                  Python doticonstar image 17559 doticonVersion:v3.7.1doticon
                                                                                                                                                                                                                                                  no licences License: No License (null)

                                                                                                                                                                                                                                                  matplotlib: plotting with Python

                                                                                                                                                                                                                                                  Support
                                                                                                                                                                                                                                                    Quality
                                                                                                                                                                                                                                                      Security
                                                                                                                                                                                                                                                        License
                                                                                                                                                                                                                                                          Reuse

                                                                                                                                                                                                                                                            matplotlibby matplotlib

                                                                                                                                                                                                                                                            Python doticon star image 17559 doticonVersion:v3.7.1doticonno licences License: No License

                                                                                                                                                                                                                                                            matplotlib: plotting with Python
                                                                                                                                                                                                                                                            Support
                                                                                                                                                                                                                                                              Quality
                                                                                                                                                                                                                                                                Security
                                                                                                                                                                                                                                                                  License
                                                                                                                                                                                                                                                                    Reuse

                                                                                                                                                                                                                                                                      Troubleshooting

                                                                                                                                                                                                                                                                      1. If you encounter any error related to MS Visual C++, please install MS Visual Build tools 2. While running batch file, if you encounter Windows protection alert, select More info --> Run anyway. 3. During kit installer, if you encounter Windows security alert, click Allow. 4. If you encounter Memory Error, check if the available memory is sufficient and it is proportion to the size of the data being used. For our dataset, the minimum required memory is 8GB. If your computer doesn't support standard commands from windows 10, you can follow the instructions below to finish the kit installation. 1. Click here to install python 2. Click here to download the repository 3. Extract the zip file and navigate to the directory 'fakenews-detection-main' 4. Open terminal in the extracted directory 'fakenews-detection-main' 5. Install dependencies by executing the command 'pip install -r requirements.txt' 6. Run the command ‘jupyter notebook’ and select the notebook ‘FakeNewsdetection-starter.ipynb’ on the browser window.

                                                                                                                                                                                                                                                                      Support

                                                                                                                                                                                                                                                                      For any support, you can reach us at FAQ & Support

                                                                                                                                                                                                                                                                      See similar Kits and Libraries