Skip to content

Instantly share code, notes, and snippets.

View brunodoamaral's full-sized avatar

Bruno Guberfain do Amaral brunodoamaral

View GitHub Profile
@brunodoamaral
brunodoamaral / tensorboard_events_to_csv.py
Last active August 30, 2018 13:12 — forked from ptschandl/tensorboard_events_to_csv.py
Extract all tensorboard events files to pandas dataframe
import tensorflow as tf
from pathlib import Path
import pandas as pd
from tqdm import tqdm
from collections import defaultdict
# Get all event* runs from logging_dir subdirectories
logging_dir = Path('.', 'logs')
event_paths = logging_dir.glob('**/event*')
@brunodoamaral
brunodoamaral / _dice.py
Last active March 16, 2024 18:00 — forked from JDWarner/_dice.py
Dice coefficient between two boolean NumPy arrays or array-like data. This is commonly used as a set similarity measurement (though note it is not a true metric; it does not satisfy the triangle inequality). The dimensionality of the input is completely arbitrary, but `im1.shape` and `im2.shape` much be equal. This Gist is licensed under the mod…
def dice(im1, im2, empty_score=1.0):
"""
Computes the Dice coefficient, a measure of set similarity.
Parameters
----------
im1 : array-like, bool
Any array of arbitrary size. If not boolean, will be converted.
im2 : array-like, bool
Any other array of identical size. If not boolean, will be converted.
Returns