Skip to main content

Neighborhood Component Analysis Feature Selection

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncafs-0.2.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

ncafs-0.2.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file ncafs-0.2.1.tar.gz.

File metadata

  • Download URL: ncafs-0.2.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for ncafs-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0dcce3b4ac251b3c2e9ec8b2d5b6e0ec04dfdbdaa45f1858d0218d8e44a80fbd
MD5 47efa5789742502feb3ff4634b80f2f6
BLAKE2b-256 82cef9949eb32638bd3e5824032fa98bea0235dd6448f0942327174c3831a53c

See more details on using hashes here.

File details

Details for the file ncafs-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ncafs-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for ncafs-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0be08326cbbdd24be30a3c898c76b1ef5dc2ad5d081b2bcafc172257071fc41
MD5 72ed22ace22d2c448a300872758c14d8
BLAKE2b-256 15248dd9c46ef91999b4abfc877549f7dbcee01ed84e94ebb35ada8f32746bf6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page