Skip to content

Instantly share code, notes, and snippets.

View AlexandreAbraham's full-sized avatar

Alexandre Abraham AlexandreAbraham

View GitHub Profile
@AlexandreAbraham
AlexandreAbraham / hyperband.py
Last active April 28, 2020 15:54
Hyperband experiment
from math import ceil
from functools import partial
from matplotlib import pyplot as plt
from cycler import cycler
import numpy as np
from decimal import Context
plt.rcParams['figure.constrained_layout.use'] = True
ctx = Context(prec=20)
@AlexandreAbraham
AlexandreAbraham / unsupervised_alt.py
Last active February 5, 2023 23:00
These are two implementations of the silhouette score. They are compatible with the scikit learn implementation but offers different drawbacks in term of complexity and memory usage. The slow version needs no memory but is painfully slow and should, I think, not be used. The second one is based on a block strategy: distance between samples and c…
""" Unsupervised evaluation metrics. """
# License: BSD Style.
from itertools import combinations
import numpy as np
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import distance_metrics
from sklearn.metrics.pairwise import pairwise_distances