cnn module¶
This script provides a CNN to solve a classification problem.
The script receives the training and test datasets (labels and data) as well as the mRMR ranking to perform the
classification. The optimisation of the parameters in the different models is carried out through a grid search,
using sklearn.model_selection.GridSearchCV. Different subsets of features of the mRMR ranking are
selected in order to determine which subset is the best.
-
cnn.create_model(n_filters=15, kernel_size=3)[source]¶ Create the CNN model.
Parameters: :return CNN model :rtype:
keras.model.sequential
-
cnn.fit_model(model, data_train, data_test, labels_train, labels_test)[source]¶ Fit the model. The features of the dataset (mRMR ranking) are selected before fit the model
Parameters: - model (
sklearn.model_selection.GridSearchCV) – Classifier model created by the GridSearchCV function - data_train (
numpy.ndarray) – Training dataset data - data_test (
numpy.ndarray) – Test dataset data - labels_train (
numpy.ndarray) – Training dataset labels - labels_test (
numpy.ndarray) – Test dataset labels
:return Accuracy :rtype:
float- model (