Helpful functions for Data Science
Project description
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 details)
Built Distribution
dsfun-0.0.3-py3-none-any.whl
(4.9 kB
view details)
File details
Details for the file dsfun-0.0.3.tar.gz
.
File metadata
- Download URL: dsfun-0.0.3.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8829be494ea26133eb2f40ac0836cf737adb412790a5bb07856ff3a1b6b18b6 |
|
MD5 | 06773609aa4a07baf636bce623c5ca36 |
|
BLAKE2b-256 | fd2573647baa59ccc4dbcdb33b120eb4856cc95a9a11d4bbb06fb8c1193b762a |
File details
Details for the file dsfun-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: dsfun-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3c2349ec01198b8c6d7023f248c0b9e99251307ccde3b662f6359d0623330e5 |
|
MD5 | f5fedb2fdf10f52375942aa8f6eae107 |
|
BLAKE2b-256 | 556bd2bad39ba7b7a699ca44756db9bc22b1ffdcd2ff1f1c2f4e01113ed1e0af |