PlainModelHyperParams#
- class PlainModelHyperParams#
A struct for the hyperparameters of the plain AI model.
- property d#
number of differentiations
- Type:
Arima model parameter
- property feature_ranges#
A list of pairs specifying the minimum and maximum supported values for each feature for XGBoost and DTree
- property features_bin_size#
Controls the approximation of the feature values and thresholds for XGBoost and DTree. The feature values will be approximated to the closest multiple of features_bin_size. The thresholds will be approximated to the mid-point between the two closest multiples of features_bin_size.
- property features_scale_target#
Controls the scale of the features and thresholds for XGBoost and DTree. The features and thresholds will be scaled so they will be in the range [0, featuresScaleTarget]. Defaults to 500.
- property fit_hyper_params#
Hyper parameters common to most fitting algorithm
- property frep#
Controls the accuracy of the comparison approximation in XGBoost and DTree prediction. A higher frep increases the accuracy on the account of deeper and slower computation.
- property grep#
Controls the accuracy of the comparison approximation in XGBoost and DTree prediction. A higher grep increases the accuracy on the account of deeper and slower computation.
- property init_random_weights#
Initialize the PlainModel with random weights.
- property linear_regression_distribution_x#
The distribution type of X values in linear regression training
- property linear_regression_max_x#
The maximum of the values of X in linear regression training with uniform or unknown distribution.
- property linear_regression_mean_x#
The mean of the values of X in linear regression training with normal distribution.
- property linear_regression_min_x#
The minimum of the values of X in linear regression training with uniform or unknown distribution.
- property linear_regression_std_x#
The standard deviation of the values of X in linear regression training with normal distribution.
- load(self: pyhelayers.PlainModelHyperParams, file: str) None #
Load the object from JSON file.
- Parameters:
file – The name of the JSON file.
- load_from_buffer(self: pyhelayers.PlainModelHyperParams, buffer: bytes) None #
Load the object from JSON buffer.
- Parameters:
buffer – The buffer to load from.
- property logistic_regression_activation#
Activation used in logistic regression.
- property max_rand_value#
Relevant when init_random_weights is set to True. An upper limit for the random values.
- property min_rand_value#
Relevant when init_random_weights is set to True. A lower limit for the random values.
- property mu#
The mu coefficient of the Arima model.
- property negate_sigmoid_input#
Whether to negate the input to the Sigmoid activation function.
- property num_centers#
The number of centers for KMeans.
- property num_samples#
Number of values to use for fitting and training.
- property num_values_used_for_prediction#
The number of previous values of the time series to be used in prediction. A greater value will increase the prediction precision (compared to a plain ARIMA model) on the account of higher multiplication depth.
- property number_of_cached_nodes#
Number of nodes that are shared among trees and their results are cached as an optimization.
- property number_of_features#
Number of features in an input sample. Value of -1 indicates it will be determined by the model file.
- property p#
number of past values effecting current value
- Type:
Arima model parameter
- property phi#
The phi coefficients of the Arima model.
- property q#
number of past errors effecting current value
- Type:
Arima model parameter
- property round_before_storing_thresholds#
In case storeThresholds is true, decides whether the thresholds should be scaled and rounded before they are stored. Turning this flag on makes close thresholds considered the same one, thus reducing runtime on the account of possibly reducing accuracy.
- property sparse_rate#
Relevant when init_random_weights is set to True. The rate of zeroed values. Must be in the range of [0,1]. For example, 0 means no values will be set to zero, while 0.3 means ~30% of the values will be set to zero and ~70% will get values in the range of [min,max).
- property store_thresholds#
If true, XGBoost and DTree will store all thresholds of the model in the user side, in the plain. This has the advantage of making prediction faster and more accurate, on the account of storing additional, possibly sensitive, data in the user side, and requiring the user to do some additional pre-processing. Note that the additional data will be kept in the user side and it will not be exposed to the server at any time.
- property theta1#
The theta1 coefficient of the Arima model.
- property trainable#
Whether the PlainModel object should allow to call fit().
- property varw#
The error variance of the Arima model.
- property verbose#
Verbosity flag.
-
struct PlainModelHyperParams#
A struct for the hyperparameters of the plain AI model.
Public Functions
-
void load(const std::string &hyperParamsJsonFile)#
Load the object from JSON file.
- Parameters:
hyperParamsJsonFile – The name of the JSON file.
-
void load(std::istream &hyperParamsJsonStream)#
Load the object from streams containing JSON file content.
- Parameters:
hyperParamsJsonStream – The stream.
-
void load(const JsonWrapper &hyperParams)#
Load the object from JSON wrapper.
- Parameters:
hyperParams – The JSON wrapper.
Public Members
-
bool verbose = false#
Verbosity flag.
-
bool trainable = false#
Whether the PlainModel object should allow to call fit().
-
bool initRandomWeights = false#
Initialize the PlainModel with random weights.
-
double minRandValue = -0.5#
Constraints over the random values in case where random weights are used.
-
double maxRandValue = 0.5#
-
double sparseRate = 0#
-
FitHyperParams fitHyperParams#
Hyper parameters common to most fitting algorithm.
-
int numberOfFeatures = -1#
Number of features in an input sample.
Value of -1 indicates it will be determined by the model file.
-
LRActivationType logisticRegressionActivation = LR_ACTIVATION_DEFAULT#
Activation used in logistic regression.
-
bool negateSigmoidInput = false#
Whether to negate the input to the Sigmoid activation function.
-
LRDistribution linearRegressionDistributionX = LR_UNIFORM_DISTRIBUTION#
The distribution type of X values in linear regression training.
-
double linearRegressionMinX = 0.0#
The minimum of the values of X in linear regression training with uniform or unknown distribution.
-
double linearRegressionMaxX = 1.0#
The maximum of the values of X in linear regression training with uniform or unknown distribution.
-
double linearRegressionMeanX = 0.0#
The mean of the values of X in linear regression training with normal distribution.
-
double linearRegressionStdX = 1.0#
The standard deviation of the values of X in linear regression training with normal distribution.
-
int p = 1#
The number of past time lags to depend on.
-
int d = 0#
The number of differentiations.
-
int q = 1#
The number of past errors to depend on.
-
int numValuesUsedForPrediction = -1#
See ArimaPlain::numValuesUsedForPrediction.
-
int numSamples = -1#
See ArimaPlain::numSamples.
-
double mu = std::nan("0")#
The mu coefficient of the ARIMA model, which has the following formula: x_(t+1) = mu + sum(phi[i]*x[t-i]) + theta1*e[t] + e_[t+1].
-
std::vector<double> phi#
The phi coefficients of the ARIMA model, which has the following formula: x_(t+1) = mu + sum(phi[i]*x[t-i]) + theta1*e[t] + e_[t+1].
-
double theta1 = std::nan("0")#
The theta1 coefficient of the ARIMA model, which has the following formula: x_(t+1) = mu + sum(phi[i]*x[t-i]) + theta1*e[t] + e_[t+1].
-
double varw = std::nan("0")#
The variance of the error of the ARIMA model.
-
int numCenters = -1#
The number of centers.
-
double featuresScaleTarget = 500#
Controls the scale of the features and thresholds.
The features and thresholds will be scaled so they will be in the range [0, featuresScaleTarget].
-
int featuresBinSize = 4#
Controls the approximation of the feature values and thresholds.
The feature values will be approximated to the closest multiple of featuresBinSize. The thresholds will be approximated to the mid-point between the two closest multiples of featuresBinSize.
-
int gRep = 3#
Controls the accuracy of the comparison approximation in XGBoost and DTree prediction.
A higher grep increases the accuracy on the account of deeper and slower computation.
-
int fRep = 1#
Controls the accuracy of the comparison approximation in XGBoost and DTree prediction.
A higher frep increases the accuracy on the account of deeper and slower computation.
-
std::vector<std::pair<double, double>> featureRanges#
A vector specifying the minimum and maximum supported values for each feature.
-
int numberOfCachedNodes = 10#
Number of nodes that are shared among trees and their results are cached as an optimization.
-
bool storeThresholds = false#
If true, XGBoost and DTree will store all thresholds of the model in the user side, in the plain.
This has the advantage of making prediction faster and more accurate, on the account of storing additional, possibly sensitive, data in the user side, and requiring the user to do some additional pre-processing. Note that the additional data will be kept in the user side and it will not be exposed to the server at any time.
-
bool roundBeforeStoringThresholds = false#
In case storeThresholds is true, decides whether the thresholds should be scaled and rounded before they are stored.
Turning this flag on makes close thresholds considered the same one, thus reducing runtime on the account of possibly reducing accuracy.
-
void load(const std::string &hyperParamsJsonFile)#