Skip to content

Commit

Permalink
add plots back to quant-analysis section (#512)
Browse files Browse the repository at this point in the history
* add plots back to quant-analysis section

* add check to see if graphics is not none
  • Loading branch information
a-kore authored Nov 24, 2023
1 parent b19bd76 commit b916535
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 43 deletions.
8 changes: 8 additions & 0 deletions cyclops/report/templates/cyclops_generic_template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@
{{ render_metric_card(metric_card) }}
{% endif %}
{% endfor %}
{% if section is hasattr "graphics"%}
{% if section.graphics is not none%}
<div class="subcard" style="min-width:1400px;">
<h3>{{ "Graphics" }}</h3>
{{ render_if_exist_list(section.graphics) }}
</div>
{% endif %}
{% endif %}
{% else %}
{{ render_objects(section) }}
{% endif %}
Expand Down
48 changes: 5 additions & 43 deletions docs/source/tutorials/kaggle/heart_failure_prediction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1232,49 +1232,11 @@
"shutil.copy(f\"{report_path}\", \".\")\n",
"for i in range(4):\n",
" report._model_card.overview = None\n",
" report._model_card.quantitative_analysis = None\n",
" results_flat = flatten_results_dict(\n",
" results=results,\n",
" remove_metrics=[\"BinaryROCCurve\", \"BinaryPrecisionRecallCurve\"],\n",
" model_name=model_name,\n",
" )\n",
"\n",
" for name, metric in results_female_flat.items():\n",
" split, name = name.split(\"/\") # noqa: PLW2901\n",
" descriptions = {\n",
" \"BinaryPrecision\": \"The proportion of predicted positive instances that are correctly predicted.\",\n",
" \"BinaryRecall\": \"The proportion of actual positive instances that are correctly predicted. Also known as recall or true positive rate.\",\n",
" \"BinaryAccuracy\": \"The proportion of all instances that are correctly predicted.\",\n",
" \"BinaryAUROC\": \"The area under the receiver operating characteristic curve (AUROC) is a measure of the performance of a binary classification model.\",\n",
" \"BinaryF1Score\": \"The harmonic mean of precision and recall.\",\n",
" }\n",
" report.log_quantitative_analysis(\n",
" \"performance\",\n",
" name=name,\n",
" value=np.clip(metric + np.random.normal(0, 0.1), 0, 1),\n",
" description=descriptions[name],\n",
" metric_slice=split,\n",
" pass_fail_thresholds=0.7,\n",
" pass_fail_threshold_fns=lambda x, threshold: bool(x >= threshold),\n",
" )\n",
"\n",
" for name, metric in results_flat.items():\n",
" split, name = name.split(\"/\") # noqa: PLW2901\n",
" descriptions = {\n",
" \"BinaryPrecision\": \"The proportion of predicted positive instances that are correctly predicted.\",\n",
" \"BinaryRecall\": \"The proportion of actual positive instances that are correctly predicted. Also known as recall or true positive rate.\",\n",
" \"BinaryAccuracy\": \"The proportion of all instances that are correctly predicted.\",\n",
" \"BinaryAUROC\": \"The area under the receiver operating characteristic curve (AUROC) is a measure of the performance of a binary classification model.\",\n",
" \"BinaryF1Score\": \"The harmonic mean of precision and recall.\",\n",
" }\n",
" report.log_quantitative_analysis(\n",
" \"performance\",\n",
" name=name,\n",
" value=np.clip(metric + np.random.normal(0, 0.1), 0, 1),\n",
" description=descriptions[name],\n",
" metric_slice=split,\n",
" pass_fail_thresholds=0.7,\n",
" pass_fail_threshold_fns=lambda x, threshold: bool(x >= threshold),\n",
" for metric in report._model_card.quantitative_analysis.performance_metrics:\n",
" metric.value = np.clip(\n",
" metric.value + np.random.normal(0, 0.1),\n",
" 0,\n",
" 1,\n",
" )\n",
" report_path = report.export(\n",
" output_filename=\"heart_failure_report_periodic.html\",\n",
Expand Down

0 comments on commit b916535

Please sign in to comment.