forked from enviPath/enviPy
model stats
This commit is contained in:
@ -2815,6 +2815,21 @@ class PackageBasedModel(EPModel):
|
||||
)
|
||||
multigen_eval = models.BooleanField(null=False, blank=False, default=False)
|
||||
|
||||
def statistics(self):
|
||||
return {
|
||||
'accuracy': [
|
||||
self.eval_results["average_accuracy"],
|
||||
self.eval_results.get("multigen_average_accuracy")],
|
||||
'precision': [
|
||||
self.eval_results["average_precision_per_threshold"][f"{self.threshold:.2f}"],
|
||||
self.eval_results.get("multigen_average_precision_per_threshold", {}).get(f"{self.threshold:.2f}")
|
||||
],
|
||||
'recall': [
|
||||
self.eval_results["average_recall_per_threshold"][f"{self.threshold:.2f}"],
|
||||
self.eval_results.get("multigen_average_recall_per_threshold", {}).get(f"{self.threshold:.2f}")
|
||||
],
|
||||
}
|
||||
|
||||
@property
|
||||
def pr_curve(self):
|
||||
if self.model_status != self.FINISHED:
|
||||
|
||||
@ -313,6 +313,44 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Model Statistics Panel -->
|
||||
<div class="collapse-arrow bg-base-200 collapse">
|
||||
<input type="checkbox" checked />
|
||||
<div class="collapse-title text-xl font-medium">Model Statistics for threshold {{ model.threshold }}</div>
|
||||
<div class="collapse-content">
|
||||
<div class="flex justify-center">
|
||||
<div
|
||||
id="model-stats"
|
||||
class="overflow-x-auto rounded-box shadow-md bg-base-100"
|
||||
>
|
||||
<table class="table table-fixed w-full">
|
||||
<thead class="text-base">
|
||||
<tr>
|
||||
<th class="w-1/5">Metric</th>
|
||||
<th>Single Gen Value</th>
|
||||
{% if model.multigen_eval %}
|
||||
<th>Multi Gen Value</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for metric, value in model.statistics.items %}
|
||||
<tr>
|
||||
<td>{{ metric|upper }}</td>
|
||||
<td>{{ value.0|floatformat:3 }}</td>
|
||||
{% if model.multigen_eval %}
|
||||
<td>{{ value.1|floatformat:3 }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
<script>
|
||||
function makeChart(selector, data) {
|
||||
|
||||
Reference in New Issue
Block a user