aiqclib.train.models packageο
Submodulesο
aiqclib.train.models.decision_tree moduleο
This module provides a Decision Tree model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of a Decision Tree classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.decision_tree.DecisionTree(config)[source]ο
Bases:
SklearnModelBaseA Decision Tree model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.tree.DecisionTreeClassifier.
Note
This class sets
expected_class_nameto"DecisionTree". Single Decision Trees in scikit-learn generally do not support then_jobsparameter.- Parameters:
config (ConfigBase)
- expected_class_name: str = 'DecisionTree'ο
- short_name: str = 'DT'ο
aiqclib.train.models.gaussian_naive_bayes moduleο
This module provides a Gaussian Naive Bayes model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of a Naive Bayes classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.gaussian_naive_bayes.GaussianNaiveBayes(config)[source]ο
Bases:
SklearnModelBaseA Gaussian Naive Bayes model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.naive_bayes.GaussianNB.
Note
This class sets
expected_class_nameto"GaussianNaiveBayes". Naive Bayes does not support then_jobsparameter.- Parameters:
config (ConfigBase)
- expected_class_name: str = 'GaussianNaiveBayes'ο
- short_name: str = 'GNB'ο
aiqclib.train.models.k_nearest_neighbors moduleο
This module provides a K-Nearest Neighbors (KNN) model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of a KNN classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.k_nearest_neighbors.KNearestNeighbors(config)[source]ο
Bases:
SklearnModelBaseA K-Nearest Neighbors (KNN) model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.neighbors.KNeighborsClassifier.
Note
This class sets
expected_class_nameto"KNearestNeighbors". Note that KNN can be computationally expensive during prediction for large datasets.- Parameters:
config (ConfigBase)
- expected_class_name: str = 'KNearestNeighbors'ο
- short_name: str = 'KNN'ο
aiqclib.train.models.linear_discriminant_analysis moduleο
This module provides a Linear Discriminant Analysis (LDA) model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of an LDA classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.linear_discriminant_analysis.LinearDiscriminantAnalysis(config)[source]ο
Bases:
SklearnModelBaseA Linear Discriminant Analysis (LDA) model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.discriminant_analysis.LinearDiscriminantAnalysis.
Note
This class sets
expected_class_nameto"LinearDiscriminantAnalysis". Note that LDA in scikit-learn does not support then_jobsparameter.- Parameters:
config (ConfigBase)
- expected_class_name: str = 'LinearDiscriminantAnalysis'ο
- short_name: str = 'LDA'ο
aiqclib.train.models.logistic_regression moduleο
This module provides a Logistic Regression model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of a Scikit-Learn Logistic Regression classifier using Polars DataFrames.
- class aiqclib.train.models.logistic_regression.LogisticRegression(config)[source]ο
Bases:
SklearnModelBaseA Logistic Regression model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters suitable for standard classification tasks.Uses
sklearn.linear_model.LogisticRegression.
Note
This class sets
expected_class_nameto"LogisticRegression".- Parameters:
config (ConfigBase)
- expected_class_name: str = 'LogisticRegression'ο
- short_name: str = 'Logit'ο
aiqclib.train.models.model_suite moduleο
This module provides the ModelSuite class, inheriting
from aiqclib.common.base.model_base.ModelBase.
It facilitates training, prediction, and evaluation with multiple ML methods.
- class aiqclib.train.models.model_suite.ModelSuite(config)[source]ο
Bases:
ModelBaseA model suite class for training and testing multiple machine learning models.
Inherits from
aiqclib.common.base.model_base.ModelBaseto use the common model class interface.Features include:
Automatic application of
model_paramsfrom the YAML configuration, if defined.Manages a collection of different machine learning models for comparative analysis or ensemble operations.
Note
This class sets
expected_class_nameto"ModelSuite".- Parameters:
config (ConfigBase)
- build()[source]ο
Builds the model architecture or pipeline for all models in the suite.
This method is intended to orchestrate the build process for each individual model managed by the ModelSuite. Subclasses or implementations could iterate through self.method_objs and call a build method on each if available, or perform other suite-level setup. As implemented, it currently does nothing (pass).
- Return type:
None
- expected_class_name: str = 'ModelSuite'ο
- multi = Trueο
- set_enable_shap(enable_shap)[source]ο
Sets the SHAP explanation flag for all models within the suite.
Iterates through all instantiated model objects (
method_objs) and sets theirenable_shapattribute to the specified value. This allows for global control over SHAP explanation generation across models.- Parameters:
enable_shap (
bool) β A boolean flag to enable or disable SHAP explanations.
- short_name: str = 'MS'ο
- test()[source]ο
Evaluates the performance of the models in the suite on a test set.
This method is designed to coordinate the testing phase for each individual model. Implementations might iterate through self.method_objs, call a test method on each, and aggregate results, or perform suite-level validation. As implemented, it currently does nothing (pass).
- Return type:
None
- update_nthreads(model)[source]ο
Updates the number of threads for the given ModelSuite instance and its internal models.
This method is intended to update the thread configuration for all sub-models managed within the provided ModelSuite instance. The current implementation (pass) indicates it does not perform any operations. It expects to receive an instance of ModelSuite and is designed to return the modified instance.
- Parameters:
model (
Self) β The ModelSuite instance whose internal modelsβ thread configurations need to be updated.- Returns:
The updated ModelSuite instance, potentially with modified thread settings for its constituent models.
- Return type:
Self
Warning
The current implementation of this method does nothing (pass). Its intended functionality regarding how it interacts with the model parameter (if itβs self or another instance) and how it updates thread counts for individual sub-models is unclear and needs further implementation.
aiqclib.train.models.multilayer_perceptron moduleο
This module provides a Multi-layer Perceptron (MLP) model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of an MLP classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.multilayer_perceptron.MultilayerPerceptron(config)[source]ο
Bases:
SklearnModelBaseA Multi-layer Perceptron (MLP) model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.neural_network.MLPClassifier.
Note
This class sets
expected_class_nameto"MultilayerPerceptron". This is a feedforward neural network implementation.- Parameters:
config (ConfigBase)
- expected_class_name: str = 'MultilayerPerceptron'ο
- short_name: str = 'MLP'ο
aiqclib.train.models.random_forest moduleο
This module provides a Random Forest model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of a Random Forest classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.random_forest.RandomForest(config)[source]ο
Bases:
SklearnModelBaseA Random Forest model wrapper class for training and testing.
Inherits from
SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.ensemble.RandomForestClassifier.
Note
This class sets
expected_class_nameto"RandomForest".- Parameters:
config (ConfigBase)
- expected_class_name: str = 'RandomForest'ο
- short_name: str = 'RF'ο
aiqclib.train.models.support_vector_machine moduleο
This module provides a Support Vector Machine (SVM) model wrapper, inheriting from aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of an SVM classifier using Polars DataFrames, converting them to Pandas for compatibility with the sklearn library.
- class aiqclib.train.models.support_vector_machine.SupportVectorMachine(config)[source]ο
Bases:
SklearnModelBaseA Support Vector Machine (SVM) model wrapper class for training and testing.
Inherits from
aiqclib.common.base.scikit_learn_model_base.SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
sklearn.svm.SVC.Enforces
probability=Trueby default to support the generation of model-scores tables and ROC/PR curves used in the parent class.Uses a linear kernel by default.
Note
Standard SVM implementations (especially with a linear kernel) typically do not support the
n_jobsparameter directly, as parallelization is often handled by underlying BLAS libraries.- Parameters:
config (ConfigBase)
- expected_class_name: str = 'SupportVectorMachine'ο
- short_name: str = 'SVM'ο
aiqclib.train.models.xgboost moduleο
This module provides an XGBoost model wrapper, inheriting from
aiqclib.common.base.scikit_learn_model_base.SklearnModelBase.
It facilitates training, prediction, and evaluation of an XGBoost classifier using Polars DataFrames, converting them to Pandas for compatibility with the xgboost library.
- class aiqclib.train.models.xgboost.XGBoost(config)[source]ο
Bases:
SklearnModelBaseAn XGBoost model wrapper class for training and testing.
Inherits from
aiqclib.common.base.scikit_learn_model_base.SklearnModelBaseto reuse common Scikit-Learn API logic.Features include:
Automatic application of
model_paramsfrom the YAML config, if defined; otherwise, uses default hyperparameters.Uses
xgboost.XGBClassifier.
Note
This class sets
expected_class_nameto"XGBoost"andshort_nameto"XGB".- Parameters:
config (ConfigBase)
- expected_class_name: str = 'XGBoost'ο
- short_name: str = 'XGB'ο