kescardoso / datasetbucket

A dataset bucket with a machine learning bias auditor. Built with Python-Flask, MaterializeCSS and the Kaggle API.

Home Page:https://datasetbucket.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DATASET BUCKET & BIAS AUDITOR

label

Check out our project on Heroku!

About

A dataset bucket and a machine learning bias auditor πŸ“ˆ, fully responsive web-app built on Python, with Flask, the MaterializeCSS UI grid system and the Kaggle API.

Based on a CRUD (Create, Read, Update and Delete) data-base system to generate, store and display dataset structures.

You will be able to find and read reports from a wiki styled list of information about data containing population and demographic subjects.

πŸ‘© πŸ‘³πŸΎβ€β™‚οΈ πŸ‘±πŸ»β€β™€οΈ πŸ§”πŸΎ πŸ‘©πŸΌβ€πŸ¦° πŸ‘¨πŸΏβ€πŸ¦³

Motivation

The whole world is data-driven.

However, data can often be misleading, inaccurate, or unrepresentative. When this biased data used in analytics or ML models, it not only produces inaccurate results, but also results in disastrous implications for minority groups and classes.

To confront this dangerous problem, we built a web app that analyzes a dataset for bias, and also suggests possible changes you can make to improve the quality of your dataset. πŸ“Š

Technologies used

  • MongoDB - a document database (stores data in JSON-like documents) with a horizontal, scale-out architecture that can support huge volumes of both data and traffic.
  • Materialize - a modern front-end framework (responsive and mobile-first, similar to Bootstrap) that helps developers build a stylish and responsive application.
  • Python - an interpreted, high-level and general-purpose programming language, great for data base structured projects.
  • Pip - a package manager for Python, that allows developers to install and manage additional libraries and dependencies that are not distributed as part of the standard library.
  • Flask - a Python framework that depends on the Jinja template engine and the Werkzeug WSGI toolkit.
  • Heroku - used for the app deployment, Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.
  • Git - a version control system for for source code management; it allows tracking file changes and coordinating work on those files among multiple people and machines.
  • GitHub - a open-source code hosting platform for version control and collaboration. It lets developers work remotely and together on projects from anywhere.
We used a lot of python libraries for building this project. Know more about them from LIBRARIES.md.

App Walkthrough

responsive

1. OPEN THE APP

Head on to our app deployed on Heroku.

image

You will see a WELCOME screen, it has the same basic instructions to get started and what you can expect from the app.

2. DATATAGS

In the data tags tab, you can find various tags associated with the reports uploaded on the app.

image

By clicking the view button on any of the available tags, you can see the dataset, analytical reports, and other information about the TAG.

image

3. DATASETS

The datasets tab has the list of all the datasets, to which an analytical report was generated. It is presented in the form of an accordion collapsable styled list, so you can click on any dataset you wish to explore and all the information related to that particular dataset will be displayed.

image

You can view the author, the development status, tags associated, and an option to download the analytical report.

4. REGISTER / LOG IN

Using the register tab you will land on the registration page, where you can create an account on this app.

image

If you are already a user of our app, head on the log in page.

πŸ’Ÿ By being a registered user of our app, you will have access to upload new datasets to the app and generate reports for those.

5. ANALYSE

After logging into the app go to the * analyze* tab. You will see a menu to enter the kaggle URL. After adding a valid Kaggle dataset URL. Click on GET ANALYSIS REPORT.

image

Currently we are only accepting .json, .csv, .png, .jpeg and .jpg files for ananlysis.

You will see a progress bar till the report gets generated. Once it stops, the report gets downloaded automatically by the name of report.pdf.

IMAGES: .png, .jpeg, .jpg

image

CSV FILES: .csv

image

It would have all the details related to your dataset and what all improvements are possible.

πŸ“© Project Installation and Local Deployment

Prerequisites

Install python3 and pip3 in your machine

Create an account on Kaggle

Installation

  1. Download or clone this project into your local workspace

  2. Create a virtual environment using the command: Python3 -m venv venv

    After running this command, the folders will be automatically set up on your workspace.

  3. Activate your python interpretor using the command:

    source venv/bin/activate : mac

    .\venv\Scripts\activate : windows

  4. Install Flask using the command:

    pip3 install Flask

    and all the required dependencies with:

    pip3 install -r requirements.txt

Local Deployment

  1. Create an env.py file to keep your sensitive data secret.

  2. Open env.py and enter the following:

    import os
    
    os.environ.setdefault("SECRET_KEY", "secret_key_here")
    os.environ.setdefault("MONGO_URI", "value_from mongoDB_here")
    os.environ.setdefault("MONGO_DBNAME", "value_from mongoDB_here")
  3. Wire up Kaggle

    Kaggle API allows the developer to download datasets directly from the terminal.

    1. Make sure you have a kaggle account

    2. Follow these steps to download kaggle.json files, which helps to run the API:

      • Go to the Account tab in your Kaggle profile and scroll to the API section.

      • Click Create new API Token. This will download the kaggle.json file, add it to the /.kaggle path.

      For more complete and detailed instructions on how to use the Kaggle API, visit Kaggle's documentation.

      If you are on macOS/linux, and you need help getting to your ~/.kaggle/ folder, follow these instructions: Kaggle installation on macOS/Linux

  4. Wire up MongoDB and its functionalities with Flask, by installing flask-pymongo and dnspython. Use:

     `pip3 install flask-pymongo`
    
     `pip3 install dnspython`
    
  5. Run the app.py in debug mode as a flask application or use the following command:

     `python3 -m flask run`
    
     to see the project in your locally deployed `http` address.
    

Heroku Deployment

  1. Fulfil all Heroku requirements by chequing and freezing your dependencies and by creating a Procfile:

    You can run these two commands to fulfill the purpose:

    pip3 freeze > requirements.txt

    echo web: python app.py > Procfile

You may need to install gunicorn. For a good tutorial, check this youtube tutorial

Commit and push your changes.

  1. Create a new app from your Heroku dashboard.

  2. Add your environmental variables to Heroku, by going to Settings, and then to Config Vars, and enter the sensitive information from your MongoDB and your env.py file:

    import os
    
    os.environ.setdefault("SECRET_KEY", "your_secret_key_here")
    os.environ.setdefault("MONGO_URI", "value_from mongoDB_here")
    os.environ.setdefault("MONGO_DBNAME", "value_from mongoDB_here")
    
  3. From your Heroku dashboard, wire up your Heroku app to your git repository, by going to:

    • Deploy > Deployment Method > click: Connect to GitHub

    • Search your repo from the dropdown, and connect

    • Choose a branch to deploy your changes

    • Deploy your branch and view the app

References

πŸ”Έ If you want to test run the project on your local computer, follow the guidelines in installation guide.

πŸ”Έ If you wish to contribute to the existing project, follow the guidelines in CONTRIBUTION.md.

Challenges

  • Encountering bugs when deploying on Heroku
  • Accounting for different formatting of different datasets and types of files (JSON and CSV)
  • Ensuring that the app works for both macOS and Windows
  • Learning about lots of new technologies and languages for our team, including Python, Flask, HTML, CSS, Javascript, Matplot, file parsing, and data analysis
  • Working in different time zones

Lessons / Takeaways

  • Plan more in advance instead of diving into code headfirst
  • Deploy on Heroku earlier
  • Spend less time getting program to run on different files, but do more analysis for one specific file

Accomplishments / Contributions

  • Overall, we are proud to have completed a tough project and develop a functional web app that effectively parses files, handles multiple types of datasets, and generates PDFs!
  • What are we proud to accomplish / what did we work on?
    • "Gaining a better understanding of Python, and having a first real dive in data analytics β€” it changed how I see machine learning forver!" -Kes
    • "Learning to use python better and parsing with pandas database, integrating back + front end, and deploying on heroku!" -Elizabeth
    • "Working with images and extracting useful info out of it to generate reports!" -Sakshi
    • "Parsing files, generating histograms, and connecting the analysis to the PDFs was super exciting for me!" -Will

Next Steps

  • Implement more advanced metrics and recommendations for dataset analysis
  • Allow users to upload their own datasets in addition to datasets on kaggle
  • Work on getting more files accepted, like .txt, etc

Contributors

⭐Elizabeth Crouther

⭐Kes Cardoso

⭐Sakshi Gupta

⭐William Yang

Navigate

➑ CONTRIBUTION.md

➑ LIBRARIES.md

License

MIT LICENSE 2021

Thank You! ✨

About

A dataset bucket with a machine learning bias auditor. Built with Python-Flask, MaterializeCSS and the Kaggle API.

https://datasetbucket.herokuapp.com

License:MIT License


Languages

Language:Python 53.4%Language:HTML 43.8%Language:CSS 1.9%Language:JavaScript 0.9%