Skip to content

Commit

Permalink
[FIX]: fixed readme (added some tests for HC)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZISST committed Jan 10, 2025
1 parent dacf202 commit 896dbfd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Graph состоит из следующих элементов:

## Краткий обзор для новых пользователей
В первую очередь, необходимо сохранить данные в папку
```
data_validation/dataset_name/raw
```bash
mkdir -p data_validation/dataset_name/raw
```
Папка с данными должна содержать 2 или 3 файла, если решается задача классификации вершин и N*2 файла (где N -- размер датасета), если задача классификации графов:
* **edges.txt** состоит из двух клонок, разделенных запятой; каждая строчка этого файла является парой вершин, между которыми есть ребро в графе.
Expand Down
4 changes: 2 additions & 2 deletions README_ENG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Graph consists of

## Quick Tour for New Users
First of all you need to save your raw data into folder
```
data_validation/dataset_name/raw
```bash
mkdir -p data_validation/dataset_name/raw
```
The data folder must contain two or three files if your task is Node Classification and N*2 files if your task is Graph Classification:

Expand Down
14 changes: 13 additions & 1 deletion hc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Библиотека использует возможности `scikit-learn` и `scipy` для вычислений.

---
Убедитесь, что вы находитесь в директории в `.../StableGNN/hc/`

## Установка
1. Установите зависимости и проект:
Expand Down Expand Up @@ -45,8 +46,19 @@ print("Кластеры:", labels)
### Пример 2: Автоматический выбор количества кластеров
```python
from hypergraph_clustering.clustering.auto_clustering import AutoClusterHypergraphClustering
import numpy as np

clustering = AutoClusterHypergraphClustering(linkage="average", max_clusters=5, scoring="silhouette")
# Пример графа
adjacency_matrix = np.array([
[0, 1, 1, 0],
[1, 0, 1, 0],
[1, 1, 0, 1],
[0, 0, 1, 0]
])


lm = len(adjacency_matrix) - 1
clustering = AutoClusterHypergraphClustering(linkage="average", max_clusters=lm, scoring="silhouette")
labels = clustering.fit(adjacency_matrix)

print("Кластеры:", labels)
Expand Down
11 changes: 6 additions & 5 deletions hc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
numpy
scikit-learn
networkx
pytest
matplotlib
numpy==1.26.4
scikit-learn==1.6.0
networkx==3.2.1
pytest==8.3.4
matplotlib==3.6.2
lightgmb==4.5.0
14 changes: 7 additions & 7 deletions hc/setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from setuptools import setup, find_packages
from typing import Dict

version: Dict[str, str] = {}
with open("requirements.txt", "r") as f:
requirements = [x for x in f.read().splitlines() if "#" not in x]

setup(
name="hypergraph_clustering",
version="0.1.0",
description="Модуль для агломеративной кластеризации гиперграфов",
author="nosignalx2k",
packages=find_packages(),
install_requires=[
"numpy",
"scikit-learn",
"networkx",
"matplotlib"
],
)
install_requires=requirements,
)
11 changes: 9 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
bamt==1.1.44
bamt==1.1.47
optuna==2.10.1
pgmpy==0.1.20
pandas==1.5.2
pandas==1.5.2

numpy==1.26.4
scikit-learn==1.6.0
networkx==3.2.1
pytest==8.3.4
matplotlib==3.6.2

0 comments on commit 896dbfd

Please sign in to comment.