def predict(self): import input import model input = input.load() model_pred = model.create(input) model_pred.predict(input)
def goTrain(self): import input import model input = input.load() model_train = model.create(input) model_train.fit(input) if not conf.path_model is None: model_train.save(conf.path_model)
def main(): args = parseCommandLineArguments() level = INFO if args.debug: level = 0 elif args.verbose: level = DEBUG elif args.quiet: level = WARNING initializeLog(level) inputFile, reductionFile, chemkinFile, spcDict = args.requiredFiles[-4:] for f in [inputFile, reductionFile, chemkinFile, spcDict]: assert os.path.isfile(f), 'Could not find {}'.format(f) inputDirectory = os.path.abspath(os.path.dirname(inputFile)) output_directory = inputDirectory rmg, targets, error = load(inputFile, reductionFile, chemkinFile, spcDict) logger.info('Allowed error in target observables: {0:.0f}%'.format(error * 100)) reactionModel = rmg.reactionModel initialize(rmg.outputDirectory, reactionModel.core.reactions) atol, rtol = rmg.absoluteTolerance, rmg.relativeTolerance index = 0 reactionSystem = rmg.reactionSystems[index] #compute original target observables observables = computeObservables(targets, reactionModel, reactionSystem, \ rmg.absoluteTolerance, rmg.relativeTolerance) logger.info('Observables of original model:') for target, observable in zip(targets, observables): logger.info('{}: {:.2f}%'.format(target, observable * 100)) # optimize reduction tolerance tol, importantReactions = optimize(targets, reactionModel, rmg, index, error, observables) logger.info('Optimized tolerance: {:.0E}'.format(10**tol)) logger.info('Number of reactions in optimized reduced model : {}'.format( len(importantReactions))) # plug the important reactions into the RMG object and write: rmg.reactionModel.core.reactions = importantReactions writeModel(rmg)
def main(): args = parseCommandLineArguments() level = INFO if args.debug: level = 0 elif args.verbose: level = DEBUG elif args.quiet: level = WARNING initializeLog(level) inputFile, reductionFile, chemkinFile, spcDict = args.requiredFiles[-4:] for f in [inputFile, reductionFile, chemkinFile, spcDict]: assert os.path.isfile(f), 'Could not find {}'.format(f) inputDirectory = os.path.abspath(os.path.dirname(inputFile)) output_directory = inputDirectory rmg, targets, error = load(inputFile, reductionFile, chemkinFile, spcDict) logger.info('Allowed error in target observables: {0:.0f}%'.format(error * 100)) reactionModel = rmg.reactionModel initialize(rmg.outputDirectory, reactionModel.core.reactions) atol, rtol = rmg.absoluteTolerance, rmg.relativeTolerance index = 0 reactionSystem = rmg.reactionSystems[index] #compute original target observables observables = computeObservables(targets, reactionModel, reactionSystem, \ rmg.absoluteTolerance, rmg.relativeTolerance) logger.info('Observables of original model:') for target, observable in zip(targets, observables): logger.info('{}: {:.2f}%'.format(target, observable * 100)) # optimize reduction tolerance tol, importantReactions = optimize(targets, reactionModel, rmg, index, error, observables) logger.info('Optimized tolerance: {:.0E}'.format(10**tol)) logger.info('Number of reactions in optimized reduced model : {}'.format(len(importantReactions))) # plug the important reactions into the RMG object and write: rmg.reactionModel.core.reactions = importantReactions writeModel(rmg)
def __parse_input(self, in_file): from input import load data = load(in_file) options = data[input.OPTIONS] if options.flow_unit in US_UNITS: self.units = UnitsUS() #TODO make proper units system else: self.units = UnitsSI() #TODO implement UnitsSI #init curves self.curves = {} for c in data[input.CURVES]: self.curves[c.ID] = None for id in self.curves.keys(): self.curves[id] = Curve(data[input.CURVES], id) self.__prepare_nodes(data) self.__prepare_links(data)