Coder Social home page Coder Social logo

huggingface-dataset-toolkit's Introduction

Huggingface (and UCI or local) Dataset Toolkit

Overview

This repository contains a Python script that automates the process of downloading, cleaning, and saving datasets from multiple sources including Huggingface, the UCI Machine Learning Repository, and local dataset files.

The toolkit supports various data preprocessing functionalities such as encoding, normalization, standardization, handling missing data, automatic class balancing, and image resizing.

Features

  • Multiple Data Sources: Download datasets from Huggingface, UCI ML Repository, or use local dataset files.
  • Local Dataset Compatibility: Load datasets directly from local storage, supporting various file formats such as CSV, Excel, Parquet, and more.
  • Multiple Data Types: Handle both tabular and image datasets, including complex operations such as image resizing and flattening.
  • Data Encoding: Apply one-hot encoding and ordinal encoding to categorical variables.
  • Data Scaling: Options for standardizing or normalizing numerical features.
  • Missing Data Handling: Strategies include dropping, filling, or imputing missing values.
  • Data Transformation: Convert float columns to integers where applicable.
  • Stratified Sampling: Reduce dataset size while preserving the distribution of target variables.
  • Class Balancing: Automatically balance classes using random oversampling.
  • Image Resizing: Resize images to specified target widths, maintaining aspect ratio and converting to tabular format.

Installation

Install the necessary dependencies using:

pip install -r requirements.txt

Usage

Here's how you can import and use the tool to download and pre-process a dataset:

from prepare_data import process_and_store_dataset

# Download and preprocess dataset from Huggingface
dataset = process_and_store_dataset(name="hitorilabs/iris")

# Download and preprocess dataset from UCI
uci_dataset = process_and_store_dataset(
    name="53",  # ID for the Iris dataset
    source='uci'
)

# Load and preprocess local dataset
local_dataset = process_and_store_dataset(
    name='data/local_dataset.csv',
    source='local',
    verbose=True
)

# Download, resize images, and preprocess dataset from Huggingface
image_dataset = process_and_store_dataset(
    name='fashion_mnist',
    source='huggingface',
    target_image_width=28,  # Resize to 28x28
    verbose=True
)

Contributions

Feel free to contribute to this project by submitting pull requests or suggesting new enhancements through the issues tab.

License

This project is open-source and available under the MIT License.

huggingface-dataset-toolkit's People

Contributors

knakamura13 avatar

Stargazers

Isham Rashik avatar Nikhil Kapila avatar  avatar Scal avatar Stefan Faulkner avatar Jay Ess avatar Taran Lau avatar Thomas Bowlin avatar Vinay avatar  avatar Farmehr avatar Tarun Kumar avatar Darius avatar Sean-Shuaiqi avatar

Watchers

 avatar

huggingface-dataset-toolkit's Issues

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.