def CostFactory2(self,pts,datapts,nparams): """generates a cost function instance from datapoints and evaluation points""" F = CF() F.addModel(self.ForwardFactory,self.__name__,nparams) self.__cost__ = F.getCostFunction(evalpts=pts,observations=datapts,sigma=self.__sigma__,metric=self.__metric__) return self.__cost__
def CostFactory(self,target,pts): """generates a cost function instance from list of coefficients & evaluation points""" datapts = self.evaluate(target,pts) F = CF() F.addModel(self.ForwardFactory,len(target),self.__name__) self.__cost__ = F.getCostFunction(evalpts=pts,observations=datapts,sigma=sqrt(datapts),metric=self.__metric__) return self.__cost__