minigrida/protocols/jurse_default.py

31 lines
787 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
# \file jurse_default.py
# \brief TODO
# \author Florent Guiotte <florent.guiotte@gmail.com>
# \version 0.1
# \date 07 sept. 2018
#
# TODO details
import hashlib
from protocol import Protocol
class Jurse(Protocol):
def __init__(self, expe):
super().__init__(expe, self.__class__.__name__)
def _get_hashes(self):
hashes = OrderedDict()
hashes['global'] = 'Protocol did not override _get_hashes()'
glob = hashlib.sha1()
for k in ['ground_truth', 'descriptors_script', 'cross_validation', 'classifier']:
v = str(expe[k]).encode('utf-8')
hashes[k] = hashlib.sha1(v).hexdigest()
glob.update(v)
hashes['global'] = glob.hexdigest()
return hashes