wandb 0.18.5__py3-none-win_amd64.whl → 0.18.6__py3-none-win_amd64.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +2 -2
- wandb/__init__.pyi +21 -19
- wandb/agents/pyagent.py +1 -1
- wandb/apis/importers/wandb.py +1 -1
- wandb/apis/normalize.py +2 -18
- wandb/apis/public/api.py +122 -62
- wandb/apis/public/artifacts.py +8 -3
- wandb/apis/public/files.py +17 -2
- wandb/apis/public/jobs.py +2 -2
- wandb/apis/public/query_generator.py +1 -1
- wandb/apis/public/runs.py +8 -8
- wandb/apis/public/teams.py +3 -3
- wandb/apis/public/users.py +1 -1
- wandb/apis/public/utils.py +68 -0
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +12 -3
- wandb/data_types.py +1 -1
- wandb/docker/__init__.py +2 -1
- wandb/docker/auth.py +2 -3
- wandb/errors/links.py +73 -0
- wandb/errors/term.py +7 -6
- wandb/filesync/step_prepare.py +1 -1
- wandb/filesync/upload_job.py +1 -1
- wandb/integration/catboost/catboost.py +2 -2
- wandb/integration/diffusers/pipeline_resolver.py +1 -1
- wandb/integration/diffusers/resolvers/multimodal.py +6 -6
- wandb/integration/diffusers/resolvers/utils.py +1 -1
- wandb/integration/fastai/__init__.py +3 -2
- wandb/integration/keras/callbacks/metrics_logger.py +1 -1
- wandb/integration/keras/callbacks/model_checkpoint.py +1 -1
- wandb/integration/keras/keras.py +1 -1
- wandb/integration/kfp/kfp_patch.py +1 -1
- wandb/integration/lightgbm/__init__.py +2 -2
- wandb/integration/magic.py +2 -2
- wandb/integration/metaflow/metaflow.py +1 -1
- wandb/integration/sacred/__init__.py +1 -1
- wandb/integration/sagemaker/auth.py +1 -1
- wandb/integration/sklearn/plot/classifier.py +7 -7
- wandb/integration/sklearn/plot/clusterer.py +3 -3
- wandb/integration/sklearn/plot/regressor.py +3 -3
- wandb/integration/sklearn/plot/shared.py +2 -2
- wandb/integration/tensorboard/log.py +2 -2
- wandb/integration/ultralytics/callback.py +2 -2
- wandb/integration/xgboost/xgboost.py +1 -1
- wandb/jupyter.py +0 -1
- wandb/plot/__init__.py +17 -8
- wandb/plot/bar.py +53 -27
- wandb/plot/confusion_matrix.py +151 -70
- wandb/plot/custom_chart.py +124 -0
- wandb/plot/histogram.py +46 -20
- wandb/plot/line.py +57 -26
- wandb/plot/line_series.py +148 -60
- wandb/plot/pr_curve.py +89 -44
- wandb/plot/roc_curve.py +82 -37
- wandb/plot/scatter.py +53 -20
- wandb/plot/viz.py +20 -102
- wandb/sdk/artifacts/artifact.py +280 -328
- wandb/sdk/artifacts/artifact_manifest.py +10 -9
- wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +9 -4
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +1 -3
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +2 -2
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
- wandb/sdk/backend/backend.py +0 -1
- wandb/sdk/data_types/audio.py +1 -1
- wandb/sdk/data_types/base_types/media.py +66 -5
- wandb/sdk/data_types/bokeh.py +1 -1
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -1
- wandb/sdk/data_types/helper_types/image_mask.py +2 -2
- wandb/sdk/data_types/histogram.py +1 -1
- wandb/sdk/data_types/html.py +1 -1
- wandb/sdk/data_types/image.py +1 -1
- wandb/sdk/data_types/molecule.py +3 -3
- wandb/sdk/data_types/object_3d.py +4 -4
- wandb/sdk/data_types/plotly.py +1 -1
- wandb/sdk/data_types/saved_model.py +0 -1
- wandb/sdk/data_types/table.py +7 -7
- wandb/sdk/data_types/trace_tree.py +1 -1
- wandb/sdk/data_types/video.py +4 -3
- wandb/sdk/interface/router.py +0 -2
- wandb/sdk/internal/datastore.py +1 -1
- wandb/sdk/internal/file_pusher.py +1 -1
- wandb/sdk/internal/file_stream.py +4 -4
- wandb/sdk/internal/handler.py +3 -2
- wandb/sdk/internal/internal.py +1 -1
- wandb/sdk/internal/internal_api.py +178 -63
- wandb/sdk/internal/job_builder.py +4 -3
- wandb/sdk/internal/system/assets/__init__.py +0 -2
- wandb/sdk/internal/tb_watcher.py +11 -10
- wandb/sdk/launch/_launch.py +4 -3
- wandb/sdk/launch/_launch_add.py +2 -2
- wandb/sdk/launch/builder/kaniko_builder.py +0 -1
- wandb/sdk/launch/create_job.py +1 -0
- wandb/sdk/launch/environment/local_environment.py +0 -1
- wandb/sdk/launch/errors.py +0 -6
- wandb/sdk/launch/registry/local_registry.py +0 -2
- wandb/sdk/launch/runner/abstract.py +0 -5
- wandb/sdk/launch/sweeps/__init__.py +0 -2
- wandb/sdk/launch/sweeps/scheduler.py +0 -2
- wandb/sdk/launch/sweeps/scheduler_sweep.py +0 -1
- wandb/sdk/lib/apikey.py +3 -3
- wandb/sdk/lib/file_stream_utils.py +1 -1
- wandb/sdk/lib/filesystem.py +1 -1
- wandb/sdk/lib/ipython.py +16 -9
- wandb/sdk/lib/mailbox.py +0 -4
- wandb/sdk/lib/printer.py +44 -8
- wandb/sdk/lib/retry.py +1 -1
- wandb/sdk/service/service.py +3 -3
- wandb/sdk/service/streams.py +2 -4
- wandb/sdk/wandb_init.py +20 -20
- wandb/sdk/wandb_login.py +1 -1
- wandb/sdk/wandb_require.py +1 -4
- wandb/sdk/wandb_run.py +57 -69
- wandb/sdk/wandb_settings.py +3 -4
- wandb/sdk/wandb_sync.py +2 -1
- wandb/util.py +46 -18
- wandb/wandb_agent.py +3 -3
- wandb/wandb_controller.py +2 -2
- {wandb-0.18.5.dist-info → wandb-0.18.6.dist-info}/METADATA +1 -1
- {wandb-0.18.5.dist-info → wandb-0.18.6.dist-info}/RECORD +125 -126
- wandb/sdk/internal/system/assets/gpu_apple.py +0 -177
- wandb/sdk/lib/_wburls_generate.py +0 -25
- wandb/sdk/lib/_wburls_generated.py +0 -22
- wandb/sdk/lib/wburls.py +0 -46
- {wandb-0.18.5.dist-info → wandb-0.18.6.dist-info}/WHEEL +0 -0
- {wandb-0.18.5.dist-info → wandb-0.18.6.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.5.dist-info → wandb-0.18.6.dist-info}/licenses/LICENSE +0 -0
wandb/plot/roc_curve.py
CHANGED
@@ -1,40 +1,84 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import numbers
|
4
|
+
from typing import TYPE_CHECKING, Sequence
|
2
5
|
|
3
6
|
import wandb
|
4
7
|
from wandb import util
|
8
|
+
from wandb.plot.custom_chart import plot_table
|
9
|
+
from wandb.plot.utils import test_missing, test_types
|
5
10
|
|
6
|
-
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from wandb.plot.custom_chart import CustomChart
|
7
13
|
|
8
14
|
|
9
15
|
def roc_curve(
|
10
|
-
y_true
|
11
|
-
y_probas=None,
|
12
|
-
labels=None,
|
13
|
-
classes_to_plot=None,
|
14
|
-
title=
|
15
|
-
split_table:
|
16
|
-
):
|
17
|
-
"""
|
18
|
-
|
19
|
-
|
20
|
-
y_true (
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
labels (list):
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
16
|
+
y_true: Sequence[numbers.Number],
|
17
|
+
y_probas: Sequence[Sequence[float]] | None = None,
|
18
|
+
labels: list[str] | None = None,
|
19
|
+
classes_to_plot: list[numbers.Number] | None = None,
|
20
|
+
title: str = "ROC Curve",
|
21
|
+
split_table: bool = False,
|
22
|
+
) -> CustomChart:
|
23
|
+
"""Constructs Receiver Operating Characteristic (ROC) curve chart.
|
24
|
+
|
25
|
+
Args:
|
26
|
+
y_true (Sequence[numbers.Number]): The true class labels (ground truth)
|
27
|
+
for the target variable. Shape should be (num_samples,).
|
28
|
+
y_probas (Sequence[Sequence[float]]): The predicted probabilities or
|
29
|
+
decision scores for each class. Shape should be (num_samples, num_classes).
|
30
|
+
labels (list[str]): Human-readable labels corresponding to the class
|
31
|
+
indices in `y_true`. For example, if `labels=['dog', 'cat']`,
|
32
|
+
class 0 will be displayed as 'dog' and class 1 as 'cat' in the plot.
|
33
|
+
If None, the raw class indices from `y_true` will be used.
|
34
|
+
Default is None.
|
35
|
+
classes_to_plot (list[numbers.Number]): A subset of unique class labels
|
36
|
+
to include in the ROC curve. If None, all classes in `y_true` will
|
37
|
+
be plotted. Default is None.
|
38
|
+
title (str): Title of the ROC curve plot. Default is "ROC Curve".
|
39
|
+
split_table (bool): Whether the table should be split into a separate
|
40
|
+
section in the W&B UI. If `True`, the table will be displayed in a
|
41
|
+
section named "Custom Chart Tables". Default is `False`.
|
30
42
|
|
31
43
|
Returns:
|
32
|
-
|
33
|
-
|
44
|
+
CustomChart: A custom chart object that can be logged to W&B. To log the
|
45
|
+
chart, pass it to `wandb.log()`.
|
46
|
+
|
47
|
+
Raises:
|
48
|
+
wandb.Error: If numpy, pandas, or scikit-learn are not found.
|
34
49
|
|
35
50
|
Example:
|
36
51
|
```
|
37
|
-
|
52
|
+
import numpy as np
|
53
|
+
import wandb
|
54
|
+
|
55
|
+
# Simulate a medical diagnosis classification problem with three diseases
|
56
|
+
n_samples = 200
|
57
|
+
n_classes = 3
|
58
|
+
|
59
|
+
# True labels: assign "Diabetes", "Hypertension", or "Heart Disease" to
|
60
|
+
# each sample
|
61
|
+
disease_labels = ["Diabetes", "Hypertension", "Heart Disease"]
|
62
|
+
# 0: Diabetes, 1: Hypertension, 2: Heart Disease
|
63
|
+
y_true = np.random.choice([0, 1, 2], size=n_samples)
|
64
|
+
|
65
|
+
# Predicted probabilities: simulate predictions, ensuring they sum to 1
|
66
|
+
# for each sample
|
67
|
+
y_probas = np.random.dirichlet(np.ones(n_classes), size=n_samples)
|
68
|
+
|
69
|
+
# Specify classes to plot (plotting all three diseases)
|
70
|
+
classes_to_plot = [0, 1, 2]
|
71
|
+
|
72
|
+
# Initialize a W&B run and log a ROC curve plot for disease classification
|
73
|
+
with wandb.init(project="medical_diagnosis") as run:
|
74
|
+
roc_plot = wandb.plot.roc_curve(
|
75
|
+
y_true=y_true,
|
76
|
+
y_probas=y_probas,
|
77
|
+
labels=disease_labels,
|
78
|
+
classes_to_plot=classes_to_plot,
|
79
|
+
title="ROC Curve for Disease Classification",
|
80
|
+
)
|
81
|
+
run.log({"roc-curve": roc_plot})
|
38
82
|
```
|
39
83
|
"""
|
40
84
|
np = util.get_module(
|
@@ -66,8 +110,8 @@ def roc_curve(
|
|
66
110
|
if classes_to_plot is None:
|
67
111
|
classes_to_plot = classes
|
68
112
|
|
69
|
-
fpr =
|
70
|
-
tpr =
|
113
|
+
fpr = {}
|
114
|
+
tpr = {}
|
71
115
|
indices_to_plot = np.where(np.isin(classes, classes_to_plot))[0]
|
72
116
|
for i in indices_to_plot:
|
73
117
|
if labels is not None and (
|
@@ -87,12 +131,11 @@ def roc_curve(
|
|
87
131
|
"fpr": np.hstack(list(fpr.values())),
|
88
132
|
"tpr": np.hstack(list(tpr.values())),
|
89
133
|
}
|
90
|
-
)
|
91
|
-
df = df.round(3)
|
134
|
+
).round(3)
|
92
135
|
|
93
136
|
if len(df) > wandb.Table.MAX_ROWS:
|
94
137
|
wandb.termwarn(
|
95
|
-
"wandb uses only
|
138
|
+
f"wandb uses only {wandb.Table.MAX_ROWS} data points to create the plots."
|
96
139
|
)
|
97
140
|
# different sampling could be applied, possibly to ensure endpoints are kept
|
98
141
|
df = sklearn_utils.resample(
|
@@ -103,13 +146,15 @@ def roc_curve(
|
|
103
146
|
stratify=df["class"],
|
104
147
|
).sort_values(["fpr", "tpr", "class"])
|
105
148
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
149
|
+
return plot_table(
|
150
|
+
data_table=wandb.Table(dataframe=df),
|
151
|
+
vega_spec_name="wandb/area-under-curve/v0",
|
152
|
+
fields={
|
153
|
+
"x": "fpr",
|
154
|
+
"y": "tpr",
|
155
|
+
"class": "class",
|
156
|
+
},
|
157
|
+
string_fields={
|
113
158
|
"title": title,
|
114
159
|
"x-axis-title": "False positive rate",
|
115
160
|
"y-axis-title": "True positive rate",
|
wandb/plot/scatter.py
CHANGED
@@ -1,32 +1,65 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
2
|
|
3
|
-
import
|
3
|
+
from typing import TYPE_CHECKING
|
4
4
|
|
5
|
+
from wandb.plot.custom_chart import plot_table
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
if TYPE_CHECKING:
|
8
|
+
import wandb
|
9
|
+
from wandb.plot.custom_chart import CustomChart
|
8
10
|
|
9
|
-
Arguments:
|
10
|
-
table (wandb.Table): Table of data.
|
11
|
-
x (string): Name of column to as for x-axis values.
|
12
|
-
y (string): Name of column to as for y-axis values.
|
13
|
-
title (string): Plot title.
|
14
|
-
split_table (bool): If True, adds "Custom Chart Tables/" to the key of the table so that it's logged in a different section.
|
15
11
|
|
16
|
-
|
17
|
-
|
12
|
+
def scatter(
|
13
|
+
table: wandb.Table,
|
14
|
+
x: str,
|
15
|
+
y: str,
|
16
|
+
title: str = "",
|
17
|
+
split_table: bool = False,
|
18
|
+
) -> CustomChart:
|
19
|
+
"""Constructs a scatter plot from a wandb.Table of data.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
table (wandb.Table): The W&B Table containing the data to visualize.
|
23
|
+
x (str): The name of the column used for the x-axis.
|
24
|
+
y (str): The name of the column used for the y-axis.
|
25
|
+
title (str): The title of the scatter chart.
|
26
|
+
split_table (bool): Whether the table should be split into a separate section
|
27
|
+
in the W&B UI. If `True`, the table will be displayed in a section named
|
28
|
+
"Custom Chart Tables". Default is `False`.
|
18
29
|
|
30
|
+
Returns:
|
31
|
+
CustomChart: A custom chart object that can be logged to W&B. To log the
|
32
|
+
chart, pass it to `wandb.log()`.
|
19
33
|
Example:
|
20
34
|
```
|
21
|
-
|
22
|
-
|
23
|
-
|
35
|
+
import math
|
36
|
+
import random
|
37
|
+
import wandb
|
38
|
+
|
39
|
+
# Simulate temperature variations at different altitudes over time
|
40
|
+
data = [
|
41
|
+
[i, random.uniform(-10, 20) - 0.005 * i + 5 * math.sin(i / 50)] for i in range(300)
|
42
|
+
]
|
43
|
+
|
44
|
+
# Create W&B table with altitude (m) and temperature (°C) columns
|
45
|
+
table = wandb.Table(data=data, columns=["altitude (m)", "temperature (°C)"])
|
46
|
+
|
47
|
+
# Initialize W&B run and log the scatter plot
|
48
|
+
with wandb.init(project="temperature-altitude-scatter") as run:
|
49
|
+
# Create and log the scatter plot
|
50
|
+
scatter_plot = wandb.plot.scatter(
|
51
|
+
table=table,
|
52
|
+
x="altitude (m)",
|
53
|
+
y="temperature (°C)",
|
54
|
+
title="Altitude vs Temperature",
|
55
|
+
)
|
56
|
+
run.log({"altitude-temperature-scatter": scatter_plot})
|
24
57
|
```
|
25
58
|
"""
|
26
|
-
return
|
27
|
-
|
28
|
-
|
29
|
-
{"x": x, "y": y},
|
30
|
-
{"title": title},
|
59
|
+
return plot_table(
|
60
|
+
data_table=table,
|
61
|
+
vega_spec_name="wandb/scatter/v0",
|
62
|
+
fields={"x": x, "y": y},
|
63
|
+
string_fields={"title": title},
|
31
64
|
split_table=split_table,
|
32
65
|
)
|
wandb/plot/viz.py
CHANGED
@@ -1,118 +1,36 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dataclasses import dataclass
|
4
|
+
from typing import Any
|
2
5
|
|
3
6
|
from wandb.data_types import Table
|
4
7
|
from wandb.errors import Error
|
5
8
|
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def get_config_value(self, key: str) -> Dict[str, Any]:
|
13
|
-
return {
|
14
|
-
"id": self._id,
|
15
|
-
"historyFieldSettings": {"x-axis": "_step", "key": key},
|
16
|
-
}
|
17
|
-
|
18
|
-
@staticmethod
|
19
|
-
def get_config_key(key: str) -> Tuple[str, str, str]:
|
20
|
-
return "_wandb", "viz", key
|
10
|
+
@dataclass
|
11
|
+
class VisualizeSpec:
|
12
|
+
name: str
|
13
|
+
key: str = ""
|
21
14
|
|
22
15
|
@property
|
23
|
-
def
|
24
|
-
return self._data
|
25
|
-
|
26
|
-
|
27
|
-
class CustomChart:
|
28
|
-
def __init__(
|
29
|
-
self,
|
30
|
-
id: str,
|
31
|
-
data: Table,
|
32
|
-
fields: Dict[str, Any],
|
33
|
-
string_fields: Dict[str, Any],
|
34
|
-
split_table: Optional[bool] = False,
|
35
|
-
) -> None:
|
36
|
-
self._id = id
|
37
|
-
self._data = data
|
38
|
-
self._fields = fields
|
39
|
-
self._string_fields = string_fields
|
40
|
-
self._split_table = split_table
|
41
|
-
|
42
|
-
def get_config_value(
|
43
|
-
self,
|
44
|
-
panel_type: str,
|
45
|
-
query: Dict[str, Any],
|
46
|
-
) -> Dict[str, Any]:
|
16
|
+
def config_value(self) -> dict[str, Any]:
|
47
17
|
return {
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"panelDefId": self._id,
|
51
|
-
"fieldSettings": self._fields,
|
52
|
-
"stringSettings": self._string_fields,
|
53
|
-
"transform": {"name": "tableWithLeafColNames"},
|
54
|
-
"userQuery": query,
|
55
|
-
},
|
56
|
-
}
|
57
|
-
|
58
|
-
@staticmethod
|
59
|
-
def get_config_key(key: str) -> Tuple[str, str, str]:
|
60
|
-
return "_wandb", "visualize", key
|
61
|
-
|
62
|
-
@staticmethod
|
63
|
-
def user_query(table_key: str) -> Dict[str, Any]:
|
64
|
-
return {
|
65
|
-
"queryFields": [
|
66
|
-
{
|
67
|
-
"name": "runSets",
|
68
|
-
"args": [{"name": "runSets", "value": "${runSets}"}],
|
69
|
-
"fields": [
|
70
|
-
{"name": "id", "fields": []},
|
71
|
-
{"name": "name", "fields": []},
|
72
|
-
{"name": "_defaultColorIndex", "fields": []},
|
73
|
-
{
|
74
|
-
"name": "summaryTable",
|
75
|
-
"args": [{"name": "tableKey", "value": table_key}],
|
76
|
-
"fields": [],
|
77
|
-
},
|
78
|
-
],
|
79
|
-
}
|
80
|
-
],
|
18
|
+
"id": self.name,
|
19
|
+
"historyFieldSettings": {"x-axis": "_step", "key": self.key},
|
81
20
|
}
|
82
21
|
|
83
22
|
@property
|
84
|
-
def
|
85
|
-
return self.
|
23
|
+
def config_key(self) -> tuple[str, str, str]:
|
24
|
+
return ("_wandb", "viz", self.key)
|
86
25
|
|
87
|
-
@property
|
88
|
-
def fields(self) -> Dict[str, Any]:
|
89
|
-
return self._fields
|
90
|
-
|
91
|
-
@property
|
92
|
-
def string_fields(self) -> Dict[str, Any]:
|
93
|
-
return self._string_fields
|
94
26
|
|
27
|
+
@dataclass
|
28
|
+
class Visualize:
|
29
|
+
table: Table
|
30
|
+
spec: VisualizeSpec
|
95
31
|
|
96
|
-
def
|
97
|
-
|
98
|
-
data_table: Table,
|
99
|
-
fields: Dict[str, Any],
|
100
|
-
string_fields: Optional[Dict[str, Any]] = None,
|
101
|
-
split_table: Optional[bool] = False,
|
102
|
-
) -> CustomChart:
|
103
|
-
if string_fields is None:
|
104
|
-
string_fields = {}
|
105
|
-
if not isinstance(data_table, Table):
|
106
|
-
raise Error(
|
107
|
-
f"Expected `data_table` to be `wandb.Table` type, instead got {type(data_table).__name__}"
|
108
|
-
)
|
109
|
-
return CustomChart(
|
110
|
-
id=vega_spec_name,
|
111
|
-
data=data_table,
|
112
|
-
fields=fields,
|
113
|
-
string_fields=string_fields,
|
114
|
-
split_table=split_table,
|
115
|
-
)
|
32
|
+
def set_key(self, key: str) -> None:
|
33
|
+
self.spec.key = key
|
116
34
|
|
117
35
|
|
118
36
|
def visualize(id: str, value: Table) -> Visualize:
|
@@ -120,4 +38,4 @@ def visualize(id: str, value: Table) -> Visualize:
|
|
120
38
|
raise Error(
|
121
39
|
f"Expected `value` to be `wandb.Table` type, instead got {type(value).__name__}"
|
122
40
|
)
|
123
|
-
return Visualize(
|
41
|
+
return Visualize(table=value, spec=VisualizeSpec(name=id))
|