Hive_ML.training.models module#

Hive_ML.training.models.adab_tree(max_depth=10, criterion='gini', class_weight=None, n_estimators=100, random_state=None)[source]#

Function to create and return a AdaBoost classifier.

Parameters:
  • n_estimators (int) – set the number of trees in the forest. Default: 100.

  • criterion (str) – selected from either ‘gini’ or ‘entropy’. Default: gini.

  • max_depth (int) – the maximum depth of the trees. Default: 10.

  • class_weight (Union[Dict, List]) – Assigning weights to class labels e.g. : {0:1, 1:2}.

  • random_state (int) – Random state to initialize the classifier.

Return type:

AdaBoostClassifier

Returns:

AdaBoost classifier.

Hive_ML.training.models.decicion_tree(criterion='gini', max_depth=10, class_weight=None, random_state=None)[source]#

Function to create and return a Decision Tree classifier.

Parameters:
  • criterion (str) – selected from either gini or entropy. Default: gini.

  • max_depth (int) – the maximum depth of the trees. Default: 10.

  • class_weight (Union[Dict, List]) – Assigning weights to class labels e.g., {0:1, 1:2}.

  • random_state (int) – Random state to initialize the classifier.

Return type:

DecisionTreeClassifier

Returns:

Decision Tree classifier.

Hive_ML.training.models.knn(neighbors=5, random_state=None)[source]#

Function to create and return a k-NN classifier.

Parameters:
  • neighbors – Nearest neighbours to consider for calculation.

  • random_state (int) – Random state to initialize the classifier.

Return type:

KNeighborsClassifier

Returns:

k-NN Classifier.

Hive_ML.training.models.lda(random_state=None)[source]#

Function to create and return a Linear Discriminant Analysis classifier.

Parameters:

random_state (int) – Random state to initialize the classifier.

Return type:

LinearDiscriminantAnalysis

Returns:

LDA Classifier

Hive_ML.training.models.logistic_regression(random_state=None)[source]#

Function to create and return a Logistic Regression classifier.

Parameters:

random_state (int) – Random state to initialize the classifier.

Return type:

LogisticRegression

Returns:

Logistic Regression classifier.

Hive_ML.training.models.mlp(hidden_layer_sizes=(10, 10, 10), solver='adam', activation='relu', random_state=None)[source]#

Function to create and return a Multy-Layer Perceptron classifier.

Parameters:
  • hidden_layer_sizes (Sequence[int]) – List of Hidden layers dimensions in the MLP.

  • solver (str) – Optimizer. Default: Adam.

  • activation (str) – Activation function. Default: ReLU.

  • random_state (int) – Random state to initialize the classifier.

Return type:

MLPClassifier

Returns:

MLP classifier.

Hive_ML.training.models.naive(random_state=None)[source]#

Function to create and return a Gaussian Naive Bayes classifier.

Parameters:

random_state (int) – Random state to initialize the classifier.

Return type:

GaussianNB

Returns:

Gaussian Naive Bayes Classifier

Hive_ML.training.models.qda(random_state=None)[source]#

Function to create and return a Quadratic Discriminant Analysis classifier.

Parameters:

random_state (int) – Random state to initialize the classifier.

Return type:

QuadraticDiscriminantAnalysis

Returns:

QDA Classifier

Hive_ML.training.models.random_forest(n_estimators=100, criterion='gini', max_depth=10, class_weight=None, max_samples=None, random_state=None)[source]#

Function to create and return a Random Forest classifier.

Parameters:
  • max_samples (Union[int, float]) – The number of samples to draw to train each base estimator.

  • n_estimators (int) – set the number of trees in the forest. Default: 100.

  • criterion (str) – selected from either ‘gini’ or ‘entropy’. Default: gini.

  • max_depth (int) – the maximum depth of the trees. Default: 10.

  • class_weight (Union[Dict, List]) – Assigning weights to class labels e.g. : {0:1, 1:2}.

  • random_state (int) – Random state to initialize the classifier.

Return type:

RandomForestClassifier

Returns:

clf (class) – Random Forest classifier.

Hive_ML.training.models.ridge(random_state=None)[source]#

Function to create and return a Ridge classifier.

Parameters:

random_state (int) – Random state to initialize the classifier.

Returns:

Ridge Classifier

Hive_ML.training.models.svm_kernel(kernel='linear', poly_degree=3, c_val=1, class_weight=None, random_state=None)[source]#

Function to create and return a Support Vector Machine classifier.

Parameters:
  • kernel (str) – selected from linear, rbf, gaussian, or poly. Default : linear.

  • poly_degree (int) – specify the degree of polynomial if poly kernel used.

  • c_val (int) – regularization parameter.

  • class_weight (Union[Dict, List]) – Assigning weights to class labels e.g. : {0:1, 1:2}.

  • random_state (int) – Random state to initialize the classifier.

Return type:

SVC

Returns:

SVM Classifier.