https://github.com/alexgiving/lkmeans
Clustering high-dimensional data with Minkowski distance
https://github.com/alexgiving/lkmeans
distance kmeans kmeans-clustering minkowski-distance norm
Last synced: about 2 months ago
JSON representation
Clustering high-dimensional data with Minkowski distance
- Host: GitHub
- URL: https://github.com/alexgiving/lkmeans
- Owner: alexgiving
- License: mit
- Created: 2023-01-05T11:57:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-29T17:27:13.000Z (10 months ago)
- Last Synced: 2024-11-29T17:32:57.285Z (10 months ago)
- Topics: distance, kmeans, kmeans-clustering, minkowski-distance, norm
- Language: Python
- Homepage: https://pypi.org/project/lkmeans/
- Size: 3.18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/alexgiving/LKMeans/actions/workflows/test.yml)
# LKMeansLKMeans is a Python library that extends the functionality of the KMeans algorithm by allowing clusterization using the Minkowski metric instead of the traditional Euclidean distance. The Minkowski metric provides better quality performance in certain scenarios, making LKMeans a valuable tool for clustering analysis.
## Features
- Clusterization using the Minkowski metric
- Improved quality performance compared to traditional KMeans
- Easy integration into existing machine learning pipelines## Installation
You can install LKMeans:
1. From source
```bash
export PYTHONPATH=${PYTHONPATH}:$(pwd)
```
2. From PyPI
```bash
pip install lkmeans
```## Usage
Using LKMeans is straightforward. Here's a simple example that demonstrates how to use the library:
```python
import numpy as npfrom lkmeans import LKMeans
# Generate some random data
X = np.random.rand(100, 2)# Create an instance of LKMeans with the desired number of clusters and Minkowski parameter
lkmeans = LKMeans(n_clusters=3, p=0.8)# Fit the model to the data
labels = lkmeans.fit_predict(X)
centers = lkmeans.cluster_centers_
inertia = lkmeans.inertia_print(labels, centers, inertia)
```
In this example, we first import the LKMeans class from the LKMeans library. We create an instance of LKMeans with the desired number of clusters (n_clusters) and the desired Minkowski distance parameter (p), and fit the model to the data using the fit method.## Contributing
Contributions to LKMeans are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.## License
LKMeans is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more information.## Cite
```bibtex
@misc{LKMeans2023,
author = {Aleksei Trutnev},
title = {Clustering high-dimensional data with Minkowski distance},
year = {2023},
url = {https://github.com/alexgiving/LKMeans}
}
```## Contact
For any questions or inquiries, please contact alexgiving@mail.ru.Enjoy clustering with LKMeans!