Giter Club home page Giter Club logo

openx-assignment's Introduction

OpenX Internship Assignment

Assignment summary

  1. Load the Covertype Data Set from the UCI Machine Learning Repository.

  2. Implement a simple heuristic for classifying the data.

  3. Train two baseline machine learning models using the Scikit-learn library.

  4. Train a neural network using the TensorFlow library, and create a function to find the best set of hyperparameters.

  5. Evaluate the performance of the heuristic, baseline models, and neural network, and choose appropriate metrics and plots for comparison.

  6. Create a REST API that serves the trained models and allows users to choose a model and input features for prediction.

Installation

Make sure to have the latest pip version installed.

pip install --upgrade pip
pip install -r requirements.txt 

Usage

python main.py 
curl -X POST -H "Content-Type: application/json" -d '{"model": "neural_network", "features": [2804,139,9,268,65,3180,234,238,135,6121,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}' http://localhost:5000/predict

Where the model can be one of the following: heuristic, tree, neural_network, logistic_regression.

Evaluation

  • Heuristic

    The heuristic model is a simple model that predicts the most common class in the training set. The accuracy of the model is 9%. Screenshot

    As we can see performance of the heuristic model is very bad. We could get almost 50% accuracy by simply predicting the most common class in the training set, because the majority of the classes are of type 2.

  • Tree

    The tree model is a decision tree classifier with a maximum depth of 3. The accuracy of the model is 68%. Screenshot

  • Logistic Regression

    The logistic regression model is a logistic regression classifier with a maximum number of iterations of 100. The accuracy of the model is 72%. Screenshot

  • Neural Network

    The neural network model is a neural network classifier trained for 70 epochs. The accuracy of the model is 94%. Screenshot

    The best set of hyperparameters for the neural network model is:

    Dropout Activation Kernel Initializer Learning Rate Batch Size
    0.2 relu lecun_uniform 0.005 512

    Learning curves for the neural network model with the best set of hyperparameters: Screenshot

    Screenshot

    As we can see, the neural network learns relatively fast and the validation accuracy is starting to flatten out. Validation accuaracy is very close to the training accuracy, which means that the model is not overfitting. The model is not underfitting either, because the training accuracy is high, I suppose we could train this model for more epochs and get even better results.

openx-assignment's People

Contributors

bartoszpiechnik25 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.