Skip to main content

Helpful functions for Data Science

Project description

Build Status codecov

DSfun

This package contains useful loss function class for training algorithms. These are f1-loss related functions. The main features:

  • It is differentiable so it works with tensorflow
  • It is more eficient than standard implementations
  • Great for task that require to optimize F1-score
  • Works with missing data *(TO DO)
  • Can be modified to perform arbitrary differential functions on confusion matrix (TO DO)

Limitations:

  • As any machine learning framework, this loss function shouldn't be used without proper validation as it is not deeply understood
  • If calculating on batches, it will give a biased estimation of global loss
  • If there are no representatives of a class in a batch, it might not converge properly

Instalation

pip install dsfun

Usage

TO DO

import tensorflow as tf from dsfun import f1_loss, f1_score y_true = tf.constant([[1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 1.0]]) y_pred = tf.constant([[0.5, 0.5], [0.5, 0.5], [1.0, 0.0], [0.0, 1.0]]) f1_loss(y_true, y_pred, 'macro') > ? f1_score(y_true, y_pred, 'macro') > ?

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

dsfun-0.0.3.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

dsfun-0.0.3-py3-none-any.whl (4.9 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