Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
clsname = mdinfo.modeltype
# possibles = globals()
# possibles.update(locals())
if (clsname.upper() in ModelBase.AllModelInfo().keys()): # and (clsname in possibles.keys()):
# dataset.classfeatureindex is determined by mdinfo(and when training md.classfeatureindex is determined by dataset.classfeatureindex)
ds['view'].classfeatureindex = mdinfo.classfeatureindex
# need to set args to __init__
# md = possibles.get(clsname)(dataset = ds['view'])
# print ModelBase.AllModelInfo()[clsname.upper()]
md = ModelBase.AllModelInfo()[clsname.upper()]['cls'](dataset = ds['view'])
md.positive = mdinfo.positive
md.negative = mdinfo.negative
md.classfeatureindex = mdinfo.classfeatureindex
md.loss = {
'QUAD': ModelBase.QuadLoss
,'BIN': ModelBase.BinLoss
,'ABS': ModelBase.AbsLoss
,'LOG': ModelBase.LogLoss
}[mdinfo.loss]
self.dataset = ds['view']
self.model = md