watex.models.pModels#

class watex.models.pModels(model='svm', target='bin', kernel=None, oob_score=False, objective='fr')[source]#

Pretrained Models class.

The pretrained model class is composed of estimators already trained in a case study region in West -Africa Bagoue region. Refer to Kouadio et al, 2022 for furher details. It is a set of support vector machines, decision tree`, k-nearest neighbors, Extreme ``gradient boosting machines, benchmart voting classifier, and `` bagging classifier. Each retrained model is considered as a class object and attributes compose the training parameters from cross-validation results.

Parameters
model: str

Name of the pretrained model. Note that the pretrained SVMs is composed of 04 kernels such as the rbf for radial basis function , the poly for polynomial , sig for sigmoid and lin for linear. Default is rbf. Each kernel is a model attributes of SVM class. For instance to retrieve the pretrained model with kernel = ‘poly’, we must use after fitting pModels class:

>>> pModels(model='svm', kernel='poly').fit().SVM.poly.best_estimator_
... SVC(C=128.0, coef0=7, degree=5, gamma=0.00048828125, kernel='poly', tol=0.01)
>>> # or
>>> pModels(model='svm', kernel='poly').fit().estimator_
... SVC(C=128.0, coef0=7, degree=5, gamma=0.00048828125, kernel='poly', tol=0.01)
kernel: str

kernel refers to SVM machines kernels. It can be rbf for radial basis function , the poly for polynomial , sig for sigmoid and lin for linear. No need to provide since it can be retrieved as an attribute of the SVM model like:

>>> pModels(model='svm').fit().SVM.rbf # is an object instance
>>> # to retreive the rbf values use attribute `best_estimator_
>>> pModels(model='svm').fit().SVM.rbf.best_estimator_
...  SVC(C=2.0, coef0=0, degree=1, gamma=0.125)
target: str

Two types of classification is predicted. The binary classification bin and the multiclass classification multi. default is bin. When turning target to multi, be aware that only the SVMs are trained for multiclass prediction. Futhernore, the bin consisted to predict the flow rate (FR) with label {0} and {1} where {0} means the \(FR <=1 m^3/hr\) and {1} for \(FR> 1m^3/hr\). About multi, four classes are predicted such as:

\[FR0 & = & FR = 0 FR1 & = & 0 < FR <=1 m^3/hr FR2 & = & 1< FR <=3 m^3/hr FR3 & = & FR> 3 m^3/hr\]
oob_score: bool,

Out-of-bag. Setting oob_score to true, you will retrieve some pretrained model with obb_score set to true when training. The pretrained models with fine-tuned model with oob_score set to true are ‘RandomForest’ and ‘Extratrees’.

objective: str, default=’fr’

Is the prediction aim goal, the reason for storing the pretrained models. The default objective is ‘fr’ i.e. for flow rate prediction. Other objectives will be added as new engineering problems are solved and published.

. _Cote d’Ivoire: https://en.wikipedia.org/wiki/Ivory_Coast