All Projects → guillaumegenthial → Tf_metrics

guillaumegenthial / Tf_metrics

Licence: apache-2.0
Multi-class metrics for Tensorflow

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tf metrics

Stats
Go package for abstracting stats collection
Stars: ✭ 164 (-10.87%)
Mutual labels:  metrics
Metrics
Metrics Query Engine
Stars: ✭ 168 (-8.7%)
Mutual labels:  metrics
Metrics
Machine learning metrics for distributed, scalable PyTorch applications.
Stars: ✭ 162 (-11.96%)
Mutual labels:  metrics
Hastic Grafana App
Hastic data management server for labeling patterns and anomalies in Grafana
Stars: ✭ 166 (-9.78%)
Mutual labels:  metrics
Jpeek
Java Code Static Metrics (Cohesion, Coupling, etc.)
Stars: ✭ 168 (-8.7%)
Mutual labels:  metrics
Logi Kafkamanager
一站式Apache Kafka集群指标监控与运维管控平台
Stars: ✭ 3,280 (+1682.61%)
Mutual labels:  metrics
Stackdriver exporter
Google Stackdriver Prometheus exporter
Stars: ✭ 164 (-10.87%)
Mutual labels:  metrics
Intrinsic Image Popularity
The pytorch code of the paper "Intrinsic Image Popularity Assessment"
Stars: ✭ 179 (-2.72%)
Mutual labels:  metrics
Query Exporter
Export Prometheus metrics from SQL queries
Stars: ✭ 166 (-9.78%)
Mutual labels:  metrics
Apache exporter
Prometheus exporter for Apache.
Stars: ✭ 172 (-6.52%)
Mutual labels:  metrics
Map
mean Average Precision - This code evaluates the performance of your neural net for object recognition.
Stars: ✭ 2,324 (+1163.04%)
Mutual labels:  metrics
Rouge 2.0
ROUGE automatic summarization evaluation toolkit. Support for ROUGE-[N, L, S, SU], stemming and stopwords in different languages, unicode text evaluation, CSV output.
Stars: ✭ 167 (-9.24%)
Mutual labels:  metrics
Ostent
Ostent is a server tool to collect, display and report system metrics.
Stars: ✭ 171 (-7.07%)
Mutual labels:  metrics
Metrics
Implementation-agnostic metrics for assessing open source community health. Maintained by the CHAOSS Metrics Committee.
Stars: ✭ 165 (-10.33%)
Mutual labels:  metrics
Phpmetrics
Beautiful and understandable static analysis tool for PHP
Stars: ✭ 2,180 (+1084.78%)
Mutual labels:  metrics
Github Monitoring
Monitor your GitHub Repos with Docker & Prometheus
Stars: ✭ 163 (-11.41%)
Mutual labels:  metrics
Node Statsd Client
Node.js client for statsd
Stars: ✭ 170 (-7.61%)
Mutual labels:  metrics
Collector
pganalyze statistics collector for gathering PostgreSQL metrics and log data
Stars: ✭ 181 (-1.63%)
Mutual labels:  metrics
Client python
Prometheus instrumentation library for Python applications
Stars: ✭ 2,500 (+1258.7%)
Mutual labels:  metrics
Express Prom Bundle
express middleware with standard prometheus metrics in one bundle
Stars: ✭ 172 (-6.52%)
Mutual labels:  metrics

TF Metrics

Build Status

Multi-class metrics for Tensorflow, similar to scikit-learn multi-class metrics.

Thank you all for making this project live (50-100 clones/day 😎). Contributions welcome!

Install

To add tf_metrics to your current python environment, run

pip install git+https://github.com/guillaumegenthial/tf_metrics.git

For a more advanced use (editable mode, for developers)

git clone https://github.com/guillaumegenthial/tf_metrics.git
cd tf_metrics
pip install -r requirements.txt

Example

Pre-requisite: understand the general tf.metrics API. See for instance the official guide on custom estimators or the official documentation.

Simple example

import tensorflow as tf
import tf_metrics

y_true = [0, 1, 0, 0, 0, 2, 3, 0, 0, 1]
y_pred = [0, 1, 0, 0, 1, 2, 0, 3, 3, 1]
pos_indices = [1, 2, 3]  # Class 0 is the 'negative' class
num_classes = 4
average = 'micro'

# Tuple of (value, update_op)
precision = tf_metrics.precision(
    y_true, y_pred, num_classes, pos_indices, average=average)
recall = tf_metrics.recall(
    y_true, y_pred, num_classes, pos_indices, average=average)
f2 = tf_metrics.fbeta(
    y_true, y_pred, num_classes, pos_indices, average=average, beta=2)
f1 = tf_metrics.f1(
    y_true, y_pred, num_classes, pos_indices, average=average)

# Run the update op and get the updated value
with tf.Session() as sess:
    sess.run(tf.local_variables_initializer())
    sess.run(precision[1])

If you want to use it with tf.estimator.Estimator, add to your model_fn

metrics = {
    'precision': precision,
    'recall': recall,
    'f1': f1,
    'f2': f2
    }
# For Tensorboard
for metric_name, metric in metrics.items():
    tf.summary.scalar(metric_name, metric[1])

if mode == tf.estimator.ModeKeys.EVAL:
    return tf.estimator.EstimatorSpec(
        mode, loss=loss, eval_metric_ops=metrics)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].