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
Exemple #2
0
    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(Code, cls).getInputSpecification()
        inputSpecification.setStrictMode(
            False)  #Code interfaces can allow new elements.
        inputSpecification.addSub(
            InputData.parameterInputFactory("executable",
                                            contentType=InputData.StringType))
        inputSpecification.addSub(
            InputData.parameterInputFactory("preexec",
                                            contentType=InputData.StringType))

        ## Begin command line arguments tag
        ClargsInput = InputData.parameterInputFactory("clargs")

        ClargsTypeInput = InputData.makeEnumType(
            "clargsType", "clargsTypeType",
            ["text", "input", "output", "prepend", "postpend"])
        ClargsInput.addParam("type", ClargsTypeInput, True)

        ClargsInput.addParam("arg", InputData.StringType, False)
        ClargsInput.addParam("extension", InputData.StringType, False)
        inputSpecification.addSub(ClargsInput)
        ## End command line arguments tag

        ## Begin file arguments tag
        FileargsInput = InputData.parameterInputFactory("fileargs")

        FileargsTypeInput = InputData.makeEnumType(
            "fileargsType", "fileargsTypeType",
            ["input", "output", "moosevpp"])
        FileargsInput.addParam("type", FileargsTypeInput, True)

        FileargsInput.addParam("arg", InputData.StringType, False)
        FileargsInput.addParam("extension", InputData.StringType, False)
        inputSpecification.addSub(FileargsInput)
        ## End file arguments tag

        return inputSpecification
Exemple #3
0
 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", InputData.StringType)
   inputSpecification.addParam("filename", InputData.StringType)
   inputSpecification.addParam("readMode", InputData.makeEnumType("readMode","readModeType",["overwrite","read"]), True)
   inputSpecification.addSub(InputData.parameterInputFactory("variables", contentType=InputData.StringListType))
   return inputSpecification
Exemple #4
0
  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(DTW, cls).getInputSpecification()
    orderInputType = InputData.makeEnumType("order","orderType",["0","1"])
    inputSpecification.addSub(InputData.parameterInputFactory("order",contentType=orderInputType),quantity=InputData.Quantity.one)
    inputSpecification.addSub(InputData.parameterInputFactory("localDistance",contentType=InputData.StringType),quantity=InputData.Quantity.one)

    return inputSpecification
Exemple #5
0
 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(FTImporter, cls).getInputSpecification()
     fileAllowedFormats = InputData.makeEnumType("FTFileFormat",
                                                 "FTFileFormatType",
                                                 ["OpenPSA"])
     inputSpecification.addSub(
         InputData.parameterInputFactory("fileFormat",
                                         contentType=fileAllowedFormats))
     inputSpecification.addSub(
         InputData.parameterInputFactory("topEventID",
                                         contentType=InputData.StringType))
     return inputSpecification
Exemple #6
0
  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
Exemple #7
0
    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
Exemple #8
0
    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
Exemple #9
0
  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"])

    # general
    inputSpecification.addSub(InputData.parameterInputFactory('Features',contentType=InputData.StringType))
    inputSpecification.addSub(InputData.parameterInputFactory('Target',contentType=InputData.StringType))
    # segmenting and clustering
    segment = InputData.parameterInputFactory("Segment", strictMode=True)
    segmentGroups = InputData.makeEnumType('segmentGroup', 'sesgmentGroupType', ['segment', 'cluster'])
    segment.addParam('grouping', segmentGroups)
    subspace = InputData.parameterInputFactory('subspace', InputData.StringType)
    subspace.addParam('divisions', InputData.IntegerType, False)
    subspace.addParam('pivotLength', InputData.FloatType, False)
    subspace.addParam('shift', InputData.StringType, False)
    segment.addSub(subspace)
    clsfr = InputData.parameterInputFactory('Classifier', strictMode=True, contentType=InputData.StringType)
    clsfr.addParam('class', InputData.StringType, True)
    clsfr.addParam('type', InputData.StringType, True)
    segment.addSub(clsfr)
    metric = InputData.parameterInputFactory('Metric', strictMode=True, contentType=InputData.StringType)
    metric.addParam('class', InputData.StringType, True)
    metric.addParam('type', InputData.StringType, True)
    segment.addSub(metric)
    feature = InputData.parameterInputFactory('feature', strictMode=True, contentType=InputData.StringType)
    feature.addParam('weight', InputData.FloatType)
    segment.addSub(feature)
    inputSpecification.addSub(segment)
    # unsorted
    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))
    # GaussPolynomialROM and HDMRRom
    inputSpecification.addSub(InputData.parameterInputFactory("IndexPoints", InputData.StringType))
    inputSpecification.addSub(InputData.parameterInputFactory("IndexSet", contentType=IndexSetInputType))
    inputSpecification.addSub(InputData.parameterInputFactory('pivotParameter', contentType=InputData.StringType))
    inputSpecification.addSub(InputData.parameterInputFactory("PolynomialOrder", InputData.IntegerType))
    inputSpecification.addSub(InputData.parameterInputFactory("SobolOrder", InputData.IntegerType))
    inputSpecification.addSub(InputData.parameterInputFactory("SparseGrid", InputData.StringType))
    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(InterpolationInput)
    # ARMA
    inputSpecification.addSub(InputData.parameterInputFactory('correlate', InputData.StringListType))
    inputSpecification.addSub(InputData.parameterInputFactory("P", InputData.IntegerType))
    inputSpecification.addSub(InputData.parameterInputFactory("Q", InputData.IntegerType))
    inputSpecification.addSub(InputData.parameterInputFactory("seed", InputData.IntegerType))
    inputSpecification.addSub(InputData.parameterInputFactory("reseedCopies", InputData.StringType))
    inputSpecification.addSub(InputData.parameterInputFactory("Fourier", contentType=InputData.FloatListType))
    inputSpecification.addSub(InputData.parameterInputFactory("preserveInputCDF", contentType=InputData.BoolType))
    ### ARMA zero filter
    zeroFilt = InputData.parameterInputFactory('ZeroFilter', contentType=InputData.StringType)
    zeroFilt.addParam('tol', InputData.FloatType)
    inputSpecification.addSub(zeroFilt)
    ### ARMA out truncation
    outTrunc = InputData.parameterInputFactory('outTruncation', contentType=InputData.StringListType)
    domainEnumType = InputData.makeEnumType('domain', 'truncateDomainType', ['positive', 'negative'])
    outTrunc.addParam('domain', domainEnumType, True)
    inputSpecification.addSub(outTrunc)
    ### ARMA specific fourier
    specFourier = InputData.parameterInputFactory('SpecificFourier', strictMode=True)
    specFourier.addParam("variables", InputData.StringListType, True)
    specFourier.addSub(InputData.parameterInputFactory('periods', contentType=InputData.FloatListType))
    inputSpecification.addSub(specFourier)
    # 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
Exemple #10
0
    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.
    """
        #### FULL INPUT LIST SPSA #### -> * means part of FiniteDiff as well
        # so far, there's no distinction between optimizers, so all the input from SPSA is here.  Fix this when we sort out optimizers.

        inputSpecification = super(Optimizer, cls).getInputSpecification()
        # assembled objects
        targEval = InputData.parameterInputFactory(
            'TargetEvaluation',
            contentType=InputData.StringType,
            strictMode=True)
        targEval.addParam('type', InputData.StringType, True)
        targEval.addParam('class', InputData.StringType, True)
        inputSpecification.addSub(targEval)
        sampler = InputData.parameterInputFactory(
            'Sampler', contentType=InputData.StringType, strictMode=True)
        sampler.addParam('type', InputData.StringType, True)
        sampler.addParam('class', InputData.StringType, True)
        inputSpecification.addSub(sampler)
        function = InputData.parameterInputFactory(
            'Function', contentType=InputData.StringType, strictMode=True)
        function.addParam('type', InputData.StringType, True)
        function.addParam('class', InputData.StringType, True)
        inputSpecification.addSub(function)
        precond = InputData.parameterInputFactory(
            'Preconditioner',
            contentType=InputData.StringType,
            strictMode=True)
        precond.addParam('type', InputData.StringType, True)
        precond.addParam('class', InputData.StringType, True)
        inputSpecification.addSub(precond)

        # variable
        ## was also part of Sampler, but we need to rewrite variable, so remove it first
        inputSpecification.removeSub('variable')
        variable = InputData.parameterInputFactory('variable', strictMode=True)
        variable.addParam("name", InputData.StringType, True)
        variable.addParam("shape", InputData.IntegerListType, required=False)
        upperBound = InputData.parameterInputFactory(
            'upperBound', contentType=InputData.FloatType, strictMode=True)
        lowerBound = InputData.parameterInputFactory(
            'lowerBound', contentType=InputData.FloatType, strictMode=True)
        initial = InputData.parameterInputFactory(
            'initial', contentType=InputData.StringListType)
        variable.addSub(upperBound)
        variable.addSub(lowerBound)
        variable.addSub(initial)
        inputSpecification.addSub(variable)
        # constant -> use the Sampler's specs.

        # objectVar
        objectVar = InputData.parameterInputFactory(
            'objectVar', contentType=InputData.StringType, strictMode=True)
        inputSpecification.addSub(objectVar)

        # initialization
        init = InputData.parameterInputFactory('initialization',
                                               strictMode=True)
        whenWriteEnum = InputData.makeEnumType('whenWriteEnum',
                                               'whenWriteType',
                                               ['final', 'every'])
        limit = InputData.parameterInputFactory(
            'limit', contentType=InputData.IntegerType)
        seed = InputData.parameterInputFactory(
            'initialSeed', contentType=InputData.IntegerType)
        minmaxEnum = InputData.makeEnumType('MinMax', 'OptimizerTypeType',
                                            ['min', 'max'])
        minmax = InputData.parameterInputFactory('type',
                                                 contentType=minmaxEnum)
        thresh = InputData.parameterInputFactory(
            'thresholdTrajRemoval', contentType=InputData.FloatType)
        write = InputData.parameterInputFactory('writeSteps',
                                                contentType=whenWriteEnum)
        init.addSub(limit)
        init.addSub(seed)
        init.addSub(minmax)
        init.addSub(thresh)
        init.addSub(write)
        inputSpecification.addSub(init)

        # convergence
        conv = InputData.parameterInputFactory('convergence', strictMode=True)
        itLim = InputData.parameterInputFactory(
            'iterationLimit', contentType=InputData.IntegerType)
        pers = InputData.parameterInputFactory(
            'persistence', contentType=InputData.IntegerType)
        rel = InputData.parameterInputFactory('relativeThreshold',
                                              contentType=InputData.FloatType)
        abst = InputData.parameterInputFactory('absoluteThreshold',
                                               contentType=InputData.FloatType)
        grad = InputData.parameterInputFactory('gradientThreshold',
                                               contentType=InputData.FloatType)
        minstep = InputData.parameterInputFactory(
            'minStepSize', contentType=InputData.FloatType)
        grow = InputData.parameterInputFactory('gainGrowthFactor',
                                               contentType=InputData.FloatType)
        shrink = InputData.parameterInputFactory(
            'gainShrinkFactor', contentType=InputData.FloatType)
        conv.addSub(itLim)
        conv.addSub(pers)
        conv.addSub(rel)
        conv.addSub(abst)
        conv.addSub(grad)
        conv.addSub(minstep)
        conv.addSub(grow)
        conv.addSub(shrink)
        inputSpecification.addSub(conv)

        # parameter
        param = InputData.parameterInputFactory('parameter', strictMode=True)
        stochEnum = InputData.makeEnumType('StochDistEnum', 'StochDistType',
                                           ['Hypersphere', 'Bernoulli'])
        num = InputData.parameterInputFactory(
            'numGradAvgIterations', contentType=InputData.IntegerType)
        stoch = InputData.parameterInputFactory('stochasticDistribution',
                                                contentType=stochEnum)
        bisect = InputData.parameterInputFactory(
            'innerBisectionThreshold', contentType=InputData.FloatType)
        loop = InputData.parameterInputFactory(
            'innerLoopLimit', contentType=InputData.IntegerType)
        param.addSub(num)
        param.addSub(stoch)
        param.addSub(bisect)
        param.addSub(loop)
        inputSpecification.addSub(param)

        return inputSpecification