From f762e6adb50d0a7eb72825b322e7d4192ae29ef3 Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Sat, 03 Feb 2018 12:38:31 +0000
Subject: [PATCH] Merge pull request #357 from rajendraarora16/new-changes-darknet

---
 src/tree.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/tree.c b/src/tree.c
index cd9fcd1..dfa4178 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -24,6 +24,16 @@
     fprintf(stderr, "Found %d leaves.\n", found);
 }
 
+float get_hierarchy_probability(float *x, tree *hier, int c)
+{
+    float p = 1;
+    while(c >= 0){
+        p = p * x[c];
+        c = hier->parent[c];
+    }
+    return p;
+}
+
 void hierarchy_predictions(float *predictions, int n, tree *hier, int only_leaves)
 {
     int j;

--
Gitblit v1.10.0