Commit 77a973d6 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

New THEANO flag

parent 1eeb380e
......@@ -36,7 +36,7 @@ import importlib
# Read environment variable if it exists
SIDEKIT_CONFIG={"theano":True,
"theano_config":'gpu', # Can be 'cpu' or 'gpu'
"theano_config":'cuda', # Can be 'cpu' or 'cuda'
"libsvm":True,
"mpi":False
}
......@@ -124,8 +124,8 @@ from sidekit.jfa_scoring import jfa_scoring
theano_imported = False
try:
if SIDEKIT_CONFIG["theano"]:
if SIDEKIT_CONFIG["theano_config"] == "gpu":
os.environ['THEANO_FLAGS'] = 'mode=FAST_RUN,device=gpu,floatX=float32'
if SIDEKIT_CONFIG["theano_config"] == "cuda":
os.environ['THEANO_FLAGS'] = 'mode=FAST_RUN,device=cuda,floatX=float32'
else:
os.environ['THEANO_FLAGS'] = 'mode=FAST_RUN,device=cpu,floatX=float32'
theano_imported = True
......
......@@ -663,10 +663,10 @@ class DetPlot:
self.__figure__ = mpl.figure(idx)
ax = self.__figure__.add_subplot(111)
ax.set_aspect('equal')
mpl.axis([self.__plotwindow__.__pmiss_limits__[0],
self.__plotwindow__.__pmiss_limits__[1],
self.__plotwindow__.__pfa_limits__[0],
self.__plotwindow__.__pfa_limits__[1]])
mpl.axis([__probit__(self.__plotwindow__.__pfa_limits__[0]),
__probit__(self.__plotwindow__.__pfa_limits__[1]),
__probit__(self.__plotwindow__.__pmiss_limits__[0]),
__probit__(self.__plotwindow__.__pmiss_limits__[1])])
xticks = __probit__(self.__plotwindow__.__xticks__)
yticks = __probit__(self.__plotwindow__.__yticks__)
ax.set_xticks(xticks)
......@@ -680,6 +680,16 @@ class DetPlot:
mpl.xlabel('False Rejection Rate [in %]')
mpl.ylabel('False Acceptance Rate [in %]')
# assuring, limits are kept by matplotlib after probit transform of axes
mpl.gca().set_xlim(
left=__probit__(self.__plotwindow__.__pfa_limits__[0]),
right=__probit__(self.__plotwindow__.__pfa_limits__[1])
)
mpl.gca().set_ylim(
bottom=__probit__(self.__plotwindow__.__pmiss_limits__[0]),
top=__probit__(self.__plotwindow__.__pmiss_limits__[1])
)
def set_system(self, tar, non, sys_name=''):
"""Sets the scores to be plotted. This function must be called
before plots are made for a system, but it can be called several
......@@ -838,14 +848,19 @@ class DetPlot:
pfa_min = self.__plotwindow__.__pfa_limits__[0]
pfa_max = self.__plotwindow__.__pfa_limits__[1]
pmiss_min = self.__plotwindow__.__pmiss_limits__[0]
pmiss_max = self.__plotwindow__.__pmiss_limits__[1]
pfaval = 30.0 / self.__non__[idx].shape[0]
if (pfaval < pfa_min) | (pfaval > pfa_max):
logging.warning('Pfa DR30 of %f is not between %f and %f Pfa DR30 line will not be plotted.',
logging.warning('Pfa DR30 of %f is not between %f and %f Pfa DR30 line will not be plotted.',
pfaval, pfa_min, pfa_max)
else:
drx = __probit__(pfaval)
mpl.axvline(drx, color=plot_args[0],
mpl.axvline(drx,
ymin=__probit__(pmiss_min),
ymax=__probit__(pmiss_max),
color=plot_args[0],
linestyle=plot_args[1],
linewidth=plot_args[2],
label=legend_string)
......@@ -867,16 +882,21 @@ class DetPlot:
"""
assert isinstance(plot_args, tuple) & (len(plot_args) == 3), 'Invalid plot_args'
pfa_min = self.__plotwindow__.__pfa_limits__[0]
pfa_max = self.__plotwindow__.__pfa_limits__[1]
pmiss_min = self.__plotwindow__.__pmiss_limits__[0]
pmiss_max = self.__plotwindow__.__pmiss_limits__[1]
pmissval = 30.0 / self.__tar__[idx].shape[0]
if (pmissval < pmiss_min) | (pmissval > pmiss_max):
logging.warning('Pmiss DR30 of is not between %f and %f Pfa DR30 line will not be plotted.',
logging.warning('Pmiss DR30 of is not between %f and %f Pfa DR30 line will not be plotted.',
pmissval, pmiss_min, pmiss_max)
else:
dry = __probit__(pmissval)
mpl.axhline(y=dry, color=plot_args[0],
mpl.axhline(y=dry,
xmin=__probit__(pfa_min),
xmax=__probit__(pfa_max),
color=plot_args[0],
linestyle=plot_args[1],
linewidth=plot_args[2],
label=legend_string)
......
This diff is collapsed.
......@@ -11,34 +11,23 @@ via two channels
Mailing List
************
By subscribing to the `Dev-sidekit@keaton.univ-lemans.fr` mailing list
you will be able to post and receive information with othe users and developers
By subscribing to the `dev-sidekit@univ-lemans.fr` mailing list
you will be able to post and receive information with other users and developers
of SIDEKIT.
To post to this list, send your email to:
dev-sidekit@keaton.univ-lemans.fr
General information about the mailing list is at:
http://keaton.univ-lemans.fr/cgi-bin/mailman/listinfo/dev-sidekit
To suscribe to this list:
If you ever want to unsubscribe or change your options (eg, switch to
or from digest mode, change your password, etc.), visit your
subscription page at:
send a message to `dev-sidekit@univ-lemans.fr`
and as object: `subscribe dev-sidekit firstnam name`
http://keaton.univ-lemans.fr/cgi-bin/mailman/options/dev-sidekit/anthony.larcher%40univ-lemans.fr
You can also make such adjustments via email by sending a message to:
To post to this list, send your email to:
Dev-sidekit-request@keaton.univ-lemans.fr
dev-sidekit@univ-lemans.fr
with the word `help` in the subject or body (don't include the
quotes), and you will get back a message with instructions.
If you ever want to unsubscribe:
You must know your password to change your options (including changing
the password, itself) or to unsubscribe. It is:
send a message to `dev-sidekit@univ-lemans.fr`
and as object: `unsubscribe dev-sidekit`
Responsibles
......
......@@ -806,11 +806,13 @@ class Mixture(object):
start = nb // distrib_nb * i
end = max(start + 10, nb)
mean = numpy.mean(cep[start:end, :], axis=0)
cov = (cep[start:end, :]**2).mean(0)
if i == 0:
self.mu = mean
self.invcov = 1./cov[None]
else:
self.mu = numpy.vstack((self.mu, mean))
self.invcov = numpy.vstack((self.invcov, cov_tmp))
self.invcov = numpy.vstack((self.invcov, cov))
self.cov_var_ctl = 1.0 / copy.deepcopy(self.invcov)
self._compute_all()
......
......@@ -1163,7 +1163,7 @@ class StatServer:
tmp_iv = copy.deepcopy(self)
for i in range(it):
# estimate mena and covariance matrix
# estimate mean and covariance matrix
spectral_norm_mean.append(tmp_iv.get_mean_stat1())
if mode == 'efr':
......
Supports Markdown
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