本文整理汇总了Python中configargparse.ArgParser.add_mutually_exclusive_group方法的典型用法代码示例。如果您正苦于以下问题:Python ArgParser.add_mutually_exclusive_group方法的具体用法?Python ArgParser.add_mutually_exclusive_group怎么用?Python ArgParser.add_mutually_exclusive_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configargparse.ArgParser
的用法示例。
在下文中一共展示了ArgParser.add_mutually_exclusive_group方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_param_arguments
# 需要导入模块: from configargparse import ArgParser [as 别名]
# 或者: from configargparse.ArgParser import add_mutually_exclusive_group [as 别名]
def add_param_arguments(ap=None, arg_default=None): # arguments with possible format-specific parameter values
def add_argument(a, *args, **kwargs):
return a.add_argument(*args, **kwargs)
def add(a, *args, default=None, func=add_argument, **kwargs):
arg = func(a, *args, default=default if arg_default is None else arg_default, **kwargs)
try:
RESTORED_ARGS.add(arg.dest)
except AttributeError:
RESTORED_ARGS.update(get_group_arg_names(arg))
def add_boolean(a, *args, **kwargs):
add(a, *args, func=add_boolean_option, **kwargs)
if not ap:
ap = ArgParser()
group = ap.add_argument_group(title="Node labels")
add(group, "--max-node-labels", type=int, default=0, help="max number of node labels to allow")
add(group, "--max-node-categories", type=int, default=0, help="max node categories to allow")
add(group, "--min-node-label-count", type=int, default=2, help="min number of occurrences for a label")
add_boolean(group, "use-gold-node-labels", "gold node labels when parsing")
add_boolean(group, "wikification", "use Spotlight to wikify any named node")
add_boolean(group, "node-labels", "prediction of node labels, if supported by format", default=True)
group = ap.add_argument_group(title="Structural constraints")
add_boolean(group, "linkage", "linkage nodes and edges")
add_boolean(group, "implicit", "implicit nodes and edges")
add_boolean(group, "remote", "remote edges", default=True)
add_boolean(group, "constraints", "scheme-specific rules", default=True)
add_boolean(group, "require-connected", "constraint that output graph must be connected")
add(group, "--orphan-label", default="orphan", help="edge label to use for nodes without parents")
add(group, "--max-action-ratio", type=float, default=100, help="max action/terminal ratio")
add(group, "--max-node-ratio", type=float, default=10, help="max node/terminal ratio")
add(group, "--max-height", type=int, default=20, help="max graph height")
group = ap.add_mutually_exclusive_group()
add(group, "--swap", choices=(REGULAR, COMPOUND), default=REGULAR, help="swap transitions")
add(group, "--no-swap", action="store_false", dest="swap", help="exclude swap transitions")
add(ap, "--max-swap", type=int, default=15, help="if compound swap enabled, maximum swap size")
group = ap.add_argument_group(title="General classifier training parameters")
add(group, "--learning-rate", type=float, help="rate for model weight updates (default: by trainer/1)")
add(group, "--learning-rate-decay", type=float, default=0, help="learning rate decay per iteration")
add(group, "--swap-importance", type=float, default=1, help="learning rate factor for Swap")
add(group, "--max-training-per-format", type=int, help="max number of training passages per format per iteration")
add_boolean(group, "missing-node-features", "allow node features to be missing if not available", default=True)
add(group, "--omit-features", help="string of feature properties to omit, out of " + FEATURE_PROPERTIES)
add_boolean(group, "curriculum", "sort training passages by action prediction accuracy in previous epoch")
group = ap.add_argument_group(title="Perceptron parameters")
add(group, "--min-update", type=int, default=5, help="minimum #updates for using a feature")
SPARSE_ARG_NAMES.update(get_group_arg_names(group))
group = ap.add_argument_group(title="Neural network parameters")
add(group, "--word-dim-external", type=int, default=300, help="dimension for external word embeddings")
add(group, "--word-vectors", help="file to load external word embeddings from (default: GloVe)")
add(group, "--vocab", help="file mapping integer ID to word form (to avoid loading spaCy), or '-' to use word form")
add_boolean(group, "update-word-vectors", "external word vectors in training parameters", default=True)
add(group, "--word-dim", type=int, default=0, help="dimension for learned word embeddings")
add(group, "--lemma-dim", type=int, default=200, help="dimension for lemma embeddings")
add(group, "--tag-dim", type=int, default=20, help="dimension for fine POS tag embeddings")
add(group, "--pos-dim", type=int, default=20, help="dimension for coarse/universal POS tag embeddings")
add(group, "--dep-dim", type=int, default=10, help="dimension for dependency relation embeddings")
add(group, "--edge-label-dim", type=int, default=20, help="dimension for edge label embeddings")
add(group, "--node-label-dim", type=int, default=0, help="dimension for node label embeddings")
add(group, "--node-category-dim", type=int, default=0, help="dimension for node category embeddings")
add(group, "--punct-dim", type=int, default=1, help="dimension for separator punctuation embeddings")
add(group, "--action-dim", type=int, default=3, help="dimension for input action type embeddings")
add(group, "--ner-dim", type=int, default=3, help="dimension for input entity type embeddings")
add(group, "--shape-dim", type=int, default=3, help="dimension for word shape embeddings")
add(group, "--prefix-dim", type=int, default=2, help="dimension for word prefix embeddings")
add(group, "--suffix-dim", type=int, default=3, help="dimension for word suffix embeddings")
add(group, "--output-dim", type=int, default=50, help="dimension for output action embeddings")
add(group, "--layer-dim", type=int, default=50, help="dimension for hidden layers")
add(group, "--layers", type=int, default=2, help="number of hidden layers")
add(group, "--lstm-layer-dim", type=int, default=500, help="dimension for LSTM hidden layers")
add(group, "--lstm-layers", type=int, default=0, help="number of LSTM hidden layers")
add(group, "--embedding-layer-dim", type=int, default=500, help="dimension for layers before LSTM")
add(group, "--embedding-layers", type=int, default=1, help="number of layers before LSTM")
add(group, "--activation", choices=ACTIVATIONS, default=DEFAULT_ACTIVATION, help="activation function")
add(group, "--init", choices=INITIALIZERS, default=DEFAULT_INITIALIZER, help="weight initialization")
add(group, "--minibatch-size", type=int, default=200, help="mini-batch size for optimization")
add(group, "--optimizer", choices=TRAINERS, default=DEFAULT_TRAINER, help="algorithm for optimization")
add(group, "--loss", choices=LOSSES, default=DEFAULT_LOSS, help="loss function for training")
add(group, "--max-words-external", type=int, default=250000, help="max external word vectors to use")
add(group, "--max-words", type=int, default=10000, help="max number of words to keep embeddings for")
add(group, "--max-lemmas", type=int, default=3000, help="max number of lemmas to keep embeddings for")
add(group, "--max-tags", type=int, default=100, help="max number of fine POS tags to keep embeddings for")
add(group, "--max-pos", type=int, default=100, help="max number of coarse POS tags to keep embeddings for")
add(group, "--max-deps", type=int, default=100, help="max number of dep labels to keep embeddings for")
add(group, "--max-edge-labels", type=int, default=15, help="max number of edge labels for embeddings")
add(group, "--max-puncts", type=int, default=5, help="max number of punctuations for embeddings")
add(group, "--max-action-types", type=int, default=10, help="max number of action types for embeddings")
add(group, "--max-action-labels", type=int, default=100, help="max number of action labels to allow")
add(group, "--max-ner-types", type=int, default=18, help="max number of entity types to allow")
add(group, "--max-shapes", type=int, default=30, help="max number of word shapes to allow")
add(group, "--max-prefixes", type=int, default=30, help="max number of 1-character word prefixes to allow")
add(group, "--max-suffixes", type=int, default=500, help="max number of 3-character word suffixes to allow")
#.........这里部分代码省略.........