ml_grid.model_classes.keras_classifier_class
Classes
Initializes the kerasClassifier_class. |
Module Contents
- class ml_grid.model_classes.keras_classifier_class.kerasClassifier_class(X: pandas.DataFrame, y: pandas.Series, parameter_space_size: str | None = None)[source]
Initializes the kerasClassifier_class.
This configures a Keras Sequential model for binary classification, wrapped in a KerasClassifier to be compatible with scikit-learn’s hyperparameter tuning utilities.
- Parameters:
X (pd.DataFrame) – Feature matrix for training.
y (pd.Series) – Target vector for training.
parameter_space_size (Optional[str]) – Size of the parameter space for optimization. Defaults to None.
- create_model(kernel_reg: tensorflow.keras.regularizers.Regularizer = tf.keras.regularizers.l1_l2(l1=0, l2=0), width: int = 15, learning_rate: float = 0.01, dropout_val: float = 0.2, input_dim_val: int = 0) keras.models.Sequential [source]
Builds and compiles a Keras Sequential model.
Note: This method appears to be a duplicate of the nested create_model function inside __init__.
- Parameters:
layers (int) – The number of dense layers in the model.
kernel_reg (tf.keras.regularizers.Regularizer) – Kernel regularizer.
width (int) – The number of units in each dense layer.
learning_rate (float) – The learning rate for the Adam optimizer.
dropout_val (float) – The dropout rate.
input_dim_val (int) – The input dimension for the first layer.
- Returns:
The compiled Keras model.
- Return type:
Sequential