FaissImputer
[!WARNING] Maintenance notice: FaissImputer 0.1.x has a known neighbor-mapping bug that can produce incorrect imputations, and it is incompatible with scikit-learn 1.8+. Please do not use it in production. A corrected v0.2.0 is in progress.
Impute missing values using Meta's faiss - A Python library for missing data imputation with k nearest neighbors.
Installation
You can install faiss-imputer using pip:
pip install faiss-imputer
Usage
import numpy as np
from faiss_imputer import FaissImputer
# Complete rows used as reference donors
X_train = np.array(
[
[1.0, 10.0, 100.0],
[2.0, 20.0, 200.0],
[3.0, 30.0, 300.0],
],
dtype=np.float32,
)
# New rows containing missing values
X_missing = np.array(
[
[1.5, np.nan, 150.0],
[2.5, 25.0, np.nan],
],
dtype=np.float32,
)
imputer = FaissImputer(n_neighbors=2)
imputer.fit(X_train)
X_imputed = imputer.transform(X_missing)
print(X_imputed)
transform() returns a NumPy float32 array. The input array is not modified.
Parameters
n_neighbors: Number of reference rows used to calculate each missing value.metric: Neighbor-search metric. Supported values are"l2"and"ip". Raw inner product is not cosine similarity.strategy: Aggregation method for neighbor values. Supported values are"mean"and"median".index_factory: Faiss index description. The default"Flat"performs exact search.
Important behavior
fit()currently uses only rows without any missing values as reference donors.- Neighbor search compares only the columns observed in each query row.
n_neighborscannot exceed the number of complete reference rows.- An entirely missing row is filled using statistics learned during
fit(). - Input data must be a two-dimensional numeric array with the same number of columns used during
fit().
Example notebook
See Imputing Missing Values with Faiss Imputer for a notebook example.
Contributing
Contributions are welcome! If you find a bug or have an enhancement suggestion, please open an issue or create a pull request.
Author
- Name: Hakkil Kim
- GitHub Profile: GitHub Profile Link
License
This project is licensed under the MIT License.
Third-Party Licenses
FaissImputer depends on Meta's Faiss, which is distributed under the MIT License.
FaissImputer is not affiliated with or endorsed by Meta or the Faiss maintainers.
For detailed licensing information of the Faiss library, please refer to the Faiss repository.
Metadata
Release files for faiss-imputer 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| faiss_imputer-0.2.0.tar.gz | 6.1 kB | With provenance | Details for faiss_imputer-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| faiss_imputer-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for faiss_imputer-0.2.0-py3-none-any.whl |
Total release size: 11.7 kB
Release files / faiss_imputer-0.2.0.tar.gz
| Download URL | faiss_imputer-0.2.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f896412c289288b84776948ed1a5ecc48e8aecfdae5ff1e7d521b6f9c10ab13
|
|
BLAKE2b-256 checksum How to use checksums |
1870877fe3eb1d48026c1129a470cf42fbbadf3de62f4a58059fdd009228edc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / faiss_imputer-0.2.0-py3-none-any.whl
| Download URL | faiss_imputer-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db1fce0a5723c57f21c406e19a384868bddcdda93af0d7327b36440f7c544ea5
|
|
BLAKE2b-256 checksum How to use checksums |
e7a432305bb126673a555f35157a2cb40314246939e14ef1359a1c329bed3a54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logSecurity for faiss-imputer 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for faiss_imputer-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logA 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.