Skip to main content

No project description provided

Project description

Build Status



Python-implemented hierarchical multi-class validation metrics: HMC-loss . Original paper is (Bi&Kwok, 2012) .


pip install hmc_loss


  • numpy
  • Network X

How to use

This metrics is implemented like scikit-learn metrics.

from hmc_loss import hmc_loss_score, get_cost_list
import numpy as np

# Generate label data(2-D array of numpy)
true_label = np.random.randint(2, size(100, 100))
pred_label = np.random.randint(2, size(100, 100))

# Generate test graph(Di-Graph of NetworkX)
graph = nx.gnc_graph(100)
# Generate element list of graph node
label_list = list(range(100))
# Calculate cost of each node in graph
cost_list = get_cost_list(graph, 0, label_list)
# Calculate HMC-loss
hmc_loss_score(true_label, pred_label, graph, 0, label_list, cost_list, alpha=0.5, beta=1.5)





Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
hmc_loss-1.0.0.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page