LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
regularized_evolution.hpp
Go to the documentation of this file.
1 // Copyright (c) 2014-2023, Lawrence Livermore National Security, LLC.
3 // Produced at the Lawrence Livermore National Laboratory.
4 // Written by the LBANN Research Team (B. Van Essen, et al.) listed in
5 // the CONTRIBUTORS file. <lbann-dev@llnl.gov>
6 //
7 // LLNL-CODE-697807.
8 // All rights reserved.
9 //
10 // This file is part of LBANN: Livermore Big Artificial Neural Network
11 // Toolkit. For details, see http://software.llnl.gov/LBANN or
12 // https://github.com/LLNL/LBANN.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "Licensee"); you
15 // may not use this file except in compliance with the License. You may
16 // obtain a copy of the License at:
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
23 // implied. See the License for the specific language governing
24 // permissions and limitations under the license.
26 #ifndef LBANN_EXECUTION_ALGORITHMS_LTFB_REGULARIZED_EVOLUTION_HPP_INCLUDED
27 #define LBANN_EXECUTION_ALGORITHMS_LTFB_REGULARIZED_EVOLUTION_HPP_INCLUDED
28 
29 #include "mutation_strategy.hpp"
30 
32 
33 #include <google/protobuf/message.h>
34 
35 #include <cstddef>
36 #include <memory>
37 #include <string>
38 #include <unordered_map>
39 
40 namespace lbann {
41 namespace ltfb {
42 
52  : public Cloneable<RegularizedEvolution, MetaLearningStrategy>
53 {
54 public:
55  enum class metric_strategy
56  {
59  }; // enum class metric_strategy
60 
61 public:
62  RegularizedEvolution(std::string metric_name,
63  metric_strategy winner_strategy,
64  std::unique_ptr<MutationStrategy> mutate_algo,
65  int sample_size);
66  ~RegularizedEvolution() = default;
68 
69  void select_next(model& m,
71  data_coordinator& dc) const final;
72 
73 private:
77  data_coordinator& dc) const;
78 
79 private:
87  std::unique_ptr<MutationStrategy> m_mutate_algo;
88 
91  std::string m_metric_name;
92 
97 
101 
102 }; // class RegularizedEvolution
103 
104 } // namespace ltfb
105 
107 
110 template <>
111 std::unique_ptr<ltfb::RegularizedEvolution>
112 make(google::protobuf::Message const&);
113 
115 
116 } // namespace lbann
117 #endif // LBANN_EXECUTION_ALGORITHMS_LTFB_REGULARIZED_EVOLUTION_HPP_INCLUDED
Inject polymorphic clone functions into hierarchies.
Definition: cloneable.hpp:94
RegularizedEvolution(std::string metric_name, metric_strategy winner_strategy, std::unique_ptr< MutationStrategy > mutate_algo, int sample_size)
EvalType evaluate_model(model &m, LTFBExecutionContext &ctxt, data_coordinator &dc) const
Get the value of the given metric from the model.
std::unique_ptr< MutationStrategy > m_mutate_algo
The strategy for mutation of a model.
int m_sample_size
The size of the sample to choose from the population in every step.
Abstract base class for neural network models.
Definition: model.hpp:83
std::unique_ptr< ltfb::RandomPairwiseExchange > make(google::protobuf::Message const &)
Concrete builder for RandomPairwiseExchange.
metric_strategy m_metric_strategy
Strategy to consider for evaluating the metric e.g., HIGHER_IS_BETTER or LOWER_IS_BETTER.
void select_next(model &m, ltfb::LTFBExecutionContext &ctxt, data_coordinator &dc) const final
std::string m_metric_name
Name of the metric for evaluation.
double EvalType
Definition: base.hpp:189