MCPcopy Create free account
hub / github.com/LBANN/lbann / MutationStrategy

Class MutationStrategy

python/lbann/core/training_algorithm.py:189–220  ·  view source on GitHub ↗

The strategy for mutation after a tournament in LTFB. When a trainer loses in a LTFB tournament, the winning model is copied over to it and this mutation strategy is applied to the copied model to explore a new model. This is relevant to neural architecture searc

Source from the content-addressed store, hash-verified

187 return params
188
189class MutationStrategy:
190 """The strategy for mutation after a tournament in LTFB.
191
192 When a trainer loses in a LTFB tournament, the winning model is
193 copied over to it and this mutation strategy is applied to the
194 copied model to explore a new model. This is relevant to neural
195 architecture search (NAS).
196 """
197
198 def __init__(self, strategy: str = "null_mutation"):
199 self.strategy = strategy
200
201 def export_proto(self):
202 """Get a protobuf representation of this object."""
203
204 MutationStrategyMsg = AlgoProto.MutationStrategy
205 msg = MutationStrategyMsg()
206 if self.strategy == "null_mutation":
207 NullMutationMsg = MutationStrategyMsg.NullMutation
208 msg.null_mutation.CopyFrom(NullMutationMsg())
209 elif self.strategy == "replace_activation":
210 ReplaceActivationMsg = MutationStrategyMsg.ReplaceActivation
211 msg.replace_activation.CopyFrom(ReplaceActivationMsg())
212 elif self.strategy == "replace_convolution":
213 ReplaceConvolutionMsg = MutationStrategyMsg.ReplaceConvolution
214 msg.replace_convolution.CopyFrom(ReplaceConvolutionMsg())
215 elif self.strategy == "hybrid_mutation":
216 HybridMutationMsg = MutationStrategyMsg.HybridMutation
217 msg.hybrid_mutation.CopyFrom(HybridMutationMsg())
218 else:
219 raise ValueError("Unknown Strategy")
220 return msg
221
222class RandomPairwiseExchange(MetaLearningStrategy):
223 """The classic LTFB pairwise tourament metalearning strategy.

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected