Skip to content

Instantly share code, notes, and snippets.

@abhishek-ghose
abhishek-ghose / kendal_W.py
Created July 31, 2024 07:36
Calculates Kendal's W from scores, by calculating ranks first.
import numpy as np
def kendall_w(scores):
"""
:param scores: rows correspond to category levels, e.g., for QS this would be unc. sampling, CAL etc, and the
columns correspond to the scores.
:return:
"""
if scores.ndim!=2:
@abhishek-ghose
abhishek-ghose / optimal_transport_demo.py
Created July 22, 2024 19:23
Sample codes for Optimal Transport
import numpy as np, itertools
import pandas as pd
import ot
from matplotlib import pyplot as plt
from matplotlib.collections import LineCollection
import seaborn as sns; sns.set()
from scipy.stats import multivariate_normal as mvn, norm
from sklearn.cluster import KMeans
import os
from datetime import datetime
@abhishek-ghose
abhishek-ghose / diabetes.csv
Created August 23, 2022 19:51
diabetes data for imodels tests
Pregnancies Glucose BloodPressure SkinThickness Insulin BMI DiabetesPedigreeFunction Age Outcome
6 148 72 35 0 33.6 0.627 50 1
1 85 66 29 0 26.6 0.351 31 0
8 183 64 0 0 23.3 0.672 32 1
1 89 66 23 94 28.1 0.167 21 0
0 137 40 35 168 43.1 2.288 33 1
5 116 74 0 0 25.6 0.201 30 0
3 78 50 32 88 31 0.248 26 1
10 115 0 0 0 35.3 0.134 29 0
2 197 70 45 543 30.5 0.158 53 1