Ultra 0.9.4
Loading...
Searching...
No Matches
sonar.cc

Classification (Genetic Programming).

/*
* \file
* \remark This file is part of ULTRA.
*
* \copyright Copyright (C) 2024 EOS di Manlio Morini.
*
* \license
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/
*
* \see https://github.com/morinim/ultra/wiki/sonar_tutorial
*/
/* CHANGES IN THIS FILE MUST BE APPLIED TO THE LINKED WIKI PAGE */
#include "kernel/ultra.h"
int main()
{
using namespace ultra;
// READING INPUT DATA
params.output_index = src::dataframe::params::index::back;
src::problem prob("sonar.csv", params);
// SETTING UP SYMBOLS
prob.setup_symbols();
// SEARCHING
src::search s(prob);
s.validation_strategy<src::holdout_validation>(prob);
const auto result(s.run());
std::cout << "\nCANDIDATE SOLUTION\n"
<< out::c_language << result.best_individual()
<< "\n\nACCURACY\n" << *result.best_measurements().accuracy * 100.0
<< '%'
<< "\n\nFITNESS\n" << *result.best_measurements().fitness << '\n';
}
Definition holdout_validation.h:35
Definition gp/src/problem.h:66
void setup_symbols(symbol_init=symbol_init::all)
Definition gp/src/problem.cc:354
Definition gp/src/search.h:79
std::ostream & c_language(std::ostream &o)
Definition individual_format.cc:57
Definition dataframe.h:187
std::optional< std::size_t > output_index
Definition dataframe.h:205