Mercurial > repos > bgruening > sklearn_ensemble
comparison keras_deep_learning.py @ 31:af0523c606a7 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
author | bgruening |
---|---|
date | Mon, 16 Dec 2019 05:42:39 -0500 |
parents | 47d4baa183b2 |
children | 19d6c2745d34 |
comparison
equal
deleted
inserted
replaced
30:ab4249158912 | 31:af0523c606a7 |
---|---|
71 "constraint_type": | 71 "constraint_type": |
72 "MinMaxNorm" | 72 "MinMaxNorm" |
73 } | 73 } |
74 """ | 74 """ |
75 constraint_type = config['constraint_type'] | 75 constraint_type = config['constraint_type'] |
76 if constraint_type == 'None': | 76 if constraint_type in ('None', ''): |
77 return None | 77 return None |
78 | 78 |
79 klass = getattr(keras.constraints, constraint_type) | 79 klass = getattr(keras.constraints, constraint_type) |
80 options = config.get('constraint_options', {}) | 80 options = config.get('constraint_options', {}) |
81 if 'axis' in options: | 81 if 'axis' in options: |
90 | 90 |
91 def _handle_layer_parameters(params): | 91 def _handle_layer_parameters(params): |
92 """Access to handle all kinds of parameters | 92 """Access to handle all kinds of parameters |
93 """ | 93 """ |
94 for key, value in six.iteritems(params): | 94 for key, value in six.iteritems(params): |
95 if value == 'None': | 95 if value in ('None', ''): |
96 params[key] = None | 96 params[key] = None |
97 continue | 97 continue |
98 | 98 |
99 if type(value) in [int, float, bool]\ | 99 if type(value) in [int, float, bool]\ |
100 or (type(value) is str and value.isalpha()): | 100 or (type(value) is str and value.isalpha()): |
203 Parameters | 203 Parameters |
204 ----------- | 204 ----------- |
205 config : dictionary, galaxy tool parameters loaded by JSON | 205 config : dictionary, galaxy tool parameters loaded by JSON |
206 """ | 206 """ |
207 generator_type = config.pop('generator_type') | 207 generator_type = config.pop('generator_type') |
208 if generator_type == 'none': | |
209 return None | |
210 | |
208 klass = try_get_attr('galaxy_ml.preprocessors', generator_type) | 211 klass = try_get_attr('galaxy_ml.preprocessors', generator_type) |
209 | 212 |
210 if generator_type == 'GenomicIntervalBatchGenerator': | 213 if generator_type == 'GenomicIntervalBatchGenerator': |
211 config['ref_genome_path'] = 'to_be_determined' | 214 config['ref_genome_path'] = 'to_be_determined' |
212 config['intervals_path'] = 'to_be_determined' | 215 config['intervals_path'] = 'to_be_determined' |
238 model = get_functional_model(layers_config) | 241 model = get_functional_model(layers_config) |
239 | 242 |
240 json_string = model.to_json() | 243 json_string = model.to_json() |
241 | 244 |
242 with open(outfile, 'w') as f: | 245 with open(outfile, 'w') as f: |
243 f.write(json_string) | 246 json.dump(json.loads(json_string), f, indent=2) |
244 | 247 |
245 | 248 |
246 def build_keras_model(inputs, outfile, model_json, infile_weights=None, | 249 def build_keras_model(inputs, outfile, model_json, infile_weights=None, |
247 batch_mode=False, outfile_params=None): | 250 batch_mode=False, outfile_params=None): |
248 """ for `keras_model_builder` tool | 251 """ for `keras_model_builder` tool |