-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi David,
I was trying to run a range of metrics from pycalibration, yet I seem to be unable to get them to work due to julia syntax being so different.
So I start by generating synthetic predicted probabilities (

These will become the (perfect accuracy) inputs to the calibration metrics.
I take a set of metrics (from julia) that I would like to apply on these pythonic numpy arrays:
ece = ECE(UniformBinning(10), (μ, y) -> kl_divergence(y, μ))
ece_bin = ece(p, y)
from julia.api import Julia
jl = Julia(compiled_modules=False)
import pycalibration
from pycalibration import calerrors as ce
p = [[0.6461553 0.1392794 0.21456529]
[0.36878229 0.33442643 0.29679128], ...]
y = [0 0 , ...]
For skce and ece = ce.ECE(ce.UniformBinning(10), ce.SqEuclidean()) I can get it to work if I correctly format and type the arrays:
import numpy as np
p2 = [np.array(a).astype(np.float32) for a in p]
skce = ce.UnbiasedSKCE(ce.tensor(ce.ExponentialKernel(), ce.WhiteKernel()))
skce(p2,y.astype(np.int))
> 0.19480350613594055
However, some syntax I don't know how to translate in python, like the swapped order kl_divergence:
ece = ce.ECE(ce.UniformBinning(10), ce.kl_divergence)
ece_bin_l2 = ece(p, y)
> np.nan #gives nan all the time
Any advice here?
Thanks!
Jordy
Metadata
Metadata
Assignees
Labels
No labels