Commit f02baf70 by Vik Paruchuri

Fix confidence generation

parent 7391e75c
...@@ -163,12 +163,12 @@ def get_confidence_value(algorithm,model,grader_feats,score, scores): ...@@ -163,12 +163,12 @@ def get_confidence_value(algorithm,model,grader_feats,score, scores):
max_score=max(numpy.asarray(scores)) max_score=max(numpy.asarray(scores))
if algorithm == util_functions.AlgorithmTypes.classification: if algorithm == util_functions.AlgorithmTypes.classification:
#If classification, predict with probability, which gives you a matrix of confidences per score point #If classification, predict with probability, which gives you a matrix of confidences per score point
raw_confidence=model.predict_proba(grader_feats)[0,(score-min_score)] raw_confidence=model.predict_proba(grader_feats)[0,(float(score)-float(min_score))]
#TODO: Normalize confidence somehow here #TODO: Normalize confidence somehow here
confidence=raw_confidence confidence=raw_confidence
else: else:
raw_confidence = model.predict(grader_feats)[0] raw_confidence = model.predict(grader_feats)[0]
confidence = max(raw_confidence - math.floor(raw_confidence), math.ceil(raw_confidence) - raw_confidence) confidence = max(float(raw_confidence) - math.floor(float(raw_confidence)), math.ceil(float(raw_confidence)) - float(raw_confidence))
return confidence return confidence
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment