Skip to content

Commit

Permalink
added version 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
parvvaresh committed Jan 3, 2025
1 parent 8d68083 commit 524069f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
42 changes: 24 additions & 18 deletions cluster_ga.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: cluster_ga
Version: 0.1
Version: 0.2
Summary: This Python script implements a genetic algorithm for clustering data. The algorithm optimizes the cluster assignments of data points using a genetic approach, aiming to improve the silhouette score. The silhouette score is a measure of how well-defined the clusters are in the data.
Home-page: https://github.com/parvvaresh/clustering-with-genetic
Author: Alireza Parvaresh
Expand All @@ -17,46 +17,54 @@ This Python script implements a genetic algorithm for clustering data. The algor

## Table of Contents
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Algorithm Overview](#algorithm-overview)
- [Genetic Class](#genetic-class)
- [Cluster Class](#cluster-class)
- [Main Script](#main-script)
- [Parameters](#parameters)
- [Results](#results)
- [License](#license)
- [Acknowledgments](#acknowledgments)

## Getting Started

### Prerequisites

- Python 3
- Required libraries: numpy, pandas, scikit-learn, matplotlib

### Installation

1. **Clone the repository:**

```bash
https://github.com/parvvaresh/cluster_ga
cd cluster_ga
```

2. **Install the required dependencies:**

```bash
pip install -r requirements.txt
pip install cluster_ga
```

## Usage

Run the `genetic_clustering.py` script to execute the genetic clustering algorithm on the provided dataset. Make sure to update the script with your dataset or use the default Iris dataset.

```bash
python3 test_iris.py

```python
from sklearn import datasets
import numpy as np
import pandas as pd
from cluster_ga.cluster import cluster

# this is a for test

iris = datasets.load_iris()
iris_df = pd.DataFrame(iris.data, columns=iris.feature_names)
x = np.array(iris_df[["petal length (cm)", "petal width (cm)"]])
y = iris.target

# Instantiate and fit the model
model = cluster(x, y, 500, 0.9,150)
model.fit()


# show fitness plot
model.show_plot()

```

## Algorithm Overview
Expand All @@ -71,9 +79,7 @@ Defines the genetic operations such as mutation, generation, and fitness calcula

Manages the clustering process, including the initialization of populations, evolution, and convergence.

### Main Script

Utilizes the genetic and clustering classes to run the algorithm on a given dataset.

## Parameters

Expand Down
Binary file added dist/cluster_ga-0.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/cluster_ga-0.2.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="cluster_ga", # Name of your package
version="0.1", # Version of your package
version="0.2", # Version of your package
author="Alireza Parvaresh",
author_email="[email protected]",
description="This Python script implements a genetic algorithm for clustering data. The algorithm optimizes the cluster assignments of data points using a genetic approach, aiming to improve the silhouette score. The silhouette score is a measure of how well-defined the clusters are in the data.",
Expand Down

0 comments on commit 524069f

Please sign in to comment.