Commit d108c85f authored by Anthony Larcher's avatar Anthony Larcher
Browse files

normalization

parent b9d0efb1
......@@ -116,6 +116,11 @@ from .gmm_scoring import gmm_scoring
from .jfa_scoring import jfa_scoring
from .score_normalization import znorm
from .score_normalization import tnorm
from .score_normalization import ztnorm
from .score_normalization import snorm
from .sidekit_io import write_norm_hdf5
from .sidekit_io import write_matrix_hdf5
......
......@@ -490,7 +490,7 @@ class Xtractor(torch.nn.Module):
out_channels=entry_conv_out_channels,
kernel_size=entry_conv_kernel_size,
padding=3,
stride=1))
stride=1)))
elif k.startswith("conv"):
segmental_layers.append((k, torch.nn.Conv1d(input_size,
......
......@@ -28,6 +28,7 @@ Copyright 2014-2019 Anthony Larcher
formats.
"""
import copy
import numpy
__license__ = "LGPL"
......@@ -63,7 +64,7 @@ def znorm(enrol_test_scores, enrol_imp_scores, sym=False):
else:
mean_per_model = enrol_imp_scores.scoremat.mean(1)
std_per_model = enrol_imp_scores.scoremat.std(1)
enrol_test_scores = (enrol_test_scores.scoremat - mean_per_model) / std_per_model
enrol_test_scores.scoremat = (enrol_test_scores.scoremat - mean_per_model) / std_per_model
return enrol_test_scores
......@@ -76,13 +77,13 @@ def tnorm(enrol_test_scores, imp_test_scores):
:return:
"""
# Align enrol_test_scores.segset and imp_test_scores.segset
imp_test_scores.filter(imp_test_scores.segset, enrol_test_scores.segset, keep=True)
imp_test_scores.filter(imp_test_scores.modelset, enrol_test_scores.segset, keep=True)
enrol_test_scores.sort()
imp_test_scores.sort()
# Compute the new enrol_test_scores normalized scores
mean_per_segment = imp_test_scores.mean(0)
std_per_segment = imp_test_scores.std(0)
mean_per_segment = imp_test_scores.scoremat.mean(0)
std_per_segment = imp_test_scores.scoremat.std(0)
enrol_test_scores.scoremat = (enrol_test_scores.scoremat - mean_per_segment) / std_per_segment
return enrol_test_scores
......@@ -124,10 +125,11 @@ def snorm(enrol_test_scores, enrol_imp_scores, imp_test_scores):
t_enrol_test_scores = tnorm(enrol_test_scores, imp_test_scores)
# Average the z and t normed scores
s_enrol_test_scores = copy.deepcopy(enrol_test_scores)
s_enrol_test_scores.scoremat = 0.5 * (z_enrol_test_scores.scoremat + t_enrol_test_scores.scoremat)
return s_enrol_test_scores
def asnorm(enrol_test_scores):
pass
\ No newline at end of file
pass
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment