openModeller
Version 1.4.0
|
#include <niche_mosaic.hh>
Public Member Functions | |
NicheMosaic () | |
~NicheMosaic () | |
int | initialize () |
int | iterate () |
int | done () const |
float | getProgress () const |
Scalar | getValue (const Sample &x) const |
int | setMinMaxDelta () |
void | createModel (std::vector< ScalarVector > &_model_min, std::vector< ScalarVector > &_model_max, const std::vector< Scalar > &delta) |
void | editModel (std::vector< ScalarVector > &model_min, std::vector< ScalarVector > &model_max, const std::vector< Scalar > &delta, size_t i_layer) |
size_t | calculateCostPres (const std::vector< ScalarVector > &_model_min, const std::vector< ScalarVector > &_model_max) |
size_t | calculateCostAus (const std::vector< ScalarVector > &_model_min, const std::vector< ScalarVector > &_model_max) |
size_t | getRandomLayerNumber () |
Scalar | getRandomPercent (const std::vector< Scalar > &delta, const size_t i_layer, size_t &cost1) |
void | renewTabuDegree (std::vector< size_t > &tabuDegree) |
void | saveBestModel (const std::vector< ScalarVector > &model_min, const std::vector< ScalarVector > &model_max) |
void | improveModel (const std::vector< Scalar > &deltaBest) |
void | findSolution (size_t &costBest, std::vector< Scalar > &deltaBest, int &bestIter, size_t &bestCost2) |
OccurrencesPtr | cleanOccurrences (const OccurrencesPtr &occurrences) |
void | computeMeanDeviation (const OccurrencesPtr &occs, Sample &mean, Sample &deviation) |
Protected Member Functions | |
void | _getConfiguration (ConfigurationPtr &) const |
void | _setConfiguration (const ConstConfigurationPtr &) |
Private Attributes | |
int | _num_iterations |
int | _num_points |
size_t | _num_points_test |
size_t | _num_points_absence_test |
int | _num_layers |
Sample | _minimum |
Sample | _maximum |
Sample | _delta |
OccurrencesPtr | _my_presences |
OccurrencesPtr | _my_presences_test |
OccurrencesPtr | _my_absence_test |
Scalar | _bestCost |
bool | _done |
float | _progress |
SamplerPtr | _sampp |
std::vector< ScalarVector > | _model_min_best |
std::vector< ScalarVector > | _model_max_best |
Definition at line 35 of file niche_mosaic.hh.
Definition at line 120 of file niche_mosaic.cpp.
Definition at line 139 of file niche_mosaic.cpp.
void NicheMosaic::_getConfiguration | ( | ConfigurationPtr & | config | ) | const [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 633 of file niche_mosaic.cpp.
References _done, _model_max_best, _model_min_best, _num_layers, and _num_points.
void NicheMosaic::_setConfiguration | ( | const ConstConfigurationPtr & | config | ) | [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 660 of file niche_mosaic.cpp.
References _done, _model_max_best, _model_min_best, _num_layers, and _num_points.
size_t NicheMosaic::calculateCostAus | ( | const std::vector< ScalarVector > & | _model_min, |
const std::vector< ScalarVector > & | _model_max | ||
) |
Definition at line 426 of file niche_mosaic.cpp.
References _my_absence_test, _num_layers, and _num_points.
Referenced by findSolution().
size_t NicheMosaic::calculateCostPres | ( | const std::vector< ScalarVector > & | _model_min, |
const std::vector< ScalarVector > & | _model_max | ||
) |
Definition at line 391 of file niche_mosaic.cpp.
References _my_presences_test, _num_layers, and _num_points.
Referenced by findSolution().
OccurrencesPtr NicheMosaic::cleanOccurrences | ( | const OccurrencesPtr & | occurrences | ) |
Definition at line 697 of file niche_mosaic.cpp.
References AlgorithmImpl::_samp, computeMeanDeviation(), createSampler(), and Sample::size().
Referenced by initialize().
void NicheMosaic::computeMeanDeviation | ( | const OccurrencesPtr & | occs, |
Sample & | mean, | ||
Sample & | deviation | ||
) |
Definition at line 806 of file niche_mosaic.cpp.
References min(), Sample::resize(), Sample::size(), and Sample::sqrt().
Referenced by cleanOccurrences().
void NicheMosaic::createModel | ( | std::vector< ScalarVector > & | _model_min, |
std::vector< ScalarVector > & | _model_max, | ||
const std::vector< Scalar > & | delta | ||
) |
Definition at line 353 of file niche_mosaic.cpp.
References _my_presences, and _num_layers.
Referenced by findSolution().
int NicheMosaic::done | ( | ) | const [inline, virtual] |
Return != 0 if algorithm finished.
Reimplemented from AlgorithmImpl.
Definition at line 69 of file niche_mosaic.hh.
References _done.
Referenced by getProgress().
void NicheMosaic::editModel | ( | std::vector< ScalarVector > & | model_min, |
std::vector< ScalarVector > & | model_max, | ||
const std::vector< Scalar > & | delta, | ||
size_t | i_layer | ||
) |
Definition at line 373 of file niche_mosaic.cpp.
References _my_presences.
Referenced by findSolution().
void NicheMosaic::findSolution | ( | size_t & | costBest, |
std::vector< Scalar > & | deltaBest, | ||
int & | bestIter, | ||
size_t & | bestCost2 | ||
) |
Definition at line 556 of file niche_mosaic.cpp.
References _bestCost, _delta, _num_iterations, _num_layers, _num_points, _num_points_absence_test, _num_points_test, _progress, calculateCostAus(), calculateCostPres(), createModel(), editModel(), getRandomLayerNumber(), getRandomPercent(), renewTabuDegree(), and saveBestModel().
Referenced by iterate().
float NicheMosaic::getProgress | ( | ) | const [virtual] |
Returns progress so far (between 0.0 and 1.0)
Reimplemented from AlgorithmImpl.
Definition at line 277 of file niche_mosaic.cpp.
References _progress, and done().
size_t NicheMosaic::getRandomLayerNumber | ( | ) |
Definition at line 462 of file niche_mosaic.cpp.
References _num_layers.
Referenced by findSolution().
Scalar NicheMosaic::getRandomPercent | ( | const std::vector< Scalar > & | delta, |
const size_t | i_layer, | ||
size_t & | cost1 | ||
) |
Definition at line 470 of file niche_mosaic.cpp.
References _num_points_test.
Referenced by findSolution().
Scalar NicheMosaic::getValue | ( | const Sample & | x | ) | const [virtual] |
The algorithm must return the occurrence probability at the given environment conditions.
x | Environmental conditions. |
Implements AlgorithmImpl.
Definition at line 292 of file niche_mosaic.cpp.
References _model_max_best, _model_min_best, _num_layers, and _num_points.
void NicheMosaic::improveModel | ( | const std::vector< Scalar > & | deltaBest | ) |
Definition at line 513 of file niche_mosaic.cpp.
References _model_max_best, _model_min_best, _my_presences_test, _num_layers, and _num_points.
Referenced by iterate().
int NicheMosaic::initialize | ( | ) | [virtual] |
Initiate a new training.
Implements AlgorithmImpl.
Definition at line 146 of file niche_mosaic.cpp.
References _my_absence_test, _my_presences, _my_presences_test, _num_iterations, _num_layers, _num_points_absence_test, AlgorithmImpl::_samp, _sampp, cleanOccurrences(), createSampler(), Log::error(), AlgorithmImpl::getParameter(), Log::instance(), NUMITERATIONS_ID, and Log::warn().
int NicheMosaic::iterate | ( | ) | [virtual] |
One step further on the training. Return 0 if something wrong happened.
Reimplemented from AlgorithmImpl.
Definition at line 214 of file niche_mosaic.cpp.
References _done, _model_max_best, _model_min_best, _my_absence_test, _my_presences, _my_presences_test, _num_iterations, _num_layers, _num_points, _num_points_absence_test, _num_points_test, _sampp, findSolution(), improveModel(), setMinMaxDelta(), and splitOccurrences().
void NicheMosaic::renewTabuDegree | ( | std::vector< size_t > & | tabuDegree | ) |
Definition at line 492 of file niche_mosaic.cpp.
References _num_layers.
Referenced by findSolution().
void NicheMosaic::saveBestModel | ( | const std::vector< ScalarVector > & | model_min, |
const std::vector< ScalarVector > & | model_max | ||
) |
Definition at line 502 of file niche_mosaic.cpp.
References _model_max_best, _model_min_best, _num_layers, and _num_points.
Referenced by findSolution().
int NicheMosaic::setMinMaxDelta | ( | ) |
Definition at line 322 of file niche_mosaic.cpp.
References _delta, _maximum, _minimum, _my_presences, _num_layers, Log::error(), and Log::instance().
Referenced by iterate().
Scalar NicheMosaic::_bestCost [private] |
Definition at line 50 of file niche_mosaic.hh.
Referenced by findSolution().
Sample NicheMosaic::_delta [private] |
Definition at line 46 of file niche_mosaic.hh.
Referenced by findSolution(), and setMinMaxDelta().
bool NicheMosaic::_done [private] |
Definition at line 51 of file niche_mosaic.hh.
Referenced by _getConfiguration(), _setConfiguration(), done(), and iterate().
Sample NicheMosaic::_maximum [private] |
Definition at line 45 of file niche_mosaic.hh.
Referenced by setMinMaxDelta().
Sample NicheMosaic::_minimum [private] |
Definition at line 44 of file niche_mosaic.hh.
Referenced by setMinMaxDelta().
std::vector<ScalarVector> NicheMosaic::_model_max_best [private] |
Definition at line 55 of file niche_mosaic.hh.
Referenced by _getConfiguration(), _setConfiguration(), getValue(), improveModel(), iterate(), and saveBestModel().
std::vector<ScalarVector> NicheMosaic::_model_min_best [private] |
Definition at line 54 of file niche_mosaic.hh.
Referenced by _getConfiguration(), _setConfiguration(), getValue(), improveModel(), iterate(), and saveBestModel().
OccurrencesPtr NicheMosaic::_my_absence_test [private] |
Definition at line 49 of file niche_mosaic.hh.
Referenced by calculateCostAus(), initialize(), and iterate().
OccurrencesPtr NicheMosaic::_my_presences [private] |
Definition at line 47 of file niche_mosaic.hh.
Referenced by createModel(), editModel(), initialize(), iterate(), and setMinMaxDelta().
Definition at line 48 of file niche_mosaic.hh.
Referenced by calculateCostPres(), improveModel(), initialize(), and iterate().
int NicheMosaic::_num_iterations [private] |
Definition at line 39 of file niche_mosaic.hh.
Referenced by findSolution(), initialize(), and iterate().
int NicheMosaic::_num_layers [private] |
Definition at line 43 of file niche_mosaic.hh.
Referenced by _getConfiguration(), _setConfiguration(), calculateCostAus(), calculateCostPres(), createModel(), findSolution(), getRandomLayerNumber(), getValue(), improveModel(), initialize(), iterate(), renewTabuDegree(), saveBestModel(), and setMinMaxDelta().
int NicheMosaic::_num_points [private] |
Definition at line 40 of file niche_mosaic.hh.
Referenced by _getConfiguration(), _setConfiguration(), calculateCostAus(), calculateCostPres(), findSolution(), getValue(), improveModel(), iterate(), and saveBestModel().
size_t NicheMosaic::_num_points_absence_test [private] |
Definition at line 42 of file niche_mosaic.hh.
Referenced by findSolution(), initialize(), and iterate().
size_t NicheMosaic::_num_points_test [private] |
Definition at line 41 of file niche_mosaic.hh.
Referenced by findSolution(), getRandomPercent(), and iterate().
float NicheMosaic::_progress [private] |
Definition at line 52 of file niche_mosaic.hh.
Referenced by findSolution(), and getProgress().
SamplerPtr NicheMosaic::_sampp [private] |
Definition at line 53 of file niche_mosaic.hh.
Referenced by initialize(), and iterate().