Browse Source

Panic Handling

Loweel 4 years ago
parent
commit
a87f26c06c
1 changed files with 7 additions and 7 deletions
  1. 7 7
      matrix.go

+ 7 - 7
matrix.go

@@ -91,13 +91,13 @@ func (c *ByClassifier) IsGOOD(key string) {
 //Posterior calculates the posterior probabilities in pseudo-bayes.
 func (c *ByClassifier) Posterior(hdr string) map[string]float64 {
 
-	for c.bayez == nil {
-		time.Sleep(1 * time.Millisecond)
-		log.Println("Waiting the bayesian to exist")
-	}
-
-	return c.bayez.Posterior(hdr)
-
+	var ff map[string]float64
+	ff = make(map[string]float64)
+	ff["BAD"] = 0.5
+	ff["GOOD"] = 0.5
+	defer handlepanic()
+	ff = c.bayez.Posterior(hdr)
+	return ff
 }
 
 //Janitor keeps the maps under a certain size, keeping the biggest values.