Giter Club home page Giter Club logo

code_sample_6_20's Introduction

Ahson Saiyed Date: 5-7-2024

Overview

This project focuses on the Banana Dataset and implements a Logistic Regression model with various optimizers, including Adam, Newton's Method, Stochastic Gradient Descent, AdaGrad, RMSProp, and a Custom Stochastic Gradient Descent.

NOTE: Data Preprocessing has custom modifications which impact testing. Please refer to the ioutils.py section below for details.

Model and Optimizers

  • Model: Logistic Regression
  • Optimizers:
    • Adam
    • Newton's Method
    • Stochastic Gradient Descent
    • AdaGrad
    • RMSProp
    • Custom Stochastic Gradient Descent

Usage

Reproducing Submitted/Fitted Model

To reproduce the model chosen for submission (Logistic Regression + Adam), execute the following command:

python train.py

The fitted model file will be saved asn new_model.pkl to prevent model.pkl from being overwritten.

Running Different Model + Optimizer Pairs

To print results across different Model + Optimizer pairs (e.g., Logistic Regression + Newton's Method, Logistic Regression + Stochastic Gradient Descent, etc.), use the following command:

python train.py all

Numerical Precision Analysis

To run the numerical precision analysis and reproduce the figures in the report:

python analysis.py

The script, as is, will produce all figures with 'adam', 'rmsprop', and 'float16' for a few iterations. To reproduce the exact figures in the paper, change max_iter to 10,000 and run using the default settings.

Testing the Model

To test the performance of the fitted model, run the following command:

python test.py

Data Preprocessing

Note: If an external testing script is used to test the performance of the model, the feature engineering process described below is necessary. If the testing script in this repository is used, everything will work as expected.

The ioutils.py file has been modified to include a method called readDataPoly(degree=3), which generates polynomial features from the original feature set (or any other dataset titled 'banana_quality.csv' in the same directory).

This feature engineering is built into the train.py and test.py scripts.

Environment Setup

To set up the environment and run the scripts, follow these steps:

  1. Create a virtual environment:

    python -m venv $env_name
  2. Activate the virtual environment:

    source $env_name/bin/activate
  3. Install the required packages:

    pip install -r requirements.txt

Note: The only additional packages are tqdm and seaborn.

code_sample_6_20's People

Contributors

asaiyed10 avatar

Watchers

 avatar Kostas Georgiou 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.