Functions

lucidmode requires … .

Cost functions

lucidmode.functions.cost(Y_hat, Y, type)[source]

Cost functions

Parameters
Y_hat: np.array

Predicted values

Y: np.array

Ground truth or real values

type: str

One of the following options:

  • ‘sse’: sum of squared errors

  • ‘mse’: mean of squared errors

  • ‘binary-logloss’: binary cross-entropy

  • ‘multi-logloss’: multi-class cross-entropy

Returns
cost: np.float32

The binary cross-entropy or logloss cost function was utilized for both of the implemented models.

\[J(w)=-\frac{1}{m} \sum_{i=1}^{m} \big[ y_i\ log(p_{i}) + (1-y_{i})\ log(1-p_{i}) \big]\]
where:
  • \(m\): Number of samples.

  • \(w\): Model weights.

  • \(y_{i}\): The i-th ground truth (observed) output.

  • \(p_{i}\): The i-th probabilistically forecasted output.

Metrics

lucidmode.tools.metrics.metrics(y, y_hat, type, use='learning')[source]

Statistical and performance metrics for regression and classification, for single class One-Vs-One, for multiclass One-Vs-Rest.

Parameters
y: np.array

Ground truth data

y_hat: np.array

Predicted data

type: str

The type of model is going to be tested. The options are: ‘classification’, ‘regression’

use: str
  • ‘learning’: To measure performance of models in the learning process

  • ‘information’: To measure information aspects for generalization goals