def __init__(self, Trained: Boolean(), N: Discrete(min=500, max=2000), C: Boolean()): self.Trained = Trained self.N = N self.C = C NltkTrainedTagger.__init__(self) _TnT.__init__(self, Trained=Trained, N=N, C=C)
def __init__( self, featurewise_center: Boolean(), samplewise_center: Boolean(), featurewise_std_normalization: Boolean(), samplewise_std_normalization: Boolean(), rotation_range: Discrete(0, 15), width_shift_range: Continuous(0, 0.25), height_shift_range: Continuous(0, 0.25), shear_range: Continuous(0, 15), zoom_range: Continuous(0, 0.25), horizontal_flip: Boolean(), vertical_flip: Boolean(), ): super().__init__( featurewise_center=featurewise_center, samplewise_center=samplewise_center, featurewise_std_normalization=featurewise_std_normalization, samplewise_std_normalization=samplewise_std_normalization, rotation_range=rotation_range, width_shift_range=width_shift_range, height_shift_range=height_shift_range, shear_range=shear_range, zoom_range=zoom_range, horizontal_flip=horizontal_flip, vertical_flip=vertical_flip, )
def __init__( self, cutoff: Discrete(min=0, max=10), ): self.cutoff = cutoff self.tagger = _UnigramTagger self.values = dict(cutoff=cutoff) NltkTagger.__init__(self)
def test_sample_subset(): class A: def __init__(self, features: Subset('Subset', Discrete(1, 5), 'Hello', 1, None)): self.features = features g = generate_cfg(A) selected_features = g.sample().features selected = set([repr(feature) for feature in selected_features]) assert selected.issubset( [repr(feature) for feature in [Discrete(1, 5), 'Hello', 1, None]])
def _get_arg_values(arg, value, cls): if isinstance(value, bool): return Boolean() if isinstance(value, int): return Discrete(*_get_integer_values(arg, value, cls)) if isinstance(value, float): return Continuous(*_get_float_values(arg, value, cls)) if isinstance(value, str): values = _find_parameter_values(arg, cls) return Categorical(*values) if values else None return None
def __init__( self, dm: Discrete(min=0, max=2), dbow_words: Discrete(min=-100, max=100), dm_concat: Discrete(min=-100, max=100), dm_tag_count: Discrete(min=0, max=2), alpha: Continuous(min=0.001, max=0.075), epochs: Discrete(min=2, max=10), window: Discrete(min=2, max=10), inner_tokenizer: algorithm(Sentence(), List(Word())), inner_stemmer: algorithm(Word(), Stem()), inner_stopwords: algorithm(List(Word()), List(Word())), lowercase: Boolean(), stopwords_remove: Boolean(), ): self.inner_tokenizer = inner_tokenizer self.inner_stemmer = inner_stemmer self.inner_stopwords = inner_stopwords self.lowercase = lowercase self.stopwords_remove = stopwords_remove super().__init__( dm=dm, dbow_words=dbow_words, dm_concat=dm_concat, dm_tag_count=dm_tag_count, alpha=alpha, epochs=epochs, window=window, )
def __init__( self, affix_length: Discrete(min=-2, max=-6), min_stem_length: Discrete(min=1, max=4), cutoff: Discrete(min=0, max=10), backoff: algorithm(Tuple(List(List(Word())), List(List(Postag()))), List(List(Postag()))), ): self.affix_length = affix_length self.min_stem_length = min_stem_length self.cutoff = cutoff self.backoff = backoff self.tagger = _AffixTagger self.values = dict( affix_length=affix_length, min_stem_length=min_stem_length, cutoff=cutoff, backoff=backoff, ) NltkTagger.__init__(self)
def __init__( self, filters: Discrete(2, 8), kernel_size: Categorical(3, 5, 7), l1: Continuous(0, 1e-3), l2: Continuous(0, 1e-3), ): self.l1 = l1 self.l2 = l2 super().__init__( filters=2**filters, kernel_size=(kernel_size, kernel_size), kernel_regularizer=regularizers.l1_l2(l1=l1, l2=l2), padding="same", data_format="channels_last", )
def _get_integer_values(arg, value, cls): if value > 0: min_value = 0 max_value = 2 * value elif value == 0: min_value = -100 max_value = 100 else: return None # binary search for minimum value left = min_value right = value while left < right: current_value = int((left + right) / 2) if current_value in [left, right]: break if _try(cls, arg, current_value): right = current_value else: left = current_value min_value = right # binary search for maximum value left = value right = max_value while left < right: current_value = int((left + right) / 2) if current_value in [left, right]: break if _try(cls, arg, current_value): left = current_value else: right = current_value max_value = left if min_value < max_value: return Discrete(min=min_value, max=max_value) return None
def __init__( self, units: Discrete(32, 1024), activation: Categorical("tanh", "sigmoid", "relu", "linear"), recurrent_activation: Categorical("tanh", "sigmoid", "relu", "linear"), dropout: Continuous(0, 0.5), recurrent_dropout: Continuous(0, 0.5), ): super().__init__( units=units, activation=activation, recurrent_activation=recurrent_activation, dropout=dropout, recurrent_dropout=recurrent_dropout, return_sequences=False, )
def __init__( self, merge_mode: Categorical("sum", "mul", "concat", "ave"), units: Discrete(32, 1024), activation: Categorical("tanh", "sigmoid", "relu", "linear"), recurrent_activation: Categorical("tanh", "sigmoid", "relu", "linear"), dropout: Continuous(0, 0.5), recurrent_dropout: Continuous(0, 0.5), ): super().__init__( layer=_LSTM( units=units, activation=activation, recurrent_activation=recurrent_activation, dropout=dropout, recurrent_dropout=recurrent_dropout, return_sequences=False, ), merge_mode=merge_mode, )
def __init__(self, filters: Discrete(2, 8), kernel_size: Categorical(3, 5, 7)): super().__init__(filters=2**filters, kernel_size=kernel_size, padding="causal")
def f(x: Discrete(1, 5)): pass
def __init__(self, output_dim: Discrete(32, 128)): super().__init__(input_dim=1000, output_dim=output_dim)
def __init__(self, units: Discrete(128, 1024), **kwargs): super().__init__(units=units, **kwargs)
def __init__(self, features: Subset('Subset', Discrete(1, 5), Categorical('adam', 'sgd'))): pass
def __init__(self, x: Discrete(1, 5)): pass
def __init__(self, features: Subset('Subset', Discrete(1, 5), 'Hello', 1, None)): self.features = features
def __init__(self, ngram: Discrete(1, 3)): super().__init__(ngram_range=(1, ngram)) self.ngram = ngram
def __init__(self, x: Discrete(-10, 10), y: Discrete(-10, 10)): self.x = x self.y = y
def __init__(self, n: Discrete(50, 200)): super().__init__(n_components=n) self.n = n
def __init__(self, ngram: Discrete(1, 3), use_idf: Boolean()): super().__init__(ngram_range=(1, ngram), use_idf=use_idf) self.ngram = ngram