dendritic-metrics

Crates.iodendritic-metrics
lib.rsdendritic-metrics
version1.5.0
sourcesrc
created_at2024-10-28 12:59:49.156436
updated_at2024-11-01 19:42:51.427931
descriptionMetrics package for dendritic
homepage
repository
max_upload_size
id1425598
size16,153
Shay (shaysingh818)

documentation

README

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

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.

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()); 
}
Commit count: 0

cargo fmt