-
Notifications
You must be signed in to change notification settings - Fork 14
/
output.txt
84 lines (64 loc) · 2.71 KB
/
output.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
##File: /Users/allwefantasy/projects/byzer-extension/byzer-yaml-visualization/docs/roc-visualization-guide.md
```markdown
# ROC Visualization with Byzer YAML Visualization
## Introduction
This guide explains how to use the Byzer YAML Visualization extension to create Receiver Operating Characteristic (ROC) curve visualizations. ROC curves are commonly used to evaluate the performance of classification models by depicting the trade-off between true positive rate and false positive rate.
## Prerequisites
Before creating ROC visualizations, ensure that you have installed the byzer-yaml-visualization extension and have a classification dataset available in Byzer.
## YAML Configuration
Here's how to configure the YAML for generating an ROC curve:
```yaml
runtime:
env: source /opt/miniconda3/bin/activate ray-1.12.0
cache: true
output: roc_output
control:
format: image
fig:
auc:
title: "ROC Curve"
labels:
x: "False Positive Rate"
y: "True Positive Rate"
```
## SQL to Generate ROC Visualization
After setting up your data, you can invoke the visualization by using the following Byzer script:
```sql
load parquet.`path/to/your/data` as model_output;
select cast(probability as double) as probability,
cast(label as int) as label
from model_output;
!visualize model_output '''
runtime:
env: source /opt/miniconda3/bin/activate ray-1.12.0
cache: true
output: roc_output
control:
format: image
fig:
auc:
title: "ROC Curve"
labels:
x: "False Positive Rate"
y: "True Positive Rate"
''';
select unbase64(content) as content, "roc_curve.png" as fileName from roc_output as imageTable;
save overwrite imageTable as image.`/tmp/images`
where imageColumn="content"
and fileName="fileName";
```
This script will process the data and produce an ROC curve visualization that is saved as an image. The `!visualize` command triggers the visualization based on the defined YAML configuration.
## Handling the Output
The output from the visualization is encoded in base64 format. To use or display the image:
```sql
!fs -ls /tmp/images;
-- To upload the image if needed:
save overwrite command as Rest.`YOUR_UPLOAD_URL`
where `config.method`="post"
and `header.content-type`="multipart/form-data"
and `form.file-path`="/tmp/images/roc_curve.png"
and `form.file-name`="roc_curve.png";
```
This guide should help you understand and apply ROC curve visualization using Byzer YAML Visualization in your data analysis workflows.
```
This markdown document provides a comprehensive guide on using the byzer-yaml-visualization extension to generate and manage ROC curve visualizations, including the necessary SQL scripts and YAML configurations.