Evaluators¶
Base class
- class evaluators.helpers.eval.EvalBase¶
Bases:
ABC- abstractmethod __init__()¶
Abstract class for learning algorithms in the Adaptive, Hybrid Feature Selection framework.
- abstractmethod fit(**kwargs) None¶
Abstract method for fitting the learning algorithm.
- Parameters:
kwargs – Keyword arguments specific to individual evaluators.
- abstractmethod predict(X: ndarray) ndarray¶
Abstract function for predicting the target vector on the given data.
- Parameters:
X (np.ndarray) – Data to predict the target vector from.
- Returns:
The predicted label vector.
- Return type:
np.ndarray
- score(X: ndarray, y: ndarray) Metrics¶
Performs a prediction, then compares with the true class labels. Returns a Metrics object.
- Parameters:
X (np.ndarray) – Data to predict the target vector from.
y (np.ndarray) – Ground truth target vector.
- Returns:
Metrics object containing the predicted and true class labels.
- Return type:
ANN with Levenberg-Marquardt optimization
- class evaluators.e_AgiLM.AgiLM(layers: list[[<class 'int'>, collections.abc.Callable[[float], float] | None]], tau: float = 1.0, weights_boundary: list[float] = [-0.1, 0.1])¶
Bases:
EvalBase- __init__(layers: list[[<class 'int'>, collections.abc.Callable[[float], float] | None]], tau: float = 1.0, weights_boundary: list[float] = [-0.1, 0.1])¶
Implements the interface of an artificial neural network with Levenberg-Marquardt optimization made by VIHAROS, Zsolt János and SZŰCS, Ágnes. https://doi.org/10.48550/arXiv.2211.11491
Further improvements to this implementation were done by HOANG, Anh Tuan; VINCZE, Tibor; GERCUJ, Bence.
- Parameters:
layers (list[[int, Callable[[float], float] | None], ]) – A two-dimensional list describing the network architecture. Each sublist defines neuron count and activation function. Example: [[8, None], [4, sigmoid], [2, sigmoid]] describes an ANN with 8 inputs, one hidden layer with 4 neurons and sigmoid activation, and binary output with sigmoid activation. “sigmoid” is a Python function with signature (float) -> float.
tau (float) – Tau parameter controlling the optimizer. Default value is 1.0.
weights_boundary (list[float, float]) – Boundary for weights. Default value is [-0.1, 0.1].
- Returns:
None
- Return type:
None
- fit(**kwargs) None¶
Fits the neural network on the provided data.
- Parameters:
kwargs – See below for non-optional and relevant parameters. Consult the source code for the remaining arguments.
train_inputs – Data for the network to be fitted on. np.ndarray
train_targets – Target variable for training. np.ndarray
val_inputs – Data to test per epoch. np.ndarray
val_targets – Target variable for validation. np.ndarray
mu – Optimizer parameter. float
initial_tau – Optimizer parameter. float
max_iteration – Maximum number of epochs for training. int
early_max_stepsize – Early stopping patience. int
MSE_training – Whether to use Mean-Squared Error as a loss function. bool
fix – Whether to use the fixed version of the algorithm. bool
- Returns:
None
- Return type:
None
- predict(X: ndarray) ndarray¶
Performs prediction based on the input data. Fitting is needed prior to prediction.
- Parameters:
X (np.ndarray) – Data from which the target variable is predicted from.
- Returns:
Predicted target variable.
- Return type:
np.ndarray
- evaluators.e_AgiLM.sigmoid(x)¶