Skip to content

ResponsibleAILab/fraction-generator

Repository files navigation

MNIST Fraction Generation

This repository provides a set of Python scripts that make use of the MNIST dataset to create and manipulate fractions represented by the dataset's digits.

Table of Contents

  1. Scripts Overview
  2. Dependencies
  3. Getting Started
  4. Usage

Scripts Overview

1. 1_determine_bbox_4_each_digit_in_mnist.py

This script determines the bounding box for each digit in the MNIST dataset. This is essential for aligning the digits properly when forming fractions.

2. 2_use_1_to_serve_fraction_bar.py

Utilizes the output from the first script (bounding boxes) to create a fraction bar that will be placed between the numerator and the denominator.

3. 3_create_simple_fraction_a_over_b.py

Forms a simple fraction with a single-digit numerator (a) and a single-digit denominator (b) using the MNIST digits and the fraction bar from the previous script.

4. 4_create_complex_fraction_a_over_ab.py

Constructs a complex fraction with a single-digit numerator (a) and a two-digit denominator (ab) using the MNIST digits.

5. 4_create_complex_fraction_ab_over_ab.py

Creates a complex fraction where both the numerator and the denominator have two digits (ab/ab) using the MNIST digits.

Dependencies

  • Python 3.x
  • Libraries:
    • Numpy
    • Matplotlib
    • (any other libraries required by the code, e.g., TensorFlow or PyTorch if using them for MNIST)

Getting Started

  1. Clone this repository:
git clone https://github.com/ResponsibleAILab/fraction-generator
  1. Install the required dependencies:
pip install numpy matplotlib(other libraries)

Usage

To use any of the scripts, navigate to the script directory and run them as follows:

  1. Determine bounding boxes:
python 1_determine_bbox_4_each_digit_in_mnist.py
  1. Create the fraction bar:
python 2_use_1_to_serve_fraction_bar.py
  1. Generate a simple fraction:
python 3_create_simple_fraction_a_over_b.py
  1. Generate a complex fraction with a single-digit numerator:
python 4_create_complex_fraction_a_over_ab.py
  1. Generate a complex fraction with two-digit numerator and denominator:
python 4_create_complex_fraction_ab_over_ab.py

Feel free to modify the scripts or use them as part of larger projects. If you encounter any issues or have suggestions for improvements, please open an issue on this repository.

About

Use MNIST dataset to generate handwritten fractions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages