コード例 #1
0
class Hyperparams(hyperparams.Hyperparams):
    backbone = hyperparams.Union(
        OrderedDict({
            'resnet50': hyperparams.Constant[str](
                default = 'resnet50',
                semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
                description = "Backbone architecture from resnet50 architecture (https://arxiv.org/abs/1512.03385)"
            ),
            'resnet101': hyperparams.Constant[str](
                default = 'resnet101',
                semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
                description = "Backbone architecture from resnet101 architecture (https://arxiv.org/abs/1512.03385)"
            ),
            'resnet152': hyperparams.Constant[str](
                default = 'resnet152',
                semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
                description = "Backbone architecture from resnet152 architecture (https://arxiv.org/abs/1512.03385)"
            )
        }),
        default = 'resnet50',
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
        description = "Backbone architecture from which RetinaNet is built. All backbones " +
                      "require a weights file downloaded for use during runtime."
    )
    batch_size = hyperparams.Hyperparameter[int](
        default = 1,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
        description = "Size of the batches as input to the model."
    )
    n_epochs = hyperparams.Hyperparameter[int](
        default = 20,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
        description = "Number of epochs to train."
    )
    freeze_backbone = hyperparams.Hyperparameter[bool](
        default = True,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description = "Freeze training of backbone layers."
    )
    weights = hyperparams.Hyperparameter[bool](
        default = True,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description = "Load the model with pretrained weights specific to selected backbone."
    )
    learning_rate = hyperparams.Hyperparameter[float](
        default = 1e-5,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description = "Learning rate."
    )
    n_steps = hyperparams.Hyperparameter[int](
        default = 50,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
        description = "Number of steps/epoch."
    )
    output = hyperparams.Hyperparameter[bool](
        default = False,
        semantic_types = ['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description = "Output images and predicted bounding boxes after evaluation."
    )
コード例 #2
0
class SSC_ADMMHyperparams(hyperparams.Hyperparams):
    n_clusters = hyperparams.Bounded[int](
        lower=2,
        upper=None,
        default=2,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description="number of subspaces/clusters to learn")
    use_affine = hyperparams.Enumeration[bool](
        values=[True, False],
        default=False,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Should be True if data is derived from affine subspaces rather than linear subspaces"
    )
    use_outliers = hyperparams.Enumeration[bool](
        values=[True, False],
        default=True,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Should be True if you believe the data countains instances that are outliers to all subspaces"
    )
    alpha = hyperparams.Union(
        configuration=collections.OrderedDict({
            'enum':
            hyperparams.Enumeration[int](values=[-1], default=-1),
            'bounded':
            hyperparams.UniformInt(lower=20,
                                   upper=800,
                                   default=800,
                                   upper_inclusive=True)
        }),
        default='enum',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ],
        description=
        "Tuning parameter that balances regression and sparsity terms.  If -1, will be initialized to 20 (if no outliers) or 800 (with outliers)."
    )
コード例 #3
0
class EKSSHyperparams(hyperparams.Hyperparams):
    n_clusters = hyperparams.Bounded[int](lower=2,
        upper=None,
        default=2,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="number of clusters to learn")
    dim_subspaces = hyperparams.Bounded[int](lower=1,
        upper=50,
        default=2,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
        description="dimensionality of learned subspaces")
    n_base = hyperparams.Bounded[int](lower=10,
        upper=1000,
        default=100,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter', 'https://metadata.datadrivendiscovery.org/types/ResourcesUseParameter'],
        description="number of 'base' KSS clusterings to use in the ensemble - larger values generally yield better results but longer computation time")
    thresh = hyperparams.Union(configuration=collections.OrderedDict({
            'enum':hyperparams.Enumeration[int](values=[-1], default=-1),
            'bounded':hyperparams.Bounded[int](lower=1, upper=10000, default=5)}),
        default='bounded',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
        description="if >=1, only the top <thresh> values from each column/row of the affinity matrix are used in spectral clustering")
コード例 #4
0
class Hyperparams(Hyperparams_ODBase):
    ######## Add more Hyperparamters #######

    method = hyperparams.Enumeration[str](
        values=['average', 'maximization', 'median'],
        default='average',
        description=
        'Combination method: {average, maximization, median}. Pass in weights of detector for weighted version.',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])

    weights = hyperparams.Union(
        configuration=OrderedDict(
            {
                'ndarray':
                hyperparams.Hyperparameter[ndarray](
                    default=np.array([]),
                    semantic_types=[
                        'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                    ],
                ),
                'none':
                hyperparams.Constant(
                    default=None,
                    semantic_types=[
                        'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                    ],
                )
            }),
        default='none',
        description=
        'Score weight by dimensions. If None, [1,1,...,1] will be used.',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ])

    pass
コード例 #5
0
class Hyperparams(hyperparams.Hyperparams):
    hidden_layer_sizes = hyperparams.List(
        elements=hyperparams.Bounded(1, None, 100),
        default=(100, ),
        min_size=1,
        max_size=None,
        description='The ith element represents the number of neurons in the ith hidden layer.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    activation = hyperparams.Enumeration[str](
        values=['identity', 'logistic', 'tanh', 'relu'],
        default='relu',
        description='Activation function for the hidden layer.  - \'identity\', no-op activation, useful to implement linear bottleneck, returns f(x) = x  - \'logistic\', the logistic sigmoid function, returns f(x) = 1 / (1 + exp(-x)).  - \'tanh\', the hyperbolic tan function, returns f(x) = tanh(x).  - \'relu\', the rectified linear unit function, returns f(x) = max(0, x)',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    solver = hyperparams.Choice(
        choices={
            'lbfgs': hyperparams.Hyperparams.define(
                configuration=OrderedDict({
                    'max_fun': hyperparams.Bounded[int](
                        default=15000,
                        lower=1,
                        upper=None,
                        description='Maximum number of loss function calls',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    )
                })
            ),
            'sgd': hyperparams.Hyperparams.define(
                configuration=OrderedDict({
                    'learning_rate': hyperparams.Enumeration[str](
                        values=['constant', 'invscaling', 'adaptive'],
                        default='constant',
                        description='Learning rate schedule for weight updates. Only used when solver=’sgd’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'learning_rate_init': hyperparams.Bounded[float](
                        lower=0,
                        upper=None,
                        default=0.001,
                        description='The initial learning rate used. It controls the step-size in updating the weights. Only used when solver=’sgd’ or ‘adam’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'power_t': hyperparams.Bounded[float](
                        lower=0,
                        upper=None,
                        default=0.5,
                        description='The exponent for inverse scaling learning rate. Only used when solver=’sgd’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'shuffle': hyperparams.UniformBool(
                        default=True,
                        description='Whether to shuffle samples in each iteration. Only used when solver=’sgd’ or ‘adam’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'momentum': hyperparams.Bounded[float](
                        default=0.9,
                        lower=0,
                        upper=1,
                        description='Momentum for gradient descent update. Should be between 0 and 1. Only used when solver=’sgd’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'nesterovs_momentum': hyperparams.UniformBool(
                        default=True,
                        description='Whether to use Nesterov’s momentum. Only used when solver=’sgd’ and momentum > 0.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'early_stopping': hyperparams.UniformBool(
                        default=False,
                        description='Whether to use early stopping to terminate training when validation score is not improving.If set to true, it will automatically set aside 10% of training data as validation and terminate training when validation score is not improving by at least tol for n_iter_no_change consecutive epochs.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'n_iter_no_change': hyperparams.Bounded[int](
                        default=10,
                        lower=1,
                        upper=None,
                        description='Maximum number of epochs to not meet tol improvement. Only effective when solver=’sgd’ or ‘adam’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    )
                })
            ),
            'adam': hyperparams.Hyperparams.define(
                configuration=OrderedDict({
                    'learning_rate_init': hyperparams.Bounded[float](
                        lower=0,
                        upper=None,
                        default=0.001,
                        description='The initial learning rate used. It controls the step-size in updating the weights. Only used when solver=’sgd’ or ‘adam’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'shuffle': hyperparams.UniformBool(
                        default=True,
                        description='Whether to shuffle samples in each iteration. Only used when solver=’sgd’ or ‘adam’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'early_stopping': hyperparams.UniformBool(
                        default=False,
                        description='Whether to use early stopping to terminate training when validation score is not improving.If set to true, it will automatically set aside 10% of training data as validation and terminate training when validation score is not improving by at least tol for n_iter_no_change consecutive epochs.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'beta_1': hyperparams.Bounded[float](
                        default=0.9,
                        lower=0,
                        upper=1,
                        description='Exponential decay rate for estimates of first moment vector in adam, should be in [0, 1).',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'beta_2': hyperparams.Bounded[float](
                        default=0.999,
                        lower=0,
                        upper=1,
                        description='Exponential decay rate for estimates of second moment vector in adam, should be in [0, 1).',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'epsilon': hyperparams.Bounded[float](
                        default=1e-08,
                        lower=0,
                        upper=None,
                        description='Value for numerical stability in adam. Only used when solver=’adam’',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    ),
                    'n_iter_no_change': hyperparams.Bounded[int](
                        default=10,
                        lower=1,
                        upper=None,
                        description='Maximum number of epochs to not meet tol improvement. Only effective when solver=’sgd’ or ‘adam’.',
                        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
                    )
                })
            )
        },
        default='adam',
        description='The solver for weight optimization.  - \'lbfgs\' is an optimizer in the family of quasi-Newton methods.  - \'sgd\' refers to stochastic gradient descent.  - \'adam\' refers to a stochastic gradient-based optimizer proposed by Kingma, Diederik, and Jimmy Ba  Note: The default solver \'adam\' works pretty well on relatively large datasets (with thousands of training samples or more) in terms of both training time and validation score. For small datasets, however, \'lbfgs\' can converge faster and perform better.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    alpha = hyperparams.Bounded[float](
        lower=0,
        upper=None,
        default=0.0001,
        description='L2 penalty (regularization term) parameter.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    batch_size = hyperparams.Union(
        configuration=OrderedDict({
            'int': hyperparams.Bounded[int](
                lower=0,
                upper=None,
                default=16,
                description='Size of minibatches for stochastic optimizers. If the solver is \'lbfgs\', the classifier will not use minibatch',
                semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
            ),
            'auto': hyperparams.Constant(
                default='auto',
                description='When set to \'auto\', batch_size=min(200, n_samples)',
                semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
            )
        }),
        default='auto',
        description='Size of minibatches for stochastic optimizers. If the solver is \'lbfgs\', the classifier will not use minibatch. When set to "auto", `batch_size=min(200, n_samples)`',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    max_iter = hyperparams.Bounded[int](
        lower=0,
        upper=None,
        default=200,
        description='Maximum number of iterations. The solver iterates until convergence (determined by \'tol\') or this number of iterations. For stochastic solvers (\'sgd\', \'adam\'), note that this determines the number of epochs (how many times each data point will be used), not the number of gradient steps.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    tol = hyperparams.Bounded[float](
        default=0.0001,
        lower=0,
        upper=None,
        description='Tolerance for the optimization. When the loss or score is not improving by at least ``tol`` for ``n_iter_no_change`` consecutive iterations, unless ``learning_rate`` is set to \'adaptive\', convergence is considered to be reached and training stops.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    warm_start = hyperparams.UniformBool(
        default=False,
        description='When set to True, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution. See :term:`the Glossary <warm_start>`.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    validation_fraction = hyperparams.Bounded[float](
        default=0.1,
        lower=0,
        upper=None,
        description='The proportion of training data to set aside as validation set for early stopping. Must be between 0 and 1. Only used if early_stopping is True',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    
    use_inputs_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="A set of column indices to force primitive to use as training input. If any specified column cannot be parsed, it is skipped.",
    )
    use_outputs_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="A set of column indices to force primitive to use as training target. If any specified column cannot be parsed, it is skipped.",
    )
    exclude_inputs_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="A set of column indices to not use as training inputs. Applicable only if \"use_columns\" is not provided.",
    )
    exclude_outputs_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="A set of column indices to not use as training target. Applicable only if \"use_columns\" is not provided.",
    )
    return_result = hyperparams.Enumeration(
        values=['append', 'replace', 'new'],
        default='new',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Should parsed columns be appended, should they replace original columns, or should only parsed columns be returned? This hyperparam is ignored if use_semantic_types is set to false.",
    )
    use_semantic_types = hyperparams.UniformBool(
        default=False,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Controls whether semantic_types metadata will be used for filtering columns in input dataframe. Setting this to false makes the code ignore return_result and will produce only the output dataframe"
    )
    add_index_columns = hyperparams.UniformBool(
        default=False,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Also include primary index columns if input data has them. Applicable only if \"return_result\" is set to \"new\".",
    )
    error_on_no_input = hyperparams.UniformBool(
        default=True,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Throw an exception if no input column is selected/provided. Defaults to true to behave like sklearn. To prevent pipelines from breaking set this to False.",
    )
    
    return_semantic_type = hyperparams.Enumeration[str](
        values=['https://metadata.datadrivendiscovery.org/types/Attribute', 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute', 'https://metadata.datadrivendiscovery.org/types/PredictedTarget'],
        default='https://metadata.datadrivendiscovery.org/types/PredictedTarget',
        description='Decides what semantic type to attach to generated output',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter']
    )
コード例 #6
0
class Hyperparams(hyperparams.Hyperparams):
    missing_values = hyperparams.Union(
        configuration=OrderedDict({
            'int': hyperparams.Hyperparameter[int](
                default=0,
                semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
            ),
            'float': hyperparams.Hyperparameter[float](
                default=numpy.nan,
                semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
            )
        }),
        default='float',
        description='The placeholder for the missing values. All occurrences of `missing_values` will be imputed.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter']
    )
    strategy = hyperparams.Enumeration[str](
        default='mean',
        values=['median', 'most_frequent', 'mean', 'constant'],
        description='The imputation strategy.  - If "mean", then replace missing values using the mean along each column. Can only be used with numeric data. - If "median", then replace missing values using the median along each column. Can only be used with numeric data. - If "most_frequent", then replace missing using the most frequent value along each column. Can be used with strings or numeric data. - If "constant", then replace missing values with fill_value. Can be used with strings or numeric data.  .. versionadded:: 0.20 strategy="constant" for fixed value imputation.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    add_indicator = hyperparams.UniformBool(
        default=False,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    fill_value = hyperparams.Union(
        configuration=OrderedDict({
            'int': hyperparams.Hyperparameter[int](
                default=0,
                semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
            ),
            'none': hyperparams.Constant(
                default=None,
                semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
            )
        }),
        default='none',
        description='When strategy == "constant", fill_value is used to replace all occurrences of missing_values. If left to the default, fill_value will be 0 when imputing numerical data and "missing_value" for strings or object data types.',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
    )
    
    use_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="A set of column indices to force primitive to operate on. If any specified column cannot be parsed, it is skipped.",
    )
    exclude_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="A set of column indices to not operate on. Applicable only if \"use_columns\" is not provided.",
    )
    return_result = hyperparams.Enumeration(
        values=['append', 'replace', 'new'],
        default='new',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Should parsed columns be appended, should they replace original columns, or should only parsed columns be returned? This hyperparam is ignored if use_semantic_types is set to false.",
    )
    use_semantic_types = hyperparams.UniformBool(
        default=False,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Controls whether semantic_types metadata will be used for filtering columns in input dataframe. Setting this to false makes the code ignore return_result and will produce only the output dataframe"
    )
    add_index_columns = hyperparams.UniformBool(
        default=False,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Also include primary index columns if input data has them. Applicable only if \"return_result\" is set to \"new\".",
    )
    error_on_no_input = hyperparams.UniformBool(
        default=True,
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter'],
        description="Throw an exception if no input column is selected/provided. Defaults to true to behave like sklearn. To prevent pipelines from breaking set this to False.",
    )
    
    return_semantic_type = hyperparams.Enumeration[str](
        values=['https://metadata.datadrivendiscovery.org/types/Attribute', 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'],
        default='https://metadata.datadrivendiscovery.org/types/Attribute',
        description='Decides what semantic type to attach to generated attributes',
        semantic_types=['https://metadata.datadrivendiscovery.org/types/ControlParameter']
    )
コード例 #7
0
class Hyperparams(hyperparams.Hyperparams):

    rank = hyperparams.Hyperparameter[int](
        default=30,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description="The factorization rank to achieve. Default is 30.",
    )

    seed = hyperparams.Enumeration(
        values=['nndsvd', 'random_c', 'random_vcol', 'random', 'fixed'],
        default='random',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description="""Method to seed the computation of a factorization""",
    )

    W = hyperparams.Union(
        configuration=OrderedDict(
            {
                'ndarray':
                hyperparams.Hyperparameter[ndarray](
                    default=numpy.array([]),
                    semantic_types=[
                        'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                    ],
                ),
                'none':
                hyperparams.Constant(
                    default=None,
                    semantic_types=[
                        'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                    ],
                )
            }),
        default='none',
        description=
        'Score weight by dimensions. If None, [1,1,...,1] will be used.',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ])

    H = hyperparams.Union(
        configuration=OrderedDict(
            {
                'ndarray':
                hyperparams.Hyperparameter[ndarray](
                    default=numpy.array([]),
                    semantic_types=[
                        'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                    ],
                ),
                'none':
                hyperparams.Constant(
                    default=None,
                    semantic_types=[
                        'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                    ],
                )
            }),
        default='none',
        description=
        'Score weight by dimensions. If None, [1,1,...,1] will be used.',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ])

    update = hyperparams.Enumeration(
        values=['euclidean', 'divergence'],
        default='euclidean',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        """Type of update equations used in factorization. When specifying model parameter update can be assigned to:"			
					'euclidean' for classic Euclidean distance update equations,"
					'divergence' for divergence update equations."

					By default Euclidean update equations are used.""",
    )

    objective = hyperparams.Enumeration(
        values=['fro', 'div', 'conn'],
        default='fro',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        """Type of objective function used in factorization. When specifying model parameter :param:`objective` can be assigned to:

					‘fro’ for standard Frobenius distance cost function,
					‘div’ for divergence of target matrix from NMF estimate cost function (KL),
					‘conn’ for measuring the number of consecutive iterations in which the connectivity matrix has not changed.

					By default the standard Frobenius distance cost function is used.""",
    )

    max_iter = hyperparams.Hyperparameter[int](
        default=30,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Maximum number of factorization iterations. Note that the number of iterations depends on the speed of method convergence. Default is 30.",
    )

    learning_rate = hyperparams.Union[Union[float, None]](
        configuration=OrderedDict(
            limit=hyperparams.Bounded[float](
                lower=0,
                upper=None,
                default=0.01,
            ),
            unlimited=hyperparams.Constant(
                default=None,
                description='If nothing is give as a paramter',
            ),
        ),
        default='unlimited',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Minimal required improvement of the residuals from the previous iteration. They are computed between the target matrix and its MF estimate using the objective function associated to the MF algorithm. Default is None.",
    )

    # parameters for column
    use_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(2, 3),
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "A set of column indices to force primitive to operate on. If any specified column cannot be parsed, it is skipped.",
    )
    exclude_columns = hyperparams.Set(
        elements=hyperparams.Hyperparameter[int](-1),
        default=(),
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "A set of column indices to not operate on. Applicable only if \"use_columns\" is not provided.",
    )
    return_result = hyperparams.Enumeration(
        values=['append', 'replace', 'new'],
        default='new',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Should parsed columns be appended, should they replace original columns, or should only parsed columns be returned? This hyperparam is ignored if use_semantic_types is set to false.",
    )
    use_semantic_types = hyperparams.UniformBool(
        default=False,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Controls whether semantic_types metadata will be used for filtering columns in input dataframe. Setting this to false makes the code ignore return_result and will produce only the output dataframe"
    )
    add_index_columns = hyperparams.UniformBool(
        default=False,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Also include primary index columns if input data has them. Applicable only if \"return_result\" is set to \"new\".",
    )
    error_on_no_input = hyperparams.UniformBool(
        default=True,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ],
        description=
        "Throw an exception if no input column is selected/provided. Defaults to true to behave like sklearn. To prevent pipelines from breaking set this to False.",
    )
    return_semantic_type = hyperparams.Enumeration[str](
        values=[
            'https://metadata.datadrivendiscovery.org/types/Attribute',
            'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
        ],
        default='https://metadata.datadrivendiscovery.org/types/Attribute',
        description=
        'Decides what semantic type to attach to generated attributes',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ])
コード例 #8
0
class Hyperparams(hyperparams.Hyperparams):
    backbone = hyperparams.Union(
        OrderedDict({
            "resnet50":
            hyperparams.Constant[str](
                default="resnet50",
                semantic_types=[
                    "https://metadata.datadrivendiscovery.org/types/TuningParameter"
                ],
                description=
                "Backbone architecture from resnet50 architecture (https://arxiv.org/abs/1512.03385)",
            ),
            "resnet101":
            hyperparams.Constant[str](
                default="resnet101",
                semantic_types=[
                    "https://metadata.datadrivendiscovery.org/types/TuningParameter"
                ],
                description=
                "Backbone architecture from resnet101 architecture (https://arxiv.org/abs/1512.03385)",
            ),
            "resnet152":
            hyperparams.Constant[str](
                default="resnet152",
                semantic_types=[
                    "https://metadata.datadrivendiscovery.org/types/TuningParameter"
                ],
                description=
                "Backbone architecture from resnet152 architecture (https://arxiv.org/abs/1512.03385)",
            ),
        }),
        default="resnet50",
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/TuningParameter"
        ],
        description="Backbone architecture from which RetinaNet is built.",
    )
    batch_size = hyperparams.Hyperparameter[int](
        default=32,
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/TuningParameter"
        ],
        description="Size of the batches as input to the model.",
    )
    n_epochs = hyperparams.Hyperparameter[int](
        default=10,
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/TuningParameter"
        ],
        description="Number of epochs to train.",
    )
    learning_rate = hyperparams.Hyperparameter[float](
        default=1e-5,
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/ControlParameter"
        ],
        description="Learning rate.",
    )
    n_steps = hyperparams.Hyperparameter[int](
        default=20,
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/TuningParameter"
        ],
        description="Number of steps/epoch.",
    )
    output = hyperparams.Hyperparameter[bool](
        default=False,
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/ControlParameter"
        ],
        description=
        "Output images and predicted bounding boxes after evaluation.",
    )
    weights_path = hyperparams.Hyperparameter[str](
        default="/root/",
        semantic_types=[
            "https://metadata.datadrivendiscovery.org/types/ControlParameter"
        ],
        description=
        "An output path for where model weights should be saved/loaded from during runtime",
    )
コード例 #9
0
class Hyperparams(hyperparams.Hyperparams):

    # D3M specific
    include_target_in_output = hyperparams.Hyperparameter[bool](
        default=True,
        description='Include target column in output dataframe',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/ControlParameter'
        ])
    sample_learning_data = hyperparams.Hyperparameter[Union[int, None]](
        description='Number of elements to sample from learningData dataframe',
        default=None,
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])

    # DFS arguments
    max_depth = hyperparams.UniformInt(
        lower=1,
        upper=5,
        default=2,
        description='Maximum allowed depth of features',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])

    # Normalization Options
    normalize_single_table = hyperparams.Hyperparameter[bool](
        default=True,
        description=(
            'If dataset has only one table and normalize_single_table '
            'is True, normalize categoricals into separate entities.'),
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])
    find_equivalent_categories = hyperparams.Hyperparameter[bool](
        default=True,
        description='',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])
    min_categorical_nunique = hyperparams.Union(
        OrderedDict([
            ('fraction',
             hyperparams.Uniform(lower=0.00001,
                                 upper=1,
                                 default=.1,
                                 description='fraction of nunique values')),
            ('value',
             hyperparams.UniformInt(lower=1,
                                    upper=1000,
                                    default=10,
                                    description='number of nunique values'))
        ]),
        default='fraction',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ],
        description='')

    # Encoding hyperparameters
    encode = hyperparams.Hyperparameter[bool](
        default=True,
        description='If True, apply One-Hot-Encoding to result',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])
    include_unknown = hyperparams.Hyperparameter[bool](
        default=True,
        description=
        'If encode is True, add a feature encoding the unknown class',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])
    top_n = hyperparams.UniformInt(
        lower=1,
        upper=1000,
        default=10,
        description=
        'If encode is True, number of top values to include in each encoding',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])
    remove_low_information = hyperparams.Hyperparameter[bool](
        default=True,
        description=
        'Indicates whether to remove features with zero variance or all null values',
        semantic_types=[
            'https://metadata.datadrivendiscovery.org/types/TuningParameter'
        ])

    # Primitive Hyperparameters
    locals().update(_get_primitive_hyperparams())
コード例 #10
0
ファイル: custom_hps.py プロジェクト: tods-doc/axolotl
     hyperparams.Hyperparams.define(configuration=OrderedDict({})),
     'elasticnet':
     hyperparams.Hyperparams.define(configuration=OrderedDict({
         'l1_ratio':
         hyperparams.Union(
             configuration=OrderedDict({
                 'float':
                 hyperparams.Uniform(
                     lower=0,
                     upper=1,
                     default=0.001,
                     lower_inclusive=True,
                     upper_inclusive=True,
                     semantic_types=[
                         'https://metadata.datadrivendiscovery.org/types/TuningParameter'
                     ],
                 ),
                 # 'l1_ratio must be between 0 and 1; got (l1_ratio=None)'
                 # 'none': hyperparams.Constant(
                 #     default=None,
                 #     semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter'],
                 # )
             }),
             default='float',
             semantic_types=[
                 'https://metadata.datadrivendiscovery.org/types/TuningParameter'
             ])
     }))
 },
 default='l2',
 description=