Skip to main content

AutoNFS

AutoNFS is a deep learning model that can be used to select the most important features from a given dataset. The model is based on the Gumbel-Sigmoid distribution.

Adaptive balance

balance trades feature-selection aggressiveness against risk of mask collapse. Default is auto (adaptive). Pass balance="auto" to back off automatically per-dataset if 1.0 collapses or underperforms; see autonfs/adaptive.py and the HPO study report/addendum.

Installation

To install the package, you can use pip:

pip install autonfs

Usage examples

Basic usage

from autonfs import AutoNFS
from sklearn.datasets import load_breast_cancer

breast = load_breast_cancer()
X = breast.data
y = breast.target

gfs = AutoNFS()
X = gfs.fit_transform(X, y)

print(gfs.support_)
print(gfs.scores_)

Performance verification

from autonfs import AutoNFS
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import balanced_accuracy_score

DEVICE = "cpu"

breast = load_breast_cancer()
X = breast.data
y = breast.target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
clf = RandomForestClassifier(random_state=42)
clf.train(X_train, y_train)
orig_score = balanced_accuracy_score(y_test, clf.predict(X_test))

print(f"Original score: {orig_score:.3f}. Original features: {X.shape[1]}")
# Original score: 0.958. Original features: 30

gfs = AutoNFS(verbose=True, device=DEVICE)
gfs.fit(X_train, y_train)

X_transformed = gfs.transform(X_train)
X_test_transformed = gfs.transform(X_test)

clf.fit(X_transformed, y_train)
y_pred = clf.predict(X_test_transformed)
score = balanced_accuracy_score(y_test, y_pred)
logger.info(f"Score after feature selection: {score}. Selected features: {sum(gfs.support_)}")
# Score after feature selection: 0.958. Selected features: 3

Metadata

Release files for autonfs 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autonfs 1.0.0
File Size Uploaded
autonfs-1.0.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autonfs 1.0.0
File Interpreter ABI Platform
autonfs-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / autonfs-1.0.0.tar.gz

Download URL autonfs-1.0.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fef72b9047edc3408494c5ba1a9c6300ba0bbd42947b6b763a9d1969633d2b7b
BLAKE2b-256 checksum
How to use checksums
c8de459450468d32fae5943fdc1deb5716b865babbbd4f5d240249597922abc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.13.1 Darwin/24.5.0

Release files / autonfs-1.0.0-py3-none-any.whl

Download URL autonfs-1.0.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83e17effbabb9ece6fde877018a51b8a03b09bc2b9ee3e1f5b709729e9e18dc4
BLAKE2b-256 checksum
How to use checksums
1df76c00c5a91464b17bdc3bb62dfa618350e6f4407592a3ee24320a8a593712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.13.1 Darwin/24.5.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page