Skip to main content

A collection of neural network machine learning error metrics.

Project description

# Example Usage
```
import numpy as np
from nn_error_metrics import (
mean_absolute_percentage_error,
mean_absolute_error,
mean_squared_error,
root_mean_squared_error,
binary_cross_entropy,
categorical_correntropy,
sparse_categorical_crossentropy
)

actual = np.array([10, 20, 30, 40, 50])
predicted = np.array([12, 18, 28, 41, 48])

print("Mean Absolute Percentage Error (MAPE):", mean_absolute_percentage_error(actual, predicted))
print("Mean Absolute Error (MAE):", mean_absolute_error(actual, predicted))
print("Mean Squared Error (MSE):", mean_squared_error(actual, predicted))
print("Root Mean Squared Error (RMSE):", root_mean_squared_error(actual, predicted))

actual = np.array([1, 0, 1, 1, 0])
predicted = np.array([0.9, 0.2, 0.8, 0.6, 0.3])
print("Binary Cross Entropy (BCE):", binary_cross_entropy(actual, predicted))

actual = np.array([[0, 1], [1, 0], [0, 1], [0, 1], [1, 0]])
predicted = np.array([[0.1, 0.9], [0.8, 0.2], [0.3, 0.7], [0.6, 0.4], [0.9, 0.1]])
print("Categorical Correntropy (CC):", categorical_correntropy(actual, predicted))

actual = np.array([1, 0, 1, 1, 0])
predicted = np.array([[0.1, 0.9], [0.8, 0.2], [0.3, 0.7], [0.6, 0.4], [0.9, 0.1]])
print("Sparse Categorical Correntropy (SCC):", sparse_categorical_crossentropy(actual, predicted))

```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nn_error_metrics-1.0.1.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

nn_error_metrics-1.0.1-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page