Skip to content

albertoazzari/cddiagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Critical Difference (CD) Diagram

This repository provides a tool for drawing Critical Difference (CD) diagrams, widely used to visualize and compare the performance ranks of multiple models or algorithms.

The process starts by performing the Friedman Chi-Square test to determine if there are significant differences between the models. If significant differences are found, the Nemenyi post-hoc test is applied to identify which model pairs differ significantly.

The resulting CD diagram illustrates the average ranks of the models, highlighting groups of models that are not significantly different.

This tool is ideal for researchers and practitioners who need to create clear, publication-ready visualizations for statistical model comparisons.

Usage

from cd_diagram import draw_cd_diagram
import numpy as np
import pandas as pd


rng = np.random.default_rng(1)

models = {
    'model1': rng.normal(loc=0.2, scale=0.1, size=30),
    'model2': rng.normal(loc=0.2, scale=0.1, size=30),
    'model3': rng.normal(loc=0.4, scale=0.1, size=30),
    'model4': rng.normal(loc=0.5, scale=0.1, size=30),
    'model5': rng.normal(loc=0.7, scale=0.1, size=30),
    'model6': rng.normal(loc=0.7, scale=0.1, size=30),
    'model7': rng.normal(loc=0.8, scale=0.1, size=30),
    'model8': rng.normal(loc=0.9, scale=0.1, size=30),
}

models = pd.DataFrame(models)

# it works with both a pandas Dataframe and a numpy array
draw_cd_diagram(models, labels=models.columns.to_list(), out_file="out.svg")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •