IA_training module#
The EntrainementIA algorithm is designed to train an artificial neural network, specifically a Multi-Layer Perceptron (MLP), using the preprocessed databases.
Tip
The algorithm also provides the ability to save the trained model’s weights for future use. It also allows loading previously saved weights to set the MLP model’s parameters.
- class IA_training.EntrainementIA[source]#
Bases:
object
Class for training an artificial neural network (MLP) using the preprocessed databases.
- x_train#
Input features for training.
- Type:
ndarray
- y_train#
Target labels for training.
- Type:
ndarray
- x_test#
Input features for testing.
- Type:
ndarray
- y_test#
Target labels for testing.
- Type:
ndarray
- mlp#
Multi-layer Perceptron classifier.
- Type:
MLPClassifier
- Fit()[source]#
Train the MLP model.
This method trains the MLP model using the configured training data and target labels.
- Impoids()[source]#
Display weight matrices.
This method displays the weight matrices of the trained model.
- __init__()[source]#
Initialize the EntrainementIA class.
This method imports the preprocessed databases, sets up the training and testing data, configures the MLP classifier, and performs the training.
Warning
The preprocessed databases should be stored in CSV files with specific filenames.
The MLP classifier hyperparameters can be adjusted within the method.
- afficheinfo()[source]#
Display information about the trained model.
This method displays the accuracy score and loss curve of the trained model.
- matconf()[source]#
Display the confusion matrix.
This method displays the confusion matrix of the trained model.
- montreimage(k, set)[source]#
Display the k-th image from the specified dataset.
- Parameters:
k (int) – Index of the image to display.
set (ndarray) – Dataset to retrieve the image from.
- Returns:
Always returns 0.
- Return type:
int