3#include "../_cexports/c_polimago.h"
5#include "../global.hpp"
6#include "../string.hpp"
7#include "../value_range.hpp"
8#include "predictor_base.hpp"
9#include "test_result_base.hpp"
29 class PredictorFactoryBase
32 PredictorFactoryBase(
const PredictorFactoryBase &other) =
delete;
33 PredictorFactoryBase &operator=(
const PredictorFactoryBase &other) =
delete;
34 PredictorFactoryBase(PredictorFactoryBase &&other) =
delete;
35 PredictorFactoryBase &operator=(PredictorFactoryBase &&other) =
delete;
36 virtual ~PredictorFactoryBase() =
default;
39 PredictorFactoryBase()
70 return {
'p',
'a',
's',
'+'};
120 std::string asciiCode(Internal::CastToAscii(code));
121 std::transform(asciiCode.begin(), asciiCode.end(), asciiCode.begin(),
122 [](
char ch) { return static_cast<char>(std::tolower(ch)); });
128 preproCode_.assign(asciiCode.begin(), asciiCode.end());
142 return static_cast<char>(std::tolower(static_cast<char>(ch)));
146 for (
auto c : asciiCode)
149 if (
std::find(preprocessingValidCharacters.begin(), preprocessingValidCharacters.end(), c)
150 != preprocessingValidCharacters.end()
166 double Lamda() const noexcept
171 void SetLamda(
double lambda)
noexcept
181 void SetPreproCode(
const String &prepreCode)
183 preproCode_ = prepreCode;
29 class PredictorFactoryBase {
…};
197 class PredictorFactoryBaseEx :
public PredictorFactoryBase
200 PredictorFactoryBaseEx()
201 : PredictorFactoryBase()
218 return interpolation_;
229 interpolation_ = interpolation;
239 return featureResolution_;
255 featureResolution_ = featureResolution;
261 PredictorFactoryBase::UseSettingsFromPredictor(clf);
275 int featureResolution_;
197 class PredictorFactoryBaseEx :
public PredictorFactoryBase {
…};
T back_inserter(T... args)
String Preprocessing() const
Preprocessing code with which this object was generated.
Definition predictor_base.hpp:181
double Lambda() const noexcept
Regularization value that has been used for generating this object.
Definition predictor_base.hpp:100
InterpolationType Interpolation() const noexcept
Interpolation setting used for generating this object.
Definition predictor_base.hpp:120
Base class for Polimago predictors.
Definition predictor_base.hpp:300
int FeatureResolution() const noexcept
Feature resolution value with which the classifier was trained.
Definition predictor_base.hpp:314
Base class for Polimago predictors.
Definition predictor_base.hpp:214
static constexpr InterpolationType InterpolationDefault
Default value for interpolation.
Definition predictor_factory_base.hpp:209
static constexpr double LambdaDefault
Default value for lambda.
Definition predictor_factory_base.hpp:47
Base class for all Polimago Test Results.
Definition test_result_base.hpp:26
int FeatureResolution() const noexcept
Feature resolution value with which the classifier was trained.
Definition test_result_base.hpp:92
Base class for classifier factory classes.
Definition predictor_factory_base.hpp:198
void SetInterpolation(InterpolationType interpolation) noexcept
Sets the interpolation setting to be used for generating this object. Using interpolation will genera...
Definition predictor_factory_base.hpp:227
int FeatureResolution() const noexcept
Gets the feature resolution (determines the size of the classification retina).
Definition predictor_factory_base.hpp:237
void SetFeatureResolution(int featureResolution)
Sets the feature resolution (determines the size of the classification retina).
Definition predictor_factory_base.hpp:247
InterpolationType Interpolation() const noexcept
Gets the interpolation setting to be used for generating this object.
Definition predictor_factory_base.hpp:216
static constexpr InterpolationType InterpolationDefault
Default value for interpolation.
Definition predictor_factory_base.hpp:209
Base class for classifier factory classes.
Definition predictor_factory_base.hpp:30
static constexpr std::array< char, 4 > PreprocessingValidCharacters()
Characters that a preprocessing string may contain.
Definition predictor_factory_base.hpp:68
String Preprocessing() const
Get preprocessing code with which the object is to be generated.
Definition predictor_factory_base.hpp:104
static ValueRange< double > LambdaRange()
Acceptable scale factor range for search classifier training.
Definition predictor_factory_base.hpp:50
void SetLambda(double lambda)
Sets the regularization value to be used for generating the object. Possible values range from 0 to 1...
Definition predictor_factory_base.hpp:89
static String FormatPreprocessingCode(const String &input)
Correct a preprocessing code to make sure that no invalid characters are in the code and the code doe...
Definition predictor_factory_base.hpp:138
static ValueRange< int > FeatureResolutionRange()
Valid range of feature resolution value.
Definition predictor_factory_base.hpp:59
double Lambda() const noexcept
Gets the regularization value to be used for generating the object.
Definition predictor_factory_base.hpp:78
static constexpr double LambdaDefault
Default value for lambda.
Definition predictor_factory_base.hpp:47
static constexpr int FeatureResolutionDefault
Default value for feature resolution.
Definition predictor_factory_base.hpp:56
void SetPreprocessing(const String &code)
Set preprocessing code with which the object is to be generated.
Definition predictor_factory_base.hpp:114
static constexpr int PreprocessingMaxLength
Maximum length of a preprocessing code (excluding the terminating zero).
Definition predictor_factory_base.hpp:65
Container for range definitions.
Definition value_range.hpp:17
Namespace for the Polimago package training functionality.
Definition classification_predictor_factory.hpp:23
std::shared_ptr< PredictorFactoryBaseEx > PredictorFactoryBaseExPtr
Convenience shared pointer for PredictorFactoryBaseEx.
Definition predictor_factory_base.hpp:280
std::shared_ptr< PredictorFactoryBase > PredictorFactoryBasePtr
Convenience shared pointer for PredictorFactoryBase.
Definition predictor_factory_base.hpp:192
Namespace for the Polimago package.
Definition classification_predictor.hpp:38
InterpolationType
Interpolation to be used when extracting image data for classifier generation.
Definition predictor_base.hpp:33
@ Linear
Image data is (if necessary) extracted with linear interpolation.
Definition predictor_base.hpp:37
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
Angle Max(Angle a, Angle b) noexcept
Returns the bigger of two angles.
Definition angle.hpp:495
Angle Min(Angle a, Angle b) noexcept
Returns the smaller of two angles.
Definition angle.hpp:512