rocelib.models.keras_models package

Submodules

rocelib.models.keras_models.TrainableKerasModel module

class rocelib.models.keras_models.TrainableKerasModel.TrainableKerasModel(input_dim, hidden_dim, output_dim)[source]

Bases: TrainableModel

A simple feedforward neural network model using Keras for binary classification.

This model includes one hidden layer with ReLU activation and an output layer with a sigmoid activation function. It utilizes the Adam optimizer with a learning rate of 0.001 and the binary cross-entropy loss function.

model

The Keras Sequential model instance containing the neural network architecture.

Type:

keras.models.Sequential

__init__(input_dim: int, hidden_dim: int, output_dim: int):

Initializes the neural network model with the specified dimensions.

train(X: pd.DataFrame, y: pd.DataFrame, epochs: int = 100, batch_size: int = 32) None:[source]

Trains the model using the provided feature and target variables.

predict(X: pd.DataFrame) pd.DataFrame:[source]

Predicts the outcomes for a set of instances.

predict_single(x: pd.DataFrame) int:[source]

Predicts the outcome for a single instance and returns the class label.

evaluate(X: pd.DataFrame, y: pd.DataFrame) Dict[str, float]:[source]

Evaluates the model on the provided feature and target variables.

predict_proba(x: pd.DataFrame) pd.DataFrame:[source]

Predicts the probabilities of outcomes for a set of instances.

evaluate(X, y)[source]

Evaluates the model on the provided data.

@param X: The feature variables for evaluation, as a DataFrame. @param y: The target variable for evaluation, as a DataFrame. @return: A dictionary containing the loss and accuracy of the model.

Return type:

Dict[str, float]

predict(X)[source]

Predicts outcomes for a set of instances.

@param X: The instances to predict, as a DataFrame. @return: Predictions as a DataFrame.

Return type:

DataFrame

predict_proba(x)[source]

Predicts the probabilities of outcomes for a set of instances.

@param x: The instances to predict, as a DataFrame. @return: Probabilities of each outcome as a DataFrame.

Return type:

DataFrame

predict_single(x)[source]

Predicts the outcome for a single instance.

@param x: The instance to predict, as a DataFrame. @return: The predicted class label (0 or 1).

Return type:

int

train(X, y, epochs=100, batch_size=32, **kwargs)[source]

Trains the model on the provided data.

@param X: The feature variables as a DataFrame. @param y: The target variable as a DataFrame. @param epochs: The number of epochs to train the model (default is 100). @param batch_size: The batch size used in training (default is 32).

Return type:

None

Module contents