Skip to content

A simple bit of code to get jax working on my M1 Mac to prepare for bigger projects

Notifications You must be signed in to change notification settings

Ikaikaalika/Jax_Jumpstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here's a README.md file for your JAX Sentiment Analysis project using markdown:

# Sentiment Analysis on Movie Reviews with JAX and Flax

This project uses JAX and Flax to perform sentiment analysis on the IMDB movie reviews dataset. We apply a Convolutional Neural Network (CNN) to classify reviews as either positive or negative.

## Table of Contents
- [Overview](#overview)
- [Setup](#setup)
- [Usage](#usage)
- [Project Structure](#project-structure)
- [Dependencies](#dependencies)
- [Dataset](#dataset)
- [Model](#model)
- [Training](#training)
- [Evaluation](#evaluation)
- [License](#license)

## Overview

Sentiment analysis is a natural language processing task where we aim to determine the sentiment expressed in text data. This project leverages the power of JAX, a high-performance numerical computing library, and Flax, its neural networks API, to build, train, and evaluate a CNN on movie reviews.

## Setup

Before running the code, ensure you have the following installed:

```bash
pip install jax jaxlib flax optax tensorflow-datasets

Usage

  1. Clone this repository:

    git clone <repository-url>
    cd jax-sentiment-analysis
  2. Run the script:

    python main.py

Project Structure

jax-sentiment-analysis/
│
├── main.py                # Main script to run the entire process
├── model.py               # Contains the CNN model definition
├── data_preprocessing.py  # Functions for data handling and preprocessing
├── utils.py               # Utility functions
└── README.md

Dependencies

  • JAX
  • Flax
  • Optax
  • TensorFlow Datasets (for loading IMDB reviews)

Dataset

We use the IMDB Reviews dataset from TensorFlow Datasets, which provides labeled movie reviews for binary classification.

Model

The model architecture consists of:

  • Embedding layer
  • 1D Convolutional layer
  • Average pooling
  • Dense layers

Training

  • Optimizer: Adam
  • Loss Function: Binary Cross-Entropy
  • Batch Size: 64
  • Epochs: 10 (configurable)

The training process involves iterating over the dataset, updating model parameters through backpropagation.

Evaluation

After training, the model's performance is evaluated on the test set, reporting the accuracy of sentiment classifications.

License

This project is open-sourced under the MIT license. See the LICENSE file for more details.


Feel free to contribute, suggest improvements, or report issues. Enjoy experimenting with JAX and Flax for NLP tasks!


This README provides a comprehensive overview of the project, including setup, usage, and structure, which should help others understand and interact with your project. Remember to replace `<repository-url>` with your actual repository URL if you decide to host this project on platforms like GitHub.

About

A simple bit of code to get jax working on my M1 Mac to prepare for bigger projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages