Giter VIP home page Giter VIP logo

hyperfast's Introduction

HyperFast : Instant Classification for Tabular Data

HyperFast is a hypernetwork designed for fast classification of tabular data, capable of scaling to large datasets. Utilizing a meta-trained hypernetwork, HyperFast generates a dataset-specific target network in a single forward pass, eliminating the need for time-consuming model training.

Installation

โ— Install the new release:

HyperFast can be installed from PyPI using

pip install hyperfast==1.0.2

This package contains example code to run HyperFast. Ensure that you are using Python 3.9 or later to run this project. When using HyperFast for the first time, the model weights will be downloaded automatically. The model weights are also available here.

Usage

Here's a quick example on how to use HyperFast's scikit-learn-like interface:

import torch
import numpy as np
from hyperfast import HyperFastClassifier
from sklearn.metrics import accuracy_score

# Load your dataset
X_train, y_train = np.load("data/hapmap1_X_train.npy"), np.load( "data/hapmap1_y_train.npy")
X_test, y_test = np.load("data/hapmap1_X_test.npy"), np.load("data/hapmap1_y_test.npy")

# Set the device
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

# Initialize HyperFast
model = HyperFastClassifier(device=device)

# Generate a target network and make predictions
model.fit(X_train, y_train)
predictions = model.predict(X_test)

accuracy = accuracy_score(y_test, predictions)
print(f"Accuracy: {accuracy * 100:.2f}%")

Warning:

  • Set cat_features as the list of indices of the categorical features in the dataset (if any), now in __init__.
  • The current default hyperparameters provide medium speed-accuracy performance.
  • ๐Ÿš€ For the fastest inference (but less accurate) set n_ensemble=1 and optimization=None.
  • ๐Ÿ“Š If you are dealing with an imbalanced dataset, consider setting stratify_sampling=True with n_ensemble > 1.
  • ๐ŸŒ If you are dealing with a very high-dimensional dataset (e.g., >3000 features), consider setting feature_bagging=True with n_ensemble > 1.
  • ๐Ÿ‘Œ For slower but most accurate predictions, optimize the inference parameters of HyperFast for each dataset. In this case, we recommend the following search space:
param_grid = {
    'n_ensemble': [1, 4, 8, 16, 32],
    'batch_size': [1024, 2048],
    'nn_bias': [True, False],
    'stratify_sampling': [True, False],
    'optimization': [None, 'optimize', 'ensemble_optimize'],
    'optimize_steps': [1, 4, 8, 16, 32, 64, 128],
    'seed': list(range(10))
}

License

This project is under the CC BY-NC 4.0 license. See LICENSE for details.

Cite us

If you use HyperFast in your research, please cite our paper:

@inproceedings{bonet2024hyperfast,
  title={HyperFast: Instant Classification for Tabular Data},
  author={Bonet, David and Montserrat, Daniel Mas and Gir{\'o}-i-Nieto, Xavier and Ioannidis, Alexander},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  year={2024}
}

hyperfast's People

Contributors

davidbonet avatar amueller avatar dmasmont avatar lennartpurucker 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.