49template <concepts::implicit_regularized_solver Solver>
62 "Currently only vectors are supported as data.");
112 const scalar_type denominator = trace_sum * trace_sum;
115 return numerator / denominator;
126 "Rate of noise must be a positive value.");
142 value > 0,
"Number of samples must be a positive value.");
154 template <base::concepts::invocable<> RandomNumberGenerator>
156 std::normal_distribution<scalar_type> distribution;
160 noise_[i](j) = distribution(generator);
170 std::mt19937 generator{std::random_device{}()};
226template <concepts::implicit_regularized_solver Solver>
250 optimizer_.configure_child_algorithm_logger_if_exists(
258 const auto [min_param, max_param] =
261 logger(),
"Region of parameters: [{}, {}]", min_param, max_param);
262 const scalar_type log_min_param = log10(min_param);
263 const scalar_type log_max_param = log10(max_param);
265 const auto objective_function =
274 return log10(gcv_value);
276 optimizer_.change_objective_function(objective_function);
279 optimizer_.configure_child_algorithm_logger_if_exists(
285 optimizer_.init(log_min_param, log_max_param);
Definition of any_objective_function class.
Class of tags of logs without memory management.
Class to incorporate logging in algorithms.
void configure_child_algorithm_logger_if_exists(Child &child)
Configure a logger of a child algorithm if exists.
logging_mixin(log_tag_view tag)
Constructor.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
Class to store any type of objects of objective functions.
Class of Gaussian process optimization srinivas2010, brochu2010.
Class to calculate the objective function of GCV.
void generate_noise(RandomNumberGenerator &generator)
Generate noise to use in calculation.
const data_type * data_
Actual data.
implicit_gcv_calculator(solver_type &solver, const data_type &data, const data_type &initial_solution)
Constructor.
auto operator()(scalar_type param) -> scalar_type
Calculate GCV function.
data_type solution_
Buffer of the solution.
auto solver() const noexcept -> solver_type &
Get the solver.
auto num_samples(index_type value) -> implicit_gcv_calculator &
Set the number of samples for approximation of denominator of GCV.
solver_type * solver_
Solver.
Solver solver_type
Type of solvers.
auto noise_rate(scalar_type value) -> implicit_gcv_calculator &
Set the rate of noise.
typename solver_type::data_type data_type
Type of data.
util::vector< data_type > data_with_noise_
Data with noise.
data_type forwarded_data_
Buffer of data generated from the solution.
static constexpr scalar_type default_noise_rate
Default rate of noise.
util::vector< data_type > noise_
Vector of noise.
void generate_noise()
Generate noise with a random seed.
scalar_type noise_multiplier_
Multiplier of noise.
typename solver_type::scalar_type scalar_type
Type of scalars.
const data_type * initial_solution_
Initial solution.
data_type solution_with_noise_
Buffer of the solution with noise.
data_type forwarded_data_with_noise_
Buffer of data generated from the solution with noise.
scalar_type noise_rate_
Rate of noise.
Class to search optimal regularization parameter using GCV.
auto opt_param() const -> scalar_type
Get the optimal regularization parameter.
auto num_samples(index_type value) -> implicit_gcv &
Set the number of samples for approximation of denominator of GCV.
opt::gaussian_process_optimizer< opt::any_objective_function< scalar_type(scalar_type)> > optimizer_
Optimizer.
auto noise_rate(scalar_type value) -> implicit_gcv &
Set the rate of noise.
Solver solver_type
Type of solvers.
implicit_gcv(solver_type &solver, const data_type &data, const data_type &initial_solution)
Constructor.
implicit_gcv_calculator< solver_type > calculator_
Calculator of GCV.
scalar_type opt_param_
Optimal regularization parameter.
void solve(data_type &solution) const
Solver with the optimal regularization parameter.
typename solver_type::scalar_type scalar_type
Type of scalars.
typename solver_type::data_type data_type
Type of data.
void search()
Search the optimal regularization parameter.
Class of vectors wrapping std::vector class to use singed integers as indices.
auto size() const -> index_type
Get the size of this vector.
void resize(index_type size)
Change the size.
auto back() -> reference
Access to the final element.
Concept of Eigen's dense vectors with real scalars.
Definition of exceptions.
Definition of gaussian_process_optimizer class.
Definition of implicit_regularized_solver concept.
Definition of index_type type.
Definition of invocable concept.
Definition of log_tag_view class.
Definition of macros for logging.
#define NUM_COLLECT_LOG_SUMMARY(LOGGER,...)
Write a summary log.
#define NUM_COLLECT_LOG_TRACE(LOGGER,...)
Write a trace log.
#define NUM_COLLECT_LOG_DEBUG(LOGGER,...)
Write a debug log.
Definition of logging_mixin class.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of regularization algorithms.
constexpr auto implicit_gcv_tag
Tag of implicit_gcv.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.
Definition of real_scalar_dense_vector concept.
Definition of vector class.