Skip to main content

NCAFS

Neighborhood Component Analysis Feature Selection

NCAFS is a non-parametric algorithm based on k-nearest neighbors (kNN), which learns a feature weighting vector by minimizing the expected leave-one-out error with a regularization term. NCA was originally proposed in [1], which inspired the feature selection method for classification presented in [2]. It was then extended to regression problems as well [3].

NCAFS is a Python package that implements the NCA feature selection method, for both classification and regression problems.

Instalation

pip install ncafs

Getting started

Classification

from ncafs import NCAFSC
from sklearn import datasets

X, y = datasets.make_classification(
    n_samples=1000,
    n_classes=5,
    n_features=20,
    n_informative=100,
    n_redundant=0,
    n_repeated=0,
    flip_y=0.1,
    class_sep=0.5,
    shuffle=False,
    random_state=0
)

fs_clf = NCAFSC()
fs_clf.fit(X, y)
w = fs_clf.weights_

Regression

from ncafs import NCAFSR
from sklearn import datasets

X, y, coef = datasets.make_regression(
    n_samples=1000,
    n_features=100,
    n_informative=20,
    bias=0,
    noise=1e-3,
    coef=True,
    shuffle=False,
    random_state=0
)

fs_reg = NCAFSR()
fs_reg.fit(X, y)
w = fs_reg.weights_

References

  1. Goldberger, J., Hinton, G., Roweis, S., Salakhutdinov, R. (2005). Neighbourhood Components Analysis. Advances in Neural Information Processing Systems. 17, 513-520.
  2. Yang, W., Wang, K., & Zuo, W. (2012). Neighborhood component feature selection for high-dimensional data. J. Comput., 7(1), 161-168.
  3. Amankwaa-Kyeremeh, B., Greet, C., Zanin, M., Skinner, W. and Asamoah, R. K., (2020), Selecting key predictor parameters for regression analysis using modified Neighbourhood Component Analysis (NCA) Algorithm. Proceedings of 6th UMaT Biennial International Mining and Mineral Conference, Tarkwa, Ghana, pp. 320-325.

Metadata

Release files for ncafs 0.2.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 ncafs 0.2.1
File Size Uploaded Provenance Actions
ncafs-0.2.1.tar.gz 6.0 kB Without provenance Details for ncafs-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.5 kB

Release files / ncafs-0.2.1.tar.gz

Download URL ncafs-0.2.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0dcce3b4ac251b3c2e9ec8b2d5b6e0ec04dfdbdaa45f1858d0218d8e44a80fbd
BLAKE2b-256 checksum
How to use checksums
82cef9949eb32638bd3e5824032fa98bea0235dd6448f0942327174c3831a53c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / ncafs-0.2.1-py3-none-any.whl

Download URL ncafs-0.2.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0be08326cbbdd24be30a3c898c76b1ef5dc2ad5d081b2bcafc172257071fc41
BLAKE2b-256 checksum
How to use checksums
15248dd9c46ef91999b4abfc877549f7dbcee01ed84e94ebb35ada8f32746bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Security for ncafs 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

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