Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ tests/datasets/*.csv
tests/out/

# Demo
tests/demo/datasets/*.csv
tests/demo/out/
/examples/datasets/*.csv
/examples/out/*
!/examples/out/.gitkeep
8 changes: 4 additions & 4 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ University of Seville, Spain
This software is associated with the following scientific work:
GAUFS: Genetic Algorithm for Unsupervised Feature Selection for Clustering

Paper authors and contributions:
GAUFS authors and contributions:
- Salvador de la Torre Gonzalez: Conceptualization, Original Software, Refactorization & Library development, Investigation, Writing – original draft, Writing – review & editing.
- José E. Sánchez-López: Conceptualization, Methodology, Investigation, Formal analysis, Visualization, Writing – original draft, Writing – review & editing.
- Salvador de la Torre Gonzalez: Conceptualization, Software, Library development, Investigation, Writing – original draft, Writing – review & editing.
- Antonio Bello-Castro: Software, Investigation, Validation, Writing – original draft, Writing – review & editing.
- José M. Núñez-Portero: Software, Investigation, Visualization, Writing – original draft, Writing – review & editing.
- Antonio Bello-Castro: Original Software, Investigation, Validation, Writing – original draft, Writing – review & editing.
- José M. Núñez-Portero: Original Software, Investigation, Visualization, Writing – original draft, Writing – review & editing.
- José C. Riquelme: Conceptualization, Methodology, Supervision, Funding acquisition, Project administration, Writing – review & editing.
414 changes: 410 additions & 4 deletions README.md

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../../src'))

project = 'GAUFS'
author = 'Salvador de la Torre Gonzalez'
release = '1.0.0'
sys.path.insert(0, os.path.abspath("../../src"))

project = "GAUFS"
author = "Salvador de la Torre Gonzalez"
release = "1.1.0"

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]

autosummary_generate = True
autodoc_typehints = 'description'
autodoc_typehints = "description"

templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []

suppress_warnings = ['autosummary.import']
suppress_warnings = ["autosummary.import"]

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = "alabaster"
html_static_path = ["_static"]
File renamed without changes.
9 changes: 4 additions & 5 deletions tests/demo/main.py → examples/demo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@
from gaufs import read_labeled_data_csv
from gaufs.evaluation_metrics import AdjustedMutualInformationScore


def main():
seed = 0

# Change working directory to the script directory
script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir)

# Filepath
file_path=os.path.join("datasets", "corners_3clusters.csv")
file_path = os.path.join("datasets", "corners_3clusters.csv")

# Generate data with corners distribution and save it to a CSV file
data_with_labels = DataGenerator.generate_data_corners(
Expand All @@ -52,9 +53,7 @@ def main():
)

# Read the data
unlabeled_data, true_labels = read_labeled_data_csv(
file_path
)
unlabeled_data, true_labels = read_labeled_data_csv(file_path)

# Instantiate GAUFS
gaufs = Gaufs(seed=seed)
Expand Down
81 changes: 81 additions & 0 deletions examples/demo2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# MINERVA AI-Lab
# Institute of Computer Engineering
# University of Seville, Spain
#
# Copyright 2026 Salvador de la Torre Gonzalez
# Antonio Bello Castro,
# José M. Núñez Portero
#
# Developed and currently maintained by:
# Salvador de la Torre Gonzalez
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# SPDX-License-Identifier: Apache-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from gaufs import DataGenerator
from gaufs import Gaufs
from gaufs import read_labeled_data_csv
from gaufs.clustering_experiments import KmeansExperiment
from gaufs.evaluation_metrics import AdjustedMutualInformationScore, NMIScore


def main():
seed = 0

# Change working directory to the script directory
script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir)

# Filepath
file_path = os.path.join("datasets", "spheres_4clusters.csv")

# Generate data with spheres distribution and save it to a CSV file
data_with_labels = DataGenerator.generate_data_spheres(
num_useful_features=2,
num_clusters=4,
num_samples_per_cluster=50,
num_dummy_unif=1,
num_dummy_beta=1,
alpha_param=2,
beta_param=3,
output_path=file_path,
seed=seed,
)

# Read the data
unlabeled_data, true_labels = read_labeled_data_csv(file_path)

# In this case we asume we know the data labels and therefore we are in a supervised scenario
# Instantiate GAUFS using the KMeans clustering experiment, an external metric and a tighter cluster search band
gaufs = Gaufs(
seed=seed,
clustering_method=KmeansExperiment(),
evaluation_metric=AdjustedMutualInformationScore(true_labels=true_labels),
cluster_number_search_band=(3, 6)
)
# Set the unlabeled data
gaufs.set_unlabeled_data(unlabeled_data)
# Run GAUFS
gaufs.run()

# Comparison with another external metric
gaufs.get_plot_comparing_solution_with_another_metric(
NMIScore(true_labels=true_labels),
true_number_of_labels=len(set(true_labels)),
)


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "gaufs"
version = "1.0.0"
version = "1.1.0"
description = "Genetic Algorithm for Unsupervised Feature Selection for Clustering"
readme = "README.md"
requires-python = ">=3.11,<3.14"
Expand All @@ -28,7 +28,7 @@ dependencies = [
dev = [
"pytest>=8.0.0",
"black>=24.0.0",
"build>=1.0.0",
"build>=1.4.0",
]
docs = [
"sphinx>=7.0.0",
Expand Down
19 changes: 0 additions & 19 deletions requirements.txt

This file was deleted.

Loading