Skip to content
Open
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ for ix in range(n_samples):
criterion_values = my_cvi.get_cvi(samples[ix, :], labels[ix])
```

Users can also query the `.info` property of the CVI objects to obtain relevant
scaling and naming information.

```
>>> print(my_cvi.info)
CVIInfo(name='Calinski-Harabasz', name_short='CH', index_min=0.0, index_max=inf, optimality='max')
```

### Detailed Usage

The `cvi` package contains a set of implemented CVIs with batch and incremental update methods.
Expand Down
7 changes: 7 additions & 0 deletions src/cvi/modules/CH.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class CH(_base.CVI):
3. M. Moshtaghi, J. C. Bezdek, S. M. Erfani, C. Leckie, and J. Bailey, "Online Cluster Validity Indices for Streaming Data," ArXiv e-prints, 2018, arXiv:1801.02937v1 [stat.ML]. [Online].
4. M. Moshtaghi, J. C. Bezdek, S. M. Erfani, C. Leckie, J. Bailey, "Online cluster validity indices for performance monitoring of streaming data clustering," Int. J. Intell. Syst., pp. 1-23, 2018.
"""
info = _base.CVIInfo(
name="Calinski-Harabasz",
name_short="CH",
index_min=0.0,
index_max=np.inf,
optimality="max"
)

def __init__(self):
"""
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class DB(_base.CVI):
3. M. Moshtaghi, J. C. Bezdek, S. M. Erfani, C. Leckie, J. Bailey, "Online cluster validity indices for performance monitoring of streaming data clustering," Int. J. Intell. Syst., pp. 1-23, 2018.
"""

info = _base.CVIInfo(
name="Davies-Bouldin",
name_short="DB",
index_min=0.0,
index_max=np.inf,
optimality="min"
)

def __init__(self):
"""
Davies-Bouldin (DB) initialization routine.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/GD43.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class GD43(_base.CVI):
5. J. C. Bezdek and N. R. Pal, "Some new indexes of cluster validity," IEEE Trans. Syst., Man, and Cybern., vol. 28, no. 3, pp. 301-315, Jun. 1998.
"""

info = _base.CVIInfo(
name="Generalized Dunn's 43",
name_short="GD43",
index_min=0.0,
index_max=np.inf,
optimality="max"
)

def __init__(self):
"""
Generalized Dunn's Index 43 (GD43) initialization routine.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/GD53.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class GD53(_base.CVI):
5. J. C. Bezdek and N. R. Pal, "Some new indexes of cluster validity," IEEE Trans. Syst., Man, and Cybern., vol. 28, no. 3, pp. 301-315, Jun. 1998.
"""

info = _base.CVIInfo(
name="Generalized Dunn's 53",
name_short="GD53",
index_min=0.0,
index_max=np.inf,
optimality="max"
)

def __init__(self):
"""
Generalized Dunn's Index 53 (GD53) initialization routine.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/PS.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class PS(_base.CVI):
2. E. Lughofer, "Extensions of vector quantization for incremental clustering," Pattern Recognit., vol. 41, no. 3, pp. 995-1011, 2008.
"""

info = _base.CVIInfo(
name="Partition Separation",
name_short="PS",
index_min=0.0,
index_max=1.0,
optimality="max"
)

def __init__(self):
"""
Partition Separation (PS) initialization routine.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/WB.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class WB(_base.CVI):
5. M. Moshtaghi, J. C. Bezdek, S. M. Erfani, C. Leckie, J. Bailey, "Online cluster validity indices for performance monitoring of streaming data clustering," Int. J. Intell. Syst., pp. 1-23, 2018.
"""

info = _base.CVIInfo(
name="Within/Between",
name_short="WB",
index_min=0.0,
index_max=np.inf,
optimality="min"
)

def __init__(self):
"""
WB initialization routine.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/XB.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class XB(_base.CVI):
3. M. Moshtaghi, J. C. Bezdek, S. M. Erfani, C. Leckie, J. Bailey, "Online cluster validity indices for performance monitoring of streaming data clustering," Int. J. Intell. Syst., pp. 1-23, 2018.
"""

info = _base.CVIInfo(
name="Xie-Beni",
name_short="XB",
index_min=0.0,
index_max=np.inf,
optimality="min"
)

def __init__(self):
"""
XB initialization routine.
Expand Down
12 changes: 12 additions & 0 deletions src/cvi/modules/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,23 @@
)
from abc import abstractmethod

from dataclasses import dataclass
from typing import ClassVar

# Custom imports
import numpy as np

# --------------------------------------------------------------------------- #
# CLASSES
# --------------------------------------------------------------------------- #

@dataclass
class CVIInfo:
name: str
name_short: str
index_min: float
index_max: float
optimality: str

class LabelMap():
"""
Expand Down Expand Up @@ -53,6 +63,8 @@ class CVI():
Superclass containing elements shared between all CVIs.
"""

info: ClassVar[CVIInfo]

def __init__(self):
"""
CVI base class initialization method.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/cSIL.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class cSIL(_base.CVI):
3. M. Rawashdeh and A. Ralescu, "Center-wise intra-inter silhouettes," in Scalable Uncertainty Management, E. Hüllermeier, S. Link, T. Fober et al., Eds. Berlin, Heidelberg: Springer, 2012, pp. 406-419.
"""

info = _base.CVIInfo(
name="Centroid-based Silhouette",
name_short="cSIL",
index_min=-1.0,
index_max=1.0,
optimality="max"
)

def __init__(self):
"""
Centroid-based Silhouette (cSIL) initialization routine.
Expand Down
8 changes: 8 additions & 0 deletions src/cvi/modules/rCIP.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class rCIP(_base.CVI):
3. M. Moshtaghi, J. C. Bezdek, S. M. Erfani, C. Leckie, J. Bailey, "Online cluster validity indices for performance monitoring of streaming data clustering," Int. J. Intell. Syst., pp. 1-23, 2018.
"""

info = _base.CVIInfo(
name="Representative Cross Information Potential",
name_short="rCIP",
index_min=0.0,
index_max=np.inf,
optimality="min"
)

def __init__(self):
"""
(Renyi's) representative Cross Information Potential (rCIP) initialization routine.
Expand Down
Loading