Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

GFS Network

Gumbel Feature Selection Network 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.

Installation

To install the package, you can use pip:

pip install gfs_network

Usage examples

Basic usage

from gfs_network import GFSNetwork
from sklearn.datasets import load_breast_cancer

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

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

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

Performance verification

from gfs_network import GFSNetwork
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 = GFSNetwork(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 gfs_network 0.3.1

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

Source distribution (sdist)

Source distribution for gfs_network 0.3.1
File Size Uploaded
gfs_network-0.3.1.tar.gz 4.8 kB Details

Built distribution (wheel)

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

Total release size: 10.8 kB

Release files / gfs_network-0.3.1.tar.gz

Download URL gfs_network-0.3.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a0df58fa14f0464784b40829344fe501cb730c3e7b722651a89a166433920ea2
BLAKE2b-256 checksum
How to use checksums
310860287bb3bb6d89aea9fb3788e09e4a0a604a3b7c26e107ca4e9510e66f70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.9.18 Linux/5.10.0-30-amd64

Release files / gfs_network-0.3.1-py3-none-any.whl

Download URL gfs_network-0.3.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd7b1d9f2f035c17270ef7f8adfa6ccae50b33deb1855eeb8163aaa45bfea371
BLAKE2b-256 checksum
How to use checksums
c5b0193f4746bfb7750b3b98c30dbf0be2743e6b07fa347de028677ce3ce259b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.9.18 Linux/5.10.0-30-amd64
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