def __init__(self,messageHandler,**kwargs): """ PolyExponential constructor @ In, messageHandler, MessageHandler.MessageUser, a MessageHandler object in charge of raising errors, and printing messages @ In, kwargs, dict, an arbitrary dictionary of keywords and values """ supervisedLearning.__init__(self,messageHandler,**kwargs) self.availCoeffRegressors = ['nearest','poly','spline'] # avail coeff regressors self.printTag = 'PolyExponential' # Print tag self.pivotParameterID = kwargs.get("pivotParameter","time") # Pivot parameter ID self._dynamicHandling = True # This ROM is able to manage the time-series on its own self.polyExpParams = {} # poly exponential options' container self.polyExpParams['expTerms'] = int(kwargs.get('numberExpTerms',3)) # the number of exponential terms self.polyExpParams['coeffRegressor'] = kwargs.get('coeffRegressor','spline').lower() # which regressor to use for interpolating the coefficient self.polyExpParams['polyOrder'] = int(kwargs.get('polyOrder',3)) # the polynomial order self.polyExpParams['tol'] = float(kwargs.get('tol',0.001)) # optimization tolerance self.polyExpParams['maxNumberIter'] = int(kwargs.get('maxNumberIter',5000)) # maximum number of iterations in optimization self.aij = None # a_ij coefficients of the exponential terms {'target1':ndarray(nsamples, self.polyExpParams['expTerms']),'target2',ndarray,etc} self.bij = None # b_ij coefficients of the exponent of the exponential terms {'target1':ndarray(nsamples, self.polyExpParams['expTerms']),'target2',ndarray,etc} self.model = None # the surrogate model itself {'target1':model,'target2':model, etc.} # check if the pivotParameter is among the targetValues if self.pivotParameterID not in self.target: self.raiseAnError(IOError,"The pivotParameter "+self.pivotParameterID+" must be part of the Target space!")
def __init__(self, **kwargs): """ DMD constructor @ In, kwargs, dict, an arbitrary dictionary of keywords and values """ supervisedLearning.__init__(self, **kwargs) self.availDmdAlgorithms = [ 'dmd', 'hodmd' ] # available dmd types: basic dmd and high order dmd self.dmdParams = {} # dmd settings container self.printTag = 'DMD' # print tag self.pivotParameterID = kwargs.get("pivotParameter", "time") # pivot parameter self._dynamicHandling = True # This ROM is able to manage the time-series on its own. No need for special treatment outside self.dmdParams['rankSVD'] = kwargs.get( 'rankSVD', None ) # -1 no truncation, 0 optimal rank is computed, >1 truncation rank self.dmdParams['energyRankSVD'] = kwargs.get( 'energyRankSVD', None ) # 0.0 < float < 1.0, computed rank is the number of the biggest sv needed to reach the energy identified by "energyRankSVD" self.dmdParams['rankTLSQ'] = kwargs.get( 'rankTLSQ', None) # truncation rank for total least square self.dmdParams['exactModes'] = kwargs.get( 'exactModes', True ) # True if the exact modes need to be computed (eigs and eigvs), otherwise the projected ones (using the left-singular matrix) self.dmdParams['optimized'] = kwargs.get( 'optimized', False ) # amplitudes computed minimizing the error between the mods and all the timesteps (True) or 1st timestep only (False) self.dmdParams['dmdType'] = kwargs.get( 'dmdType', 'dmd' ) # the dmd type to be applied. Currently we support dmd and hdmd (high order dmd) # variables filled up in the training stages self._amplitudes = { } # {'target1': vector of amplitudes,'target2':vector of amplitudes, etc.} self._eigs = { } # {'target1': vector of eigenvalues,'target2':vector of eigenvalues, etc.} self._modes = { } # {'target1': matrix of dynamic modes,'target2':matrix of dynamic modes, etc.} self.__Atilde = { } # {'target1': matrix of lowrank operator from the SVD,'target2':matrix of lowrank operator from the SVD, etc.} self.pivotValues = None # pivot values (e.g. time) self.KDTreeFinder = None # kdtree weighting model self.timeScales = { } # time-scales (training and dmd). {'training' and 'dmd':{t0:float,'dt':float,'intervals':int}} # some checks if self.dmdParams['rankSVD'] is not None and self.dmdParams[ 'energyRankSVD'] is not None: self.raiseAWarning( 'Both "rankSVD" and "energyRankSVD" have been inputted. "energyRankSVD" is predominant and will be used!' ) if self.dmdParams['dmdType'] not in self.availDmdAlgorithms: self.raiseAnError( IOError, 'dmdType(s) available are "' + ', '.join(self.availDmdAlgorithms) + '"!') # check if the pivotParameter is among the targetValues if self.pivotParameterID not in self.target: self.raiseAnError( IOError, "The pivotParameter " + self.pivotParameterID + " must be part of the Target space!")