Crate dendritic_metrics

Source
Expand description

§Dendritic Metrics Crate

This crate contains metrics for measuring loss, accuracy of general ML models available for dendritic. Metrics contain loss and activiation functions.

§Features

  • Activations: Activation functions for non linear data.
  • Loss: Loss functions for measuring accuracy of classifiers/regressors

§Example Usage

This is an example of some of the loss and activation functions dendritic has to offer

use dendritic_ndarray::ndarray::NDArray;
use dendritic_ndarray::ops::*;
use dendritic_metrics::activations::*; 
use dendritic_metrics::loss::*; 
 
fn main() {

    // Mocked Prediction values
    let y_pred: NDArray<f64> = NDArray::array(
        vec![10, 1],
        vec![
            0.0, 0.0, 1.0, 0.0, 1.0,
            1.0, 1.0, 1.0, 1.0, 1.0
        ]
     ).unwrap();

     // Mocked true values
     let y_true: NDArray<f64> = NDArray::array(
        vec![10, 1],
        vec![
            0.19, 0.33, 0.47, 0.7, 0.74,
            0.81, 0.86, 0.94, 0.97, 0.99
        ]
     ).unwrap();

     // Calculate binary cross entropy for predicted and true values
     let result = binary_cross_entropy(&y_true, &y_pred).unwrap();
     println!("{:?}", result); 

     // Input dataset to perform softmax activation
     let input: NDArray<f64> = NDArray::array(
        vec![3, 1],
        vec![1.0, 1.0, 1.0]
     ).unwrap();

     let sm_result = softmax_prime(input);
     println!("{:?}", sm_result.values()); 
}

§Disclaimer

The dendritic project is a toy machine learning library built for learning and research purposes. It is not advised by the maintainer to use this library as a production ready machine learning library. This is a project that is still very much a work in progress.

Modules§

activations
loss
utils