def getInputSpecification(cls): """ Collects input specifications for this class. @ In, None @ Out, inputSpecs, InputData, specs """ inputSpecs = super(ExponentialModel, cls).getInputSpecification() inputSpecs.description = r""" Exponential reliability models """ inputSpecs.addSub( InputData.parameterInputFactory( 'lambda', contentType=InputTypes.InterpretedListType, descr='The mean failure rate')) return inputSpecs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(MonteCarlo, cls).getInputSpecification() samplerInitInput = InputData.parameterInputFactory("samplerInit") limitInput = InputData.parameterInputFactory( "limit", contentType=InputData.IntegerType) samplerInitInput.addSub(limitInput) initialSeedInput = InputData.parameterInputFactory( "initialSeed", contentType=InputData.IntegerType) samplerInitInput.addSub(initialSeedInput) distInitInput = InputData.parameterInputFactory( "distInit", contentType=InputData.StringType) distSubInput = InputData.parameterInputFactory("distribution") distSubInput.addParam("name", InputData.StringType) distSubInput.addSub( InputData.parameterInputFactory("initialGridDisc", contentType=InputData.IntegerType)) distSubInput.addSub( InputData.parameterInputFactory("tolerance", contentType=InputData.FloatType)) distInitInput.addSub(distSubInput) samplerInitInput.addSub(distInitInput) samplingTypeInput = InputData.parameterInputFactory( "samplingType", contentType=InputData.StringType) samplerInitInput.addSub(samplingTypeInput) reseedEachIterationInput = InputData.parameterInputFactory( "reseedEachIteration", contentType=InputData.StringType) samplerInitInput.addSub(reseedEachIterationInput) inputSpecification.addSub(samplerInitInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(CustomSampler, cls).getInputSpecification() sourceInput = InputData.parameterInputFactory( "Source", contentType=InputData.StringType) sourceInput.addParam("type", InputData.StringType) sourceInput.addParam("class", InputData.StringType) inputSpecification.addSub(sourceInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(ExternalModel, cls).getInputSpecification() inputSpecification.setStrictMode( False) #External models can allow new elements inputSpecification.addParam("ModuleToLoad", InputData.StringType, True) inputSpecification.addSub( InputData.parameterInputFactory("variables", contentType=InputData.StringType)) return inputSpecification
def getInputSpecifications(cls): """ Establish input specs for this class. @ In, None @ Out, spec, InputData.ParameterInput, class for specifying input template """ specs = InputData.parameterInputFactory( 'SyntheticHistory', strictMode=True, descr= r"""A ROM for characterizing and generating synthetic histories. This ROM makes use of a variety of TimeSeriesAnalysis (TSA) algorithms to characterize and generate new signals based on training signal sets. """) for typ in TSA.factory.knownTypes(): c = TSA.factory.returnClass( typ, None) # TODO no message handler for second argument specs.addSub(c.getInputSpecification()) return specs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(SparseGridCollocation, cls).getInputSpecification() inputSpecification.addParam("parallel", InputTypes.StringType) inputSpecification.addParam("outfile", InputTypes.StringType) romInput = InputData.parameterInputFactory("ROM", contentType=InputTypes.StringType) romInput.addParam("type", InputTypes.StringType) romInput.addParam("class", InputTypes.StringType) inputSpecification.addSub(romInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ ######## Temporary until this class inherits from the BaseType inputSpecification = InputData.parameterInputFactory('PostProcessor', ordered=False, baseNode=InputData.RavenBase) inputSpecification.addParam("name", InputTypes.StringType, True) ######## End Temporary until this class inherits from the BaseType ## This will replace the lines above # inputSpecification = super(PostProcessor, cls).getInputSpecification() inputSpecification.addParam("subType", InputTypes.StringType, True) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ ## This will replace the lines above inputSpecification = super(LimitSurfaceIntegral, cls).getInputSpecification() LSIVariableInput = InputData.parameterInputFactory("variable") LSIVariableInput.addParam("name", InputData.StringType) LSIDistributionInput = InputData.parameterInputFactory( "distribution", contentType=InputData.StringType) LSIVariableInput.addSub(LSIDistributionInput) LSILowerBoundInput = InputData.parameterInputFactory( "lowerBound", contentType=InputData.FloatType) LSIVariableInput.addSub(LSILowerBoundInput) LSIUpperBoundInput = InputData.parameterInputFactory( "upperBound", contentType=InputData.FloatType) LSIVariableInput.addSub(LSIUpperBoundInput) inputSpecification.addSub(LSIVariableInput) LSIToleranceInput = InputData.parameterInputFactory( "tolerance", contentType=InputData.FloatType) inputSpecification.addSub(LSIToleranceInput) LSIIntegralTypeInput = InputData.parameterInputFactory( "integralType", contentType=InputData.StringType) inputSpecification.addSub(LSIIntegralTypeInput) LSISeedInput = InputData.parameterInputFactory( "seed", contentType=InputData.IntegerType) inputSpecification.addSub(LSISeedInput) LSITargetInput = InputData.parameterInputFactory( "target", contentType=InputData.StringType) inputSpecification.addSub(LSITargetInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(AdaptiveSparseGrid, cls).getInputSpecification() convergenceInput = InputData.parameterInputFactory( "Convergence", contentType=InputData.StringType) convergenceInput.addParam("target", InputData.StringType, True) convergenceInput.addParam("maxPolyOrder", InputData.IntegerType) convergenceInput.addParam("persistence", InputData.IntegerType) inputSpecification.addSub(convergenceInput) convergenceStudyInput = InputData.parameterInputFactory( "convergenceStudy") convergenceStudyInput.addSub( InputData.parameterInputFactory("runStatePoints", contentType=InputData.StringType)) convergenceStudyInput.addSub( InputData.parameterInputFactory("baseFilename", contentType=InputData.StringType)) convergenceStudyInput.addSub(InputData.parameterInputFactory("pickle")) inputSpecification.addSub(convergenceStudyInput) inputSpecification.addSub(InputData.parameterInputFactory("logFile")) inputSpecification.addSub(InputData.parameterInputFactory("maxRuns")) targetEvaluationInput = InputData.parameterInputFactory( "TargetEvaluation", contentType=InputData.StringType) targetEvaluationInput.addParam("type", InputData.StringType) targetEvaluationInput.addParam("class", InputData.StringType) inputSpecification.addSub(targetEvaluationInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for the class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(HybridModel, cls).getInputSpecification() romInput = InputData.parameterInputFactory( "ROM", contentType=InputTypes.StringType) romInput.addParam("class", InputTypes.StringType) romInput.addParam("type", InputTypes.StringType) inputSpecification.addSub(romInput) targetEvaluationInput = InputData.parameterInputFactory( "TargetEvaluation", contentType=InputTypes.StringType) targetEvaluationInput.addParam("class", InputTypes.StringType) targetEvaluationInput.addParam("type", InputTypes.StringType) inputSpecification.addSub(targetEvaluationInput) # add settings block tolInput = InputData.parameterInputFactory( "tolerance", contentType=InputTypes.FloatType) maxTrainStepInput = InputData.parameterInputFactory( "maxTrainSize", contentType=InputTypes.IntegerType) initialTrainStepInput = InputData.parameterInputFactory( "minInitialTrainSize", contentType=InputTypes.IntegerType) settingsInput = InputData.parameterInputFactory( "settings", contentType=InputTypes.StringType) settingsInput.addSub(tolInput) settingsInput.addSub(maxTrainStepInput) settingsInput.addSub(initialTrainStepInput) inputSpecification.addSub(settingsInput) # add validationMethod block threshold = InputData.parameterInputFactory( "threshold", contentType=InputTypes.FloatType) validationMethodInput = InputData.parameterInputFactory( "validationMethod", contentType=InputTypes.StringType) validationMethodInput.addParam("name", InputTypes.StringType) validationMethodInput.addSub(threshold) inputSpecification.addSub(validationMethodInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(AdaptiveMetropolis, cls).getInputSpecification() samplerInit = inputSpecification.getSub('samplerInit') adaptiveInterval = InputData.parameterInputFactory( "adaptiveInterval", contentType=InputTypes.IntegerType, descr= 'The number of sample steps for each proposal parameters update') samplerInit.addSub(adaptiveInterval) inputSpecification.addSub(samplerInit) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = InputData.parameterInputFactory( cls.__name__, ordered=False, baseNode=InputData.RavenBase) inputSpecification.addParam( "name", InputTypes.StringType, True, descr= 'User-defined name to designate this entity in the RAVEN input file.' ) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(DateBase, cls).getInputSpecification() inputSpecification.addParam("directory", InputTypes.StringType) inputSpecification.addParam("filename", InputTypes.StringType) inputSpecification.addParam( "readMode", InputTypes.makeEnumType("readMode", "readModeType", ["overwrite", "read"]), True) inputSpecification.addSub( InputData.parameterInputFactory( "variables", contentType=InputTypes.StringListType)) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(ComparisonStatistics, cls).getInputSpecification() KindInputEnumType = InputData.makeEnumType( "kind", "kindType", ["uniformBins", "equalProbability"]) KindInput = InputData.parameterInputFactory( "kind", contentType=KindInputEnumType) KindInput.addParam("numBins", InputData.IntegerType, False) KindInput.addParam("binMethod", InputData.StringType, False) inputSpecification.addSub(KindInput) ## FIXME: Is this class necessary? class CSCompareInput(InputData.ParameterInput): """ class for reading in the compare block in comparison statistics """ CSCompareInput.createClass("compare", False) CSDataInput = InputData.parameterInputFactory( "data", contentType=InputData.StringType) CSCompareInput.addSub(CSDataInput) CSReferenceInput = InputData.parameterInputFactory("reference") CSReferenceInput.addParam("name", InputData.StringType, True) CSCompareInput.addSub(CSReferenceInput) inputSpecification.addSub(CSCompareInput) FZInput = InputData.parameterInputFactory( "fz", contentType=InputData.StringType) #bool inputSpecification.addSub(FZInput) CSInterpolationEnumType = InputData.makeEnumType( "csinterpolation", "csinterpolationType", ["linear", "quadratic"]) CSInterpolationInput = InputData.parameterInputFactory( "interpolation", contentType=CSInterpolationEnumType) inputSpecification.addSub(CSInterpolationInput) DistributionInput = InputData.parameterInputFactory( "Distribution", contentType=InputData.StringType) DistributionInput.addParam("class", InputData.StringType) DistributionInput.addParam("type", InputData.StringType) inputSpecification.addSub(DistributionInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(Model, cls).getInputSpecification() inputSpecification.addParam("subType", InputData.StringType, True) ## Begin alias tag AliasInput = InputData.parameterInputFactory("alias", contentType=InputData.StringType) AliasInput.addParam("variable", InputData.StringType, True) AliasTypeInput = InputData.makeEnumType("aliasType","aliasTypeType",["input","output"]) AliasInput.addParam("type", AliasTypeInput, True) inputSpecification.addSub(AliasInput) ## End alias tag return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(CustomSampler, cls).getInputSpecification() sourceInput = InputData.parameterInputFactory( "Source", contentType=InputData.StringType) sourceInput.addParam("type", InputData.StringType) sourceInput.addParam("class", InputData.StringType) inputSpecification.addSub(sourceInput) # add "nameInSource" attribute to <variable> var = inputSpecification.popSub('variable') var.addParam("nameInSource", InputData.StringType, required=False) inputSpecification.addSub(var) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class "cls". @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying the input of cls. """ inputSpecification = super(DataObject, cls).getInputSpecification() inputSpecification.addParam('hierarchical', InputData.BoolType) inputInput = InputData.parameterInputFactory( 'Input', contentType=InputData.StringType) #TODO list inputSpecification.addSub(inputInput) outputInput = InputData.parameterInputFactory( 'Output', contentType=InputData.StringType) #TODO list inputSpecification.addSub(outputInput) # TODO this should be specific to ND set indexInput = InputData.parameterInputFactory( 'Index', contentType=InputData.StringType) #TODO list indexInput.addParam('var', InputData.StringType, True) inputSpecification.addSub(indexInput) optionsInput = InputData.parameterInputFactory("options") for option in ['operator', 'pivotParameter']: optionSubInput = InputData.parameterInputFactory( option, contentType=InputData.StringType) optionsInput.addSub(optionSubInput) for option in ['inputRow', 'outputRow']: optionSubInput = InputData.parameterInputFactory( option, contentType=InputData.IntegerType) optionsInput.addSub(optionSubInput) for option in ['outputPivotValue', 'inputPivotValue']: optionSubInput = InputData.parameterInputFactory( option, contentType=InputData.FloatType) optionsInput.addSub(optionSubInput) inputSpecification.addSub(optionsInput) #inputSpecification.addParam('type', param_type = InputData.StringType, required = False) #inputSpecification.addSub(InputData.parameterInputFactory('Input',contentType=InputData.StringType)) #inputSpecification.addSub(InputData.parameterInputFactory('Output',contentType=InputData.StringType)) #inputSpecification.addSub(InputData.parameterInputFactory('options',contentType=InputData.StringType)) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls. """ specs = super(Wavelet, cls).getInputSpecification() specs.name = 'wavelet' specs.descriiption = """Discrete Wavelet TimeSeriesAnalysis algorithm.""" specs.addSub(InputData.parameterInputFactory( 'family', contentType=InputTypes.StringType, descr="""The type of wavelet to use for the transformation. There are several possible families to choose from, and most families contain more than one variation. For more information regarding the wavelet families, refer to the Pywavelets documentation located at: https://pywavelets.readthedocs.io/en/latest/ref/wavelets.html#wavelet-families Possible values are: haar family: haar db family: db1, db2, db3, db4, db5, db6, db7, db8, db9, db10, db11, db12, db13, db14, db15, db16, db17, db18, db19, db20, db21, db22, db23, db24, db25, db26, db27, db28, db29, db30, db31, db32, db33, db34, db35, db36, db37, db38 sym family: sym2, sym3, sym4, sym5, sym6, sym7, sym8, sym9, sym10, sym11, sym12, sym13, sym14, sym15, sym16, sym17, sym18, sym19, sym20 coif family: coif1, coif2, coif3, coif4, coif5, coif6, coif7, coif8, coif9, coif10, coif11, coif12, coif13, coif14, coif15, coif16, coif17 bior family: bior1.1, bior1.3, bior1.5, bior2.2, bior2.4, bior2.6, bior2.8, bior3.1, bior3.3, bior3.5, bior3.7, bior3.9, bior4.4, bior5.5, bior6.8 rbio family: rbio1.1, rbio1.3, rbio1.5, rbio2.2, rbio2.4, rbio2.6, rbio2.8, rbio3.1, rbio3.3, rbio3.5, rbio3.7, rbio3.9, rbio4.4, rbio5.5, rbio6.8 dmey family: dmey gaus family: gaus1, gaus2, gaus3, gaus4, gaus5, gaus6, gaus7, gaus8 mexh family: mexh morl family: morl cgau family: cgau1, cgau2, cgau3, cgau4, cgau5, cgau6, cgau7, cgau8 shan family: shan fbsp family: fbsp cmor family: cmor """ )) return specs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ ## This will replace the lines above inputSpecification = super(SafestPoint, cls).getInputSpecification() OuterDistributionInput = InputData.parameterInputFactory( "Distribution", contentType=InputTypes.StringType) OuterDistributionInput.addParam("class", InputTypes.StringType) OuterDistributionInput.addParam("type", InputTypes.StringType) inputSpecification.addSub(OuterDistributionInput) VariableInput = InputData.parameterInputFactory("variable") VariableInput.addParam("name", InputTypes.StringType) InnerDistributionInput = InputData.parameterInputFactory( "distribution", contentType=InputTypes.StringType) VariableInput.addSub(InnerDistributionInput) InnerGridInput = InputData.parameterInputFactory( "grid", contentType=InputTypes.FloatType) InnerGridInput.addParam("type", InputTypes.StringType) InnerGridInput.addParam("steps", InputTypes.IntegerType) VariableInput.addSub(InnerGridInput) ControllableInput = InputData.parameterInputFactory( "controllable", contentType=InputTypes.StringType) ControllableInput.addSub(VariableInput) inputSpecification.addSub(ControllableInput) inputSpecification.addSub( InputData.parameterInputFactory("outputName", contentType=InputTypes.StringType)) NoncontrollableInput = InputData.parameterInputFactory( "non-controllable", contentType=InputTypes.StringType) NoncontrollableInput.addSub(VariableInput) inputSpecification.addSub(NoncontrollableInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ specs = super(Fourier, cls).getInputSpecification() specs.name = 'fourier' # NOTE lowercase because ARMA already has Fourier and no way to resolve right now specs.description = r"""TimeSeriesAnalysis algorithm for determining the strength and phase of specified Fourier periods within training signals. The Fourier signals take the form $C\sin(\frac{2\pi}{k}+\phi)$, where $C$ is the calculated strength or amplitude, $k$ is the user-specified period(s) to search for, and $\phi$ is the calculated phase shift. The resulting characterization and synthetic history generation is deterministic given a single training signal.""" specs.addSub( InputData.parameterInputFactory( 'periods', contentType=InputTypes.FloatListType, descr= r"""Specifies the periods (inverse of frequencies) that should be searched for within the training signal.""")) return specs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(Metric, cls).getInputSpecification() featuresInput = InputData.parameterInputFactory( "Features", contentType=InputData.StringListType) featuresInput.addParam("type", InputData.StringType) inputSpecification.addSub(featuresInput) targetsInput = InputData.parameterInputFactory( "Targets", contentType=InputData.StringListType) targetsInput.addParam("type", InputData.StringType) inputSpecification.addSub(targetsInput) multiOutputInput = InputData.parameterInputFactory( "multiOutput", contentType=InputData.StringType) inputSpecification.addSub(multiOutputInput) multiOutput = InputData.makeEnumType( 'MultiOutput', 'MultiOutputType', ['mean', 'max', 'min', 'raw_values']) multiOutputInput = InputData.parameterInputFactory( "multiOutput", contentType=multiOutput) inputSpecification.addSub(multiOutputInput) weightInput = InputData.parameterInputFactory( "weight", contentType=InputData.FloatListType) inputSpecification.addSub(weightInput) pivotParameterInput = InputData.parameterInputFactory( "pivotParameter", contentType=InputData.StringType) inputSpecification.addSub(pivotParameterInput) metricInput = InputData.parameterInputFactory( "Metric", contentType=InputData.StringType) metricInput.addParam("class", InputData.StringType, True) metricInput.addParam("type", InputData.StringType, True) inputSpecification.addSub(metricInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(AdaptiveMonteCarlo, cls).getInputSpecification() # TODO this class should use MonteCarlo's "limit" definition, probably? convergenceInput = InputData.parameterInputFactory('Convergence') convergenceInput.addSub( InputData.parameterInputFactory( 'limit', contentType=InputTypes.IntegerType)) convergenceInput.addSub( InputData.parameterInputFactory('forceIteration', contentType=InputTypes.BoolType)) convergenceInput.addSub( InputData.parameterInputFactory( 'persistence', contentType=InputTypes.IntegerType)) for metric, _ in cls.usableStats: statErSpecification = InputData.parameterInputFactory( metric, contentType=InputTypes.StringListType) statErSpecification.addParam("prefix", InputTypes.StringType) statErSpecification.addParam("tol", InputTypes.FloatType) convergenceInput.addSub(statErSpecification) inputSpecification.addSub(convergenceInput) targetEvaluationInput = InputData.parameterInputFactory( "TargetEvaluation", contentType=InputTypes.StringType) targetEvaluationInput.addParam("type", InputTypes.StringType) targetEvaluationInput.addParam("class", InputTypes.StringType) inputSpecification.addSub(targetEvaluationInput) inputSpecification.addSub( InputData.parameterInputFactory( "initialSeed", contentType=InputTypes.IntegerType)) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(ResponseSurfaceDesign, cls).getInputSpecification() responseSurfaceDesignSettingsInput = InputData.parameterInputFactory("ResponseSurfaceDesignSettings") responseSurfaceDesignSettingsInput.addSub(InputData.parameterInputFactory("algorithmType", contentType=InputData.StringType)) responseSurfaceDesignSettingsInput.addSub(InputData.parameterInputFactory("ncenters", contentType=InputData.IntegerType)) responseSurfaceDesignSettingsInput.addSub(InputData.parameterInputFactory("centers", contentType=InputData.StringListType)) responseSurfaceDesignSettingsInput.addSub(InputData.parameterInputFactory("alpha", contentType=InputData.StringType)) responseSurfaceDesignSettingsInput.addSub(InputData.parameterInputFactory("face", contentType=InputData.StringType)) inputSpecification.addSub(responseSurfaceDesignSettingsInput) return inputSpecification
def getInputSpecification(cls): """ Collects input specifications for this class. @ In, None @ Out, inputSpecs, InputData, specs """ inputSpecs = super(BathtubModel, cls).getInputSpecification() inputSpecs.description = r""" Bathtub reliability model, see reference "B. S. Dhillon, "A Hazard Rate Model," IEEE Trans. Rel. 29, 150 (1979)" """ inputSpecs.addSub( InputData.parameterInputFactory( 'alpha', contentType=InputTypes.InterpretedListType, descr='Shape parameter')) inputSpecs.addSub( InputData.parameterInputFactory( 'beta', contentType=InputTypes.InterpretedListType, descr='Scale parameter')) inputSpecs.addSub( InputData.parameterInputFactory( 'c', contentType=InputTypes.InterpretedListType, descr='Weight parameter, 0<=c<=1')) inputSpecs.addSub( InputData.parameterInputFactory( 'theta', contentType=InputTypes.InterpretedListType, descr='Scale parameter')) inputSpecs.addSub( InputData.parameterInputFactory( 'rho', contentType=InputTypes.InterpretedListType, descr='Shape parameter')) inputSpecs.addSub( InputData.parameterInputFactory( 'Tm', contentType=InputTypes.InterpretedListType, descr='Mission time')) return inputSpecs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ ## This will replace the lines above inputSpecification = super(TopologicalDecomposition, cls).getInputSpecification() TDGraphInput = InputData.parameterInputFactory( "graph", contentType=InputData.StringType) inputSpecification.addSub(TDGraphInput) TDGradientInput = InputData.parameterInputFactory( "gradient", contentType=InputData.StringType) inputSpecification.addSub(TDGradientInput) TDBetaInput = InputData.parameterInputFactory( "beta", contentType=InputData.FloatType) inputSpecification.addSub(TDBetaInput) TDKNNInput = InputData.parameterInputFactory( "knn", contentType=InputData.IntegerType) inputSpecification.addSub(TDKNNInput) TDWeightedInput = InputData.parameterInputFactory( "weighted", contentType=InputData.StringType) #bool inputSpecification.addSub(TDWeightedInput) TDInteractiveInput = InputData.parameterInputFactory( "interactive", contentType=InputData.StringType) #bool inputSpecification.addSub(TDInteractiveInput) TDPersistenceInput = InputData.parameterInputFactory( "persistence", contentType=InputData.StringType) inputSpecification.addSub(TDPersistenceInput) TDSimplificationInput = InputData.parameterInputFactory( "simplification", contentType=InputData.FloatType) inputSpecification.addSub(TDSimplificationInput) TDParametersInput = InputData.parameterInputFactory( "parameters", contentType=InputData.StringType) inputSpecification.addSub(TDParametersInput) TDResponseInput = InputData.parameterInputFactory( "response", contentType=InputData.StringType) inputSpecification.addSub(TDResponseInput) TDNormalizationInput = InputData.parameterInputFactory( "normalization", contentType=InputData.StringType) inputSpecification.addSub(TDNormalizationInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. This one seems a bit excessive, are all of these for this class? @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(ROM, cls).getInputSpecification() IndexSetInputType = InputData.makeEnumType( "indexSet", "indexSetType", ["TensorProduct", "TotalDegree", "HyperbolicCross", "Custom"]) CriterionInputType = InputData.makeEnumType( "criterion", "criterionType", ["bic", "aic", "gini", "entropy", "mse"]) InterpolationInput = InputData.parameterInputFactory( 'Interpolation', contentType=InputData.StringType) InterpolationInput.addParam("quad", InputData.StringType, False) InterpolationInput.addParam("poly", InputData.StringType, False) InterpolationInput.addParam("weight", InputData.FloatType, False) inputSpecification.addSub( InputData.parameterInputFactory('Features', contentType=InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory('Target', contentType=InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("IndexPoints", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("IndexSet", IndexSetInputType)) inputSpecification.addSub( InputData.parameterInputFactory('pivotParameter', contentType=InputData.StringType)) inputSpecification.addSub(InterpolationInput) inputSpecification.addSub( InputData.parameterInputFactory("PolynomialOrder", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("SobolOrder", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("SparseGrid", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("persistence", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("gradient", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("simplification", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("graph", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("beta", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("knn", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("partitionPredictor", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("smooth", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("kernel", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("bandwidth", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("p", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("SKLtype", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("n_iter", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("tol", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("alpha_1", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("alpha_2", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("lambda_1", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("lambda_2", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("compute_score", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("threshold_lambda", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("fit_intercept", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("normalize", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("verbose", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("alpha", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("l1_ratio", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("max_iter", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("warm_start", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("positive", InputData.StringType)) #bool? inputSpecification.addSub( InputData.parameterInputFactory("eps", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("n_alphas", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("precompute", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("n_nonzero_coefs", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("fit_path", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("max_n_alphas", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("criterion", CriterionInputType)) inputSpecification.addSub( InputData.parameterInputFactory("penalty", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("dual", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("C", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("intercept_scaling", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("class_weight", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("random_state", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("cv", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("shuffle", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("loss", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("epsilon", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("eta0", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("solver", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("alphas", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("scoring", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("gcv_mode", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("store_cv_values", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("learning_rate", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("power_t", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("multi_class", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("kernel", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("degree", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("gamma", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("coef0", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("probability", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("shrinking", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("cache_size", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("nu", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("code_size", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("fit_prior", InputData.StringType)) #bool inputSpecification.addSub( InputData.parameterInputFactory("class_prior", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("binarize", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("n_neighbors", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("weights", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("algorithm", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("leaf_size", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("metric", InputData.StringType)) #enum? inputSpecification.addSub( InputData.parameterInputFactory("radius", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("outlier_label", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("shrink_threshold", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("priors", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("reg_param", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("splitter", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("max_features", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("max_depth", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("min_samples_split", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("min_samples_leaf", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("max_leaf_nodes", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("regr", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("corr", InputData.StringType)) #enum? inputSpecification.addSub( InputData.parameterInputFactory("beta0", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("storage_mode", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("theta0", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("thetaL", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("thetaU", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("nugget", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("optimizer", InputData.StringType)) #enum inputSpecification.addSub( InputData.parameterInputFactory("random_start", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("Pmax", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("Pmin", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("Qmax", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("Qmin", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("outTruncation", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("Fourier", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("FourierOrder", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("reseedCopies", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("reseedValue", InputData.IntegerType)) # inputs for neural_network inputSpecification.addSub( InputData.parameterInputFactory("hidden_layer_sizes", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("activation", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("batch_size", InputData.StringType)) inputSpecification.addSub( InputData.parameterInputFactory("learning_rate_init", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("momentum", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("nesterovs_momentum", InputData.StringType)) # bool inputSpecification.addSub( InputData.parameterInputFactory("early_stopping", InputData.StringType)) # bool inputSpecification.addSub( InputData.parameterInputFactory("validation_fraction", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("beta_1", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("beta_2", InputData.FloatType)) # PolyExp inputSpecification.addSub( InputData.parameterInputFactory("maxNumberExpTerms", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("numberExpTerms", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("maxPolyOrder", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("polyOrder", InputData.IntegerType)) coeffRegressorEnumType = InputData.makeEnumType( "coeffRegressor", "coeffRegressorType", ["poly", "spline", "nearest"]) inputSpecification.addSub( InputData.parameterInputFactory( "coeffRegressor", contentType=coeffRegressorEnumType)) # DMD inputSpecification.addSub( InputData.parameterInputFactory("rankSVD", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("energyRankSVD", InputData.FloatType)) inputSpecification.addSub( InputData.parameterInputFactory("rankTLSQ", InputData.IntegerType)) inputSpecification.addSub( InputData.parameterInputFactory("exactModes", InputData.BoolType)) inputSpecification.addSub( InputData.parameterInputFactory("optimized", InputData.BoolType)) inputSpecification.addSub( InputData.parameterInputFactory("dmdType", InputData.StringType)) #Estimators can include ROMs, and so because baseNode does a copy, this #needs to be after the rest of ROMInput is defined. EstimatorInput = InputData.parameterInputFactory( 'estimator', contentType=InputData.StringType, baseNode=inputSpecification) EstimatorInput.addParam("estimatorType", InputData.StringType, False) #The next lines are to make subType and name not required. EstimatorInput.addParam("subType", InputData.StringType, False) EstimatorInput.addParam("name", InputData.StringType, False) inputSpecification.addSub(EstimatorInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls. """ specs = super(SimulatedAnnealing, cls).getInputSpecification() specs.description = r"""The \xmlNode{SimulatedAnnealing} optimizer is a metaheuristic approach to perform a global search in large design spaces. The methodology rose from statistical physics and was inspitred by metallurgy where it was found that fast cooling might lead to smaller and defected crystals, and that reheating and slowly controling cooling will lead to better states. This allows climbing to avoid being stuck in local minima and hence facilitates finding the global minima for non-convex probloems. More information can be found in: Kirkpatrick, S.; Gelatt Jr, C. D.; Vecchi, M. P. (1983). ``Optimization by Simulated Annealing". Science. 220 (4598): 671–680.""" # convergence conv = InputData.parameterInputFactory( 'convergence', strictMode=True, printPriority=108, descr= r"""a node containing the desired convergence criteria for the optimization algorithm. Note that convergence is met when any one of the convergence criteria is met. If no convergence criteria are given, then the defaults are used.""") specs.addSub(conv) for name, descr in cls.convergenceOptions.items(): conv.addSub( InputData.parameterInputFactory( name, contentType=InputTypes.FloatType, descr=descr, printPriority=108)) # Presistance conv.addSub( InputData.parameterInputFactory( 'persistence', contentType=InputTypes.IntegerType, printPriority=109, descr= r"""provides the number of consecutive times convergence should be reached before a trajectory is considered fully converged. This helps in preventing early false convergence.""" )) # Cooling Schedule coolingSchedule = InputData.parameterInputFactory( 'coolingSchedule', printPriority=109, descr= r""" The function governing the cooling process. Currently, user can select between,""" # \xmlString{linear}, + r"""\xmlString{exponential}, \xmlString{cauchy}, \xmlString{boltzmann},""" # \xmlString{fast}, + r"""or \xmlString{veryfast}.\\ \\""" #In case of \xmlString{linear} is provided, The cooling process will be governed by: $$ T^{k} = T^0 - 0.1 * k$$ + r"""In case of \xmlString{exponential} is provided, The cooling process will be governed by: $$ T^{k} = T^0 * \alpha^k$$ In case of \xmlString{boltzmann} is provided, The cooling process will be governed by: $$ T^{k} = \frac{T^0}{log(k + d)}$$ In case of \xmlString{cauchy} is provided, The cooling process will be governed by: $$ T^{k} = \frac{T^0}{k + d}$$""" #In case of \xmlString{fast} is provided, The cooling process will be governed by: $$ T^{k} = T^0 * \exp(-ck)$$ + r"""In case of \xmlString{veryfast} is provided, The cooling process will be governed by: $$ T^{k} = T^0 * \exp(-ck^{1/D}),$$ where $D$ is the dimentionality of the problem (i.e., number of optimized variables), $k$ is the number of the current iteration $T^{0} = \max{(0.01,1-\frac{k}{\xmlNode{limit}})}$ is the initial temperature, and $T^{k}$ is the current temperature according to the specified cooling schedule. \default{exponential}.""") specs.addSub(coolingSchedule) for schedule, param in cls.coolingOptions.items( ): # FIXME: right now this allows multiple cooling schedule, which should be fixed as soon as # InputData can allow having list of subnodes sch = InputData.parameterInputFactory( schedule, contentType=InputTypes.StringType, descr=schedule + ' cooling schedule') for par, descr in param.items(): sch.addSub( InputData.parameterInputFactory( par, contentType=InputTypes.FloatType, descr=descr)) coolingSchedule.addSub(sch) return specs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls. """ specs = super(Optimizer, cls).getInputSpecification() specs.description = 'Optimizers' # objective variable specs.addSub(InputData.parameterInputFactory('objective', contentType=InputTypes.StringType, strictMode=True, printPriority=90, # more important than <variable> descr=r"""Name of the response variable (or ``objective function'') that should be optimized (minimized or maximized).""")) # modify Sampler variable nodes variable = specs.getSub('variable') variable.addSub(InputData.parameterInputFactory('initial', contentType=InputTypes.FloatListType, descr=r"""indicates the initial values where independent trajectories for this optimization effort should begin. The number of entries should be the same for all variables, unless a variable is initialized with a sampler (see \xmlNode{samplerInit} below). Note these entries are ordered; that is, if the optimization variables are $x$ and $y$, and the initial values for $x$ are \xmlString{1, 2, 3, 4} and initial values for $y$ are \xmlString{5, 6, 7, 8}, then there will be four starting trajectories beginning at the locations (1, 5), (2, 6), (3, 7), and (4, 8).""")) # initialization ## TODO similar to MonteCarlo and other samplers, maybe overlap? init = InputData.parameterInputFactory('samplerInit', strictMode=True, printPriority=105, # more important than <variable> descr=r"""collection of nodes that describe the initialization of the optimization algorithm.""") seed = InputData.parameterInputFactory('initialSeed', contentType=InputTypes.IntegerType, descr=r"""seed for random number generation. Note that by default RAVEN uses an internal seed, so this seed must be changed to observe changed behavior. \default{RAVEN-determined}""") minMaxEnum = InputTypes.makeEnumType('MinMax', 'MinMaxType', ['min', 'max']) minMax = InputData.parameterInputFactory('type', contentType=minMaxEnum, descr=r"""the type of optimization to perform. \xmlString{min} will search for the lowest \xmlNode{objective} value, while \xmlString{max} will search for the highest value.""") init.addSub(seed) init.addSub(minMax) specs.addSub(init) ConstraintInput = InputData.parameterInputFactory('Constraint', contentType=InputTypes.StringType, strictMode=True, printPriority=150, descr=r"""name of \xmlNode{Function} which contains explicit constraints for the sampling of the input space of the Model. From a practical point of view, this XML node must contain the name of a function defined in the \xmlNode{Functions} block (see Section~\ref{sec:functions}). This external function must contain a method called ``constrain'', which returns True for inputs satisfying the explicit constraints and False otherwise.""") ConstraintInput.addParam("class", InputTypes.StringType, True, descr=r"""RAVEN class for this source. Options include \xmlString{Functions}. """) ConstraintInput.addParam("type", InputTypes.StringType, True, descr=r"""RAVEN type for this source. Options include \xmlNode{External}.""") ImplicitConstraintInput = InputData.parameterInputFactory('ImplicitConstraint', contentType=InputTypes.StringType, strictMode=True, printPriority=150, descr=r"""name of \xmlNode{Function} which contains implicit constraints of the Model. From a practical point of view, this XML node must contain the name of a function defined in the \xmlNode{Functions} block (see Section~\ref{sec:functions}). This external function must contain a method called ``implicitConstrain'', which returns True for outputs satisfying the implicit constraints and False otherwise.""") ImplicitConstraintInput.addParam("class", InputTypes.StringType, True, descr=r"""RAVEN class for this source. Options include \xmlString{Functions}. """) ImplicitConstraintInput.addParam("type", InputTypes.StringType, True, descr=r"""RAVEN type for this source. Options include \xmlNode{External}.""") specs.addSub(ConstraintInput) specs.addSub(ImplicitConstraintInput) # assembled objects specs.addSub(InputData.assemblyInputFactory('Sampler', contentType=InputTypes.StringType, strictMode=True, printPriority=175, descr=r"""name of a Sampler that can be used to initialize the starting points for the trajectories of some of the variables. From a practical point of view, this XML node must contain the name of a Sampler defined in the \xmlNode{Samplers} block (see Section~\ref{subsec:onceThroughSamplers}). The Sampler will be used to initialize the trajectories' initial points for some or all of the variables. For example, if the Sampler selected samples only 2 of the 5 optimization variables, the \xmlNode{initial} XML node is required only for the remaining 3 variables.""")) return specs
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ inputSpecification = super(AdaptiveSobol, cls).getInputSpecification() #Remove old convergence and convergenceStudy from AdaptiveSparseGrid inputSpecification.popSub("Convergence") inputSpecification.popSub("convergenceStudy") convergenceInput = InputData.parameterInputFactory("Convergence") convergenceInput.addSub(InputData.parameterInputFactory("relTolerance", contentType=InputTypes.FloatType)) convergenceInput.addSub(InputData.parameterInputFactory("maxRuns", contentType=InputTypes.IntegerType)) convergenceInput.addSub(InputData.parameterInputFactory("maxSobolOrder", contentType=InputTypes.IntegerType)) convergenceInput.addSub(InputData.parameterInputFactory("progressParam", contentType=InputTypes.FloatType)) convergenceInput.addSub(InputData.parameterInputFactory("logFile", contentType=InputTypes.StringType)) convergenceInput.addSub(InputData.parameterInputFactory("subsetVerbosity", contentType=InputTypes.StringType)) inputSpecification.addSub(convergenceInput) convergenceStudyInput = InputData.parameterInputFactory("convergenceStudy") convergenceStudyInput.addSub(InputData.parameterInputFactory("runStatePoints", contentType=InputTypes.StringType)) convergenceStudyInput.addSub(InputData.parameterInputFactory("baseFilename", contentType=InputTypes.StringType)) convergenceStudyInput.addSub(InputData.parameterInputFactory("pickle")) inputSpecification.addSub(convergenceStudyInput) return inputSpecification
def getInputSpecification(cls): """ Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls. """ ## This will replace the lines above inputSpecification = super(DataMining, cls).getInputSpecification() preProcessorInput = InputData.parameterInputFactory("PreProcessor", contentType=InputTypes.StringType) preProcessorInput.addParam("class", InputTypes.StringType) preProcessorInput.addParam("type", InputTypes.StringType) pivotParameterInput = InputData.parameterInputFactory("pivotParameter", contentType=InputTypes.StringType) inputSpecification.addSub(pivotParameterInput) dataObjectInput = InputData.parameterInputFactory("DataObject", contentType=InputTypes.StringType) dataObjectInput.addParam("class", InputTypes.StringType) dataObjectInput.addParam("type", InputTypes.StringType) inputSpecification.addSub(dataObjectInput) metricInput = InputData.parameterInputFactory("Metric", contentType=InputTypes.StringType) metricInput.addParam("class", InputTypes.StringType) metricInput.addParam("type", InputTypes.StringType) inputSpecification.addSub(metricInput) kddInput = InputData.parameterInputFactory("KDD") kddInput.addParam("lib", InputTypes.StringType) kddInput.addParam("labelFeature", InputTypes.StringType) sklTypeInput = InputData.parameterInputFactory("SKLtype", contentType=InputTypes.StringType) kddInput.addSub(sklTypeInput) sciPyTypeInput = InputData.parameterInputFactory("SCIPYtype", contentType=InputTypes.StringType) kddInput.addSub(sciPyTypeInput) for name, inputType in [("interactive",InputTypes.StringType), ("Features",InputTypes.StringType), ("n_components",InputTypes.StringType), ("covariance_type",InputTypes.StringType), ("random_state",InputTypes.StringType), ("min_covar",InputTypes.FloatType), ("thresh",InputTypes.FloatType), ("n_iter",InputTypes.IntegerType), ("n_init",InputTypes.IntegerType), ("params",InputTypes.StringType), ("init_params",InputTypes.StringType), ("alpha",InputTypes.FloatType), ("n_clusters",InputTypes.IntegerType), ("max_iter",InputTypes.IntegerType), ("init",InputTypes.StringType), ("precompute_distances",InputTypes.StringType), ("tol",InputTypes.FloatType), ("n_jobs",InputTypes.IntegerType), ("max_no_improvement",InputTypes.IntegerType), ("batch_size",InputTypes.IntegerType), ("compute_labels",InputTypes.StringType), ("reassignment_ratio",InputTypes.FloatType), ("damping",InputTypes.StringType), ("convergence_iter",InputTypes.IntegerType), ("copy",InputTypes.StringType), ("preference",InputTypes.StringType), ("affinity",InputTypes.StringType), ("verbose",InputTypes.StringType), ("bandwidth",InputTypes.FloatType), ("seeds",InputTypes.StringType), ("bin_seeding",InputTypes.StringType), ("min_bin_freq",InputTypes.IntegerType), ("cluster_all",InputTypes.StringType), ("gamma",InputTypes.FloatType), ("degree",InputTypes.StringType), ("coef0",InputTypes.FloatType), ("n_neighbors",InputTypes.IntegerType), ("eigen_solver",InputTypes.StringType), ("eigen_tol",InputTypes.FloatType), ("assign_labels",InputTypes.StringType), ("kernel_params",InputTypes.StringType), ("eps",InputTypes.StringType), ("min_samples",InputTypes.IntegerType), ("metric", InputTypes.StringType), ("connectivity",InputTypes.StringType), ("linkage",InputTypes.StringType), ("whiten",InputTypes.StringType), ("iterated_power",InputTypes.StringType), ("kernel",InputTypes.StringType), ("fit_inverse_transform",InputTypes.StringType), ("remove_zero_eig",InputTypes.StringType), ("ridge_alpha",InputTypes.FloatType), ("method",InputTypes.StringType), ("U_init",InputTypes.StringType), ("V_init",InputTypes.StringType), ("callback",InputTypes.StringType), ("shuffle",InputTypes.StringType), ("algorithm",InputTypes.StringType), ("fun",InputTypes.StringType), ("fun_args",InputTypes.StringType), ("w_init",InputTypes.StringType), ("path_method",InputTypes.StringType), ("neighbors_algorithm",InputTypes.StringType), ("reg",InputTypes.FloatType), ("hessian_tol",InputTypes.FloatType), ("modified_tol",InputTypes.FloatType), ("dissimilarity",InputTypes.StringType), ("level",InputTypes.StringType), ("criterion",InputTypes.StringType), ("dendrogram",InputTypes.StringType), ("truncationMode",InputTypes.StringType), ("p",InputTypes.IntegerType), ("leafCounts",InputTypes.StringType), ("showContracted",InputTypes.StringType), ("annotatedAbove",InputTypes.FloatType), ("dendFileID",InputTypes.StringType)]: dataType = InputData.parameterInputFactory(name, contentType=inputType) kddInput.addSub(dataType) inputSpecification.addSub(kddInput) inputSpecification.addSub(preProcessorInput) return inputSpecification