wandb 0.20.2rc20250616__py3-none-win32.whl → 0.21.1__py3-none-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. wandb/__init__.py +16 -14
  2. wandb/__init__.pyi +450 -472
  3. wandb/agents/pyagent.py +41 -12
  4. wandb/analytics/sentry.py +7 -2
  5. wandb/apis/importers/mlflow.py +1 -1
  6. wandb/apis/internal.py +3 -0
  7. wandb/apis/paginator.py +17 -4
  8. wandb/apis/public/__init__.py +1 -1
  9. wandb/apis/public/api.py +606 -359
  10. wandb/apis/public/artifacts.py +214 -16
  11. wandb/apis/public/automations.py +19 -3
  12. wandb/apis/public/files.py +177 -38
  13. wandb/apis/public/history.py +67 -15
  14. wandb/apis/public/integrations.py +25 -2
  15. wandb/apis/public/jobs.py +90 -2
  16. wandb/apis/public/projects.py +161 -69
  17. wandb/apis/public/query_generator.py +11 -1
  18. wandb/apis/public/registries/registries_search.py +7 -15
  19. wandb/apis/public/reports.py +147 -13
  20. wandb/apis/public/runs.py +315 -128
  21. wandb/apis/public/sweeps.py +222 -22
  22. wandb/apis/public/teams.py +41 -4
  23. wandb/apis/public/users.py +45 -4
  24. wandb/automations/__init__.py +10 -10
  25. wandb/automations/_filters/run_metrics.py +0 -2
  26. wandb/automations/_utils.py +0 -2
  27. wandb/automations/actions.py +0 -2
  28. wandb/automations/automations.py +0 -2
  29. wandb/automations/events.py +0 -2
  30. wandb/beta/workflows.py +66 -30
  31. wandb/bin/gpu_stats.exe +0 -0
  32. wandb/bin/wandb-core +0 -0
  33. wandb/cli/cli.py +80 -1
  34. wandb/env.py +8 -0
  35. wandb/errors/errors.py +4 -1
  36. wandb/integration/catboost/catboost.py +6 -2
  37. wandb/integration/kfp/kfp_patch.py +3 -1
  38. wandb/integration/lightning/fabric/logger.py +3 -4
  39. wandb/integration/metaflow/__init__.py +6 -0
  40. wandb/integration/metaflow/data_pandas.py +74 -0
  41. wandb/integration/metaflow/errors.py +13 -0
  42. wandb/integration/metaflow/metaflow.py +205 -190
  43. wandb/integration/openai/fine_tuning.py +1 -2
  44. wandb/integration/sb3/sb3.py +3 -3
  45. wandb/integration/ultralytics/callback.py +6 -2
  46. wandb/jupyter.py +5 -5
  47. wandb/plot/__init__.py +2 -0
  48. wandb/plot/bar.py +30 -29
  49. wandb/plot/confusion_matrix.py +75 -71
  50. wandb/plot/custom_chart.py +30 -7
  51. wandb/plot/histogram.py +26 -25
  52. wandb/plot/line.py +33 -32
  53. wandb/plot/line_series.py +100 -103
  54. wandb/plot/pr_curve.py +33 -32
  55. wandb/plot/roc_curve.py +38 -38
  56. wandb/plot/scatter.py +27 -27
  57. wandb/proto/v3/wandb_internal_pb2.py +366 -385
  58. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  59. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  60. wandb/proto/v4/wandb_internal_pb2.py +352 -356
  61. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  62. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  63. wandb/proto/v5/wandb_internal_pb2.py +352 -356
  64. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  65. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  66. wandb/proto/v6/wandb_internal_pb2.py +352 -356
  67. wandb/proto/v6/wandb_settings_pb2.py +2 -2
  68. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  69. wandb/proto/wandb_deprecated.py +6 -0
  70. wandb/sdk/artifacts/_generated/__init__.py +12 -1
  71. wandb/sdk/artifacts/_generated/input_types.py +20 -2
  72. wandb/sdk/artifacts/_generated/link_artifact.py +21 -0
  73. wandb/sdk/artifacts/_generated/operations.py +9 -0
  74. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  75. wandb/sdk/artifacts/_validators.py +48 -2
  76. wandb/sdk/artifacts/artifact.py +269 -96
  77. wandb/sdk/data_types/audio.py +38 -10
  78. wandb/sdk/data_types/base_types/media.py +15 -63
  79. wandb/sdk/data_types/base_types/wb_value.py +6 -6
  80. wandb/sdk/data_types/graph.py +48 -14
  81. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  82. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  83. wandb/sdk/data_types/histogram.py +34 -21
  84. wandb/sdk/data_types/html.py +35 -12
  85. wandb/sdk/data_types/image.py +104 -68
  86. wandb/sdk/data_types/molecule.py +32 -19
  87. wandb/sdk/data_types/object_3d.py +36 -17
  88. wandb/sdk/data_types/plotly.py +18 -5
  89. wandb/sdk/data_types/saved_model.py +7 -9
  90. wandb/sdk/data_types/table.py +99 -70
  91. wandb/sdk/data_types/trace_tree.py +12 -12
  92. wandb/sdk/data_types/video.py +53 -26
  93. wandb/sdk/integration_utils/auto_logging.py +2 -2
  94. wandb/sdk/interface/interface.py +8 -19
  95. wandb/sdk/interface/interface_shared.py +7 -16
  96. wandb/sdk/internal/datastore.py +18 -18
  97. wandb/sdk/internal/handler.py +3 -5
  98. wandb/sdk/internal/internal_api.py +60 -0
  99. wandb/sdk/internal/job_builder.py +6 -0
  100. wandb/sdk/internal/sender.py +23 -3
  101. wandb/sdk/internal/sender_config.py +9 -0
  102. wandb/sdk/launch/_project_spec.py +3 -3
  103. wandb/sdk/launch/agent/agent.py +11 -4
  104. wandb/sdk/launch/agent/job_status_tracker.py +3 -1
  105. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  106. wandb/sdk/launch/create_job.py +3 -1
  107. wandb/sdk/launch/inputs/internal.py +3 -4
  108. wandb/sdk/launch/inputs/schema.py +1 -0
  109. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  110. wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
  111. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  112. wandb/sdk/launch/utils.py +3 -3
  113. wandb/sdk/lib/asyncio_compat.py +3 -0
  114. wandb/sdk/lib/console_capture.py +66 -19
  115. wandb/sdk/lib/deprecate.py +1 -7
  116. wandb/sdk/lib/disabled.py +1 -1
  117. wandb/sdk/lib/hashutil.py +14 -1
  118. wandb/sdk/lib/module.py +7 -13
  119. wandb/sdk/lib/progress.py +0 -19
  120. wandb/sdk/lib/sock_client.py +0 -4
  121. wandb/sdk/wandb_init.py +67 -93
  122. wandb/sdk/wandb_login.py +18 -14
  123. wandb/sdk/wandb_metric.py +2 -0
  124. wandb/sdk/wandb_require.py +0 -1
  125. wandb/sdk/wandb_run.py +429 -527
  126. wandb/sdk/wandb_settings.py +364 -74
  127. wandb/sdk/wandb_setup.py +28 -28
  128. wandb/sdk/wandb_sweep.py +14 -13
  129. wandb/sdk/wandb_watch.py +4 -6
  130. wandb/sync/sync.py +10 -0
  131. wandb/util.py +57 -0
  132. wandb/wandb_run.py +1 -2
  133. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
  134. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/RECORD +137 -137
  135. wandb/sdk/wandb_metadata.py +0 -623
  136. wandb/vendor/pynvml/__init__.py +0 -0
  137. wandb/vendor/pynvml/pynvml.py +0 -4779
  138. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
  139. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
  140. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
@@ -23,16 +23,16 @@ def confusion_matrix(
23
23
  """Constructs a confusion matrix from a sequence of probabilities or predictions.
24
24
 
25
25
  Args:
26
- probs (Sequence[Sequence[float]] | None): A sequence of predicted probabilities for each
26
+ probs: A sequence of predicted probabilities for each
27
27
  class. The sequence shape should be (N, K) where N is the number of samples
28
28
  and K is the number of classes. If provided, `preds` should not be provided.
29
- y_true (Sequence[T] | None): A sequence of true labels.
30
- preds (Sequence[T] | None): A sequence of predicted class labels. If provided,
29
+ y_true: A sequence of true labels.
30
+ preds: A sequence of predicted class labels. If provided,
31
31
  `probs` should not be provided.
32
- class_names (Sequence[str] | None): Sequence of class names. If not
32
+ class_names: Sequence of class names. If not
33
33
  provided, class names will be defined as "Class_1", "Class_2", etc.
34
- title (str): Title of the confusion matrix chart.
35
- split_table (bool): Whether the table should be split into a separate section
34
+ title: Title of the confusion matrix chart.
35
+ split_table: Whether the table should be split into a separate section
36
36
  in the W&B UI. If `True`, the table will be displayed in a section named
37
37
  "Custom Chart Tables". Default is `False`.
38
38
 
@@ -48,75 +48,79 @@ def confusion_matrix(
48
48
  wandb.Error: If numpy is not installed.
49
49
 
50
50
  Examples:
51
- 1. Logging a confusion matrix with random probabilities for wildlife
52
- classification:
53
- ```
54
- import numpy as np
55
- import wandb
56
-
57
- # Define class names for wildlife
58
- wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
59
-
60
- # Generate random true labels (0 to 3 for 10 samples)
61
- wildlife_y_true = np.random.randint(0, 4, size=10)
62
-
63
- # Generate random probabilities for each class (10 samples x 4 classes)
64
- wildlife_probs = np.random.rand(10, 4)
65
- wildlife_probs = np.exp(wildlife_probs) / np.sum(
66
- np.exp(wildlife_probs),
67
- axis=1,
68
- keepdims=True,
51
+ Logging a confusion matrix with random probabilities for wildlife
52
+ classification:
53
+
54
+ ```python
55
+ import numpy as np
56
+ import wandb
57
+
58
+ # Define class names for wildlife
59
+ wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
60
+
61
+ # Generate random true labels (0 to 3 for 10 samples)
62
+ wildlife_y_true = np.random.randint(0, 4, size=10)
63
+
64
+ # Generate random probabilities for each class (10 samples x 4 classes)
65
+ wildlife_probs = np.random.rand(10, 4)
66
+ wildlife_probs = np.exp(wildlife_probs) / np.sum(
67
+ np.exp(wildlife_probs),
68
+ axis=1,
69
+ keepdims=True,
70
+ )
71
+
72
+ # Initialize W&B run and log confusion matrix
73
+ with wandb.init(project="wildlife_classification") as run:
74
+ confusion_matrix = wandb.plot.confusion_matrix(
75
+ probs=wildlife_probs,
76
+ y_true=wildlife_y_true,
77
+ class_names=wildlife_class_names,
78
+ title="Wildlife Classification Confusion Matrix",
69
79
  )
80
+ run.log({"wildlife_confusion_matrix": confusion_matrix})
81
+ ```
82
+
83
+ In this example, random probabilities are used to generate a confusion
84
+ matrix.
85
+
86
+ Logging a confusion matrix with simulated model predictions and 85%
87
+ accuracy:
70
88
 
71
- # Initialize W&B run and log confusion matrix
72
- with wandb.init(project="wildlife_classification") as run:
73
- confusion_matrix = wandb.plot.confusion_matrix(
74
- probs=wildlife_probs,
75
- y_true=wildlife_y_true,
76
- class_names=wildlife_class_names,
77
- title="Wildlife Classification Confusion Matrix",
78
- )
79
- run.log({"wildlife_confusion_matrix": confusion_matrix})
80
- ```
81
- In this example, random probabilities are used to generate a confusion
82
- matrix.
83
-
84
- 2. Logging a confusion matrix with simulated model predictions and 85%
85
- accuracy:
86
- ```
87
- import numpy as np
88
- import wandb
89
-
90
- # Define class names for wildlife
91
- wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
92
-
93
- # Simulate true labels for 200 animal images (imbalanced distribution)
94
- wildlife_y_true = np.random.choice(
95
- [0, 1, 2, 3],
96
- size=200,
97
- p=[0.2, 0.3, 0.25, 0.25],
89
+ ```python
90
+ import numpy as np
91
+ import wandb
92
+
93
+ # Define class names for wildlife
94
+ wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"]
95
+
96
+ # Simulate true labels for 200 animal images (imbalanced distribution)
97
+ wildlife_y_true = np.random.choice(
98
+ [0, 1, 2, 3],
99
+ size=200,
100
+ p=[0.2, 0.3, 0.25, 0.25],
101
+ )
102
+
103
+ # Simulate model predictions with 85% accuracy
104
+ wildlife_preds = [
105
+ y_t
106
+ if np.random.rand() < 0.85
107
+ else np.random.choice([x for x in range(4) if x != y_t])
108
+ for y_t in wildlife_y_true
109
+ ]
110
+
111
+ # Initialize W&B run and log confusion matrix
112
+ with wandb.init(project="wildlife_classification") as run:
113
+ confusion_matrix = wandb.plot.confusion_matrix(
114
+ preds=wildlife_preds,
115
+ y_true=wildlife_y_true,
116
+ class_names=wildlife_class_names,
117
+ title="Simulated Wildlife Classification Confusion Matrix",
98
118
  )
119
+ run.log({"wildlife_confusion_matrix": confusion_matrix})
120
+ ```
99
121
 
100
- # Simulate model predictions with 85% accuracy
101
- wildlife_preds = [
102
- y_t
103
- if np.random.rand() < 0.85
104
- else np.random.choice([x for x in range(4) if x != y_t])
105
- for y_t in wildlife_y_true
106
- ]
107
-
108
- # Initialize W&B run and log confusion matrix
109
- with wandb.init(project="wildlife_classification") as run:
110
- confusion_matrix = wandb.plot.confusion_matrix(
111
- preds=wildlife_preds,
112
- y_true=wildlife_y_true,
113
- class_names=wildlife_class_names,
114
- title="Simulated Wildlife Classification Confusion Matrix"
115
- )
116
- run.log({"wildlife_confusion_matrix": confusion_matrix})
117
- ```
118
- In this example, predictions are simulated with 85% accuracy to generate a
119
- confusion matrix.
122
+ In this example, predictions are simulated with 85% accuracy to generate a
123
+ confusion matrix.
120
124
  """
121
125
  np = util.get_module(
122
126
  "numpy",
@@ -85,27 +85,50 @@ def plot_table(
85
85
  This function creates a custom chart based on a Vega-Lite specification and
86
86
  a data table represented by a `wandb.Table` object. The specification needs
87
87
  to be predefined and stored in the W&B backend. The function returns a custom
88
- chart object that can be logged to W&B using `wandb.log()`.
88
+ chart object that can be logged to W&B using `wandb.Run.log()`.
89
89
 
90
90
  Args:
91
- vega_spec_name (str): The name or identifier of the Vega-Lite spec
91
+ vega_spec_name: The name or identifier of the Vega-Lite spec
92
92
  that defines the visualization structure.
93
- data_table (wandb.Table): A `wandb.Table` object containing the data to be
93
+ data_table: A `wandb.Table` object containing the data to be
94
94
  visualized.
95
- fields (dict[str, Any]): A mapping between the fields in the Vega-Lite spec and the
95
+ fields: A mapping between the fields in the Vega-Lite spec and the
96
96
  corresponding columns in the data table to be visualized.
97
- string_fields (dict[str, Any] | None): A dictionary for providing values for any string constants
97
+ string_fields: A dictionary for providing values for any string constants
98
98
  required by the custom visualization.
99
- split_table (bool): Whether the table should be split into a separate section
99
+ split_table: Whether the table should be split into a separate section
100
100
  in the W&B UI. If `True`, the table will be displayed in a section named
101
101
  "Custom Chart Tables". Default is `False`.
102
102
 
103
103
  Returns:
104
104
  CustomChart: A custom chart object that can be logged to W&B. To log the
105
- chart, pass it to `wandb.log()`.
105
+ chart, pass the chart object as argument to `wandb.Run.log()`.
106
106
 
107
107
  Raises:
108
108
  wandb.Error: If `data_table` is not a `wandb.Table` object.
109
+
110
+ Example:
111
+ ```python
112
+ # Create a custom chart using a Vega-Lite spec and the data table.
113
+ import wandb
114
+
115
+ data = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]
116
+ table = wandb.Table(data=data, columns=["x", "y"])
117
+ fields = {"x": "x", "y": "y", "title": "MY TITLE"}
118
+
119
+ with wandb.init() as run:
120
+ # Training code goes here
121
+
122
+ # Create a custom title with `string_fields`.
123
+ my_custom_chart = wandb.plot_table(
124
+ vega_spec_name="wandb/line/v0",
125
+ data_table=table,
126
+ fields=fields,
127
+ string_fields={"title": "Title"},
128
+ )
129
+
130
+ run.log({"custom_chart": my_custom_chart})
131
+ ```
109
132
  """
110
133
 
111
134
  if not isinstance(data_table, wandb.Table):
wandb/plot/histogram.py CHANGED
@@ -18,10 +18,10 @@ def histogram(
18
18
  """Constructs a histogram chart from a W&B Table.
19
19
 
20
20
  Args:
21
- table (wandb.Table): The W&B Table containing the data for the histogram.
22
- value (str): The label for the bin axis (x-axis).
23
- title (str): The title of the histogram plot.
24
- split_table (bool): Whether the table should be split into a separate section
21
+ table: The W&B Table containing the data for the histogram.
22
+ value: The label for the bin axis (x-axis).
23
+ title: The title of the histogram plot.
24
+ split_table: Whether the table should be split into a separate section
25
25
  in the W&B UI. If `True`, the table will be displayed in a section named
26
26
  "Custom Chart Tables". Default is `False`.
27
27
 
@@ -30,31 +30,32 @@ def histogram(
30
30
  chart, pass it to `wandb.log()`.
31
31
 
32
32
  Example:
33
- ```
34
- import math
35
- import random
36
- import wandb
37
33
 
38
- # Generate random data
39
- data = [[i, random.random() + math.sin(i / 10)] for i in range(100)]
34
+ ```python
35
+ import math
36
+ import random
37
+ import wandb
38
+
39
+ # Generate random data
40
+ data = [[i, random.random() + math.sin(i / 10)] for i in range(100)]
40
41
 
41
- # Create a W&B Table
42
- table = wandb.Table(
43
- data=data,
44
- columns=["step", "height"],
45
- )
42
+ # Create a W&B Table
43
+ table = wandb.Table(
44
+ data=data,
45
+ columns=["step", "height"],
46
+ )
46
47
 
47
- # Create a histogram plot
48
- histogram = wandb.plot.histogram(
49
- table,
50
- value="height",
51
- title="My Histogram",
52
- )
48
+ # Create a histogram plot
49
+ histogram = wandb.plot.histogram(
50
+ table,
51
+ value="height",
52
+ title="My Histogram",
53
+ )
53
54
 
54
- # Log the histogram plot to W&B
55
- with wandb.init(...) as run:
56
- run.log({"histogram-plot1": histogram})
57
- ```
55
+ # Log the histogram plot to W&B
56
+ with wandb.init(...) as run:
57
+ run.log({"histogram-plot1": histogram})
58
+ ```
58
59
  """
59
60
  return plot_table(
60
61
  data_table=table,
wandb/plot/line.py CHANGED
@@ -20,13 +20,13 @@ def line(
20
20
  """Constructs a customizable line chart.
21
21
 
22
22
  Args:
23
- table (wandb.Table): The table containing data for the chart.
24
- x (str): Column name for the x-axis values.
25
- y (str): Column name for the y-axis values.
26
- stroke (str):Column name to differentiate line strokes (e.g., for
23
+ table: The table containing data for the chart.
24
+ x: Column name for the x-axis values.
25
+ y: Column name for the y-axis values.
26
+ stroke: Column name to differentiate line strokes (e.g., for
27
27
  grouping lines).
28
- title (str):Title of the chart.
29
- split_table (bool): Whether the table should be split into a separate section
28
+ title: Title of the chart.
29
+ split_table: Whether the table should be split into a separate section
30
30
  in the W&B UI. If `True`, the table will be displayed in a section named
31
31
  "Custom Chart Tables". Default is `False`.
32
32
 
@@ -35,35 +35,36 @@ def line(
35
35
  chart, pass it to `wandb.log()`.
36
36
 
37
37
  Example:
38
- ```python
39
- import math
40
- import random
41
- import wandb
42
38
 
43
- # Create multiple series of data with different patterns
44
- data = []
45
- for i in range(100):
46
- # Series 1: Sinusoidal pattern with random noise
47
- data.append([i, math.sin(i / 10) + random.uniform(-0.1, 0.1), "series_1"])
48
- # Series 2: Cosine pattern with random noise
49
- data.append([i, math.cos(i / 10) + random.uniform(-0.1, 0.1), "series_2"])
50
- # Series 3: Linear increase with random noise
51
- data.append([i, i / 10 + random.uniform(-0.5, 0.5), "series_3"])
39
+ ```python
40
+ import math
41
+ import random
42
+ import wandb
43
+
44
+ # Create multiple series of data with different patterns
45
+ data = []
46
+ for i in range(100):
47
+ # Series 1: Sinusoidal pattern with random noise
48
+ data.append([i, math.sin(i / 10) + random.uniform(-0.1, 0.1), "series_1"])
49
+ # Series 2: Cosine pattern with random noise
50
+ data.append([i, math.cos(i / 10) + random.uniform(-0.1, 0.1), "series_2"])
51
+ # Series 3: Linear increase with random noise
52
+ data.append([i, i / 10 + random.uniform(-0.5, 0.5), "series_3"])
52
53
 
53
- # Define the columns for the table
54
- table = wandb.Table(data=data, columns=["step", "value", "series"])
54
+ # Define the columns for the table
55
+ table = wandb.Table(data=data, columns=["step", "value", "series"])
55
56
 
56
- # Initialize wandb run and log the line chart
57
- with wandb.init(project="line_chart_example") as run:
58
- line_chart = wandb.plot.line(
59
- table=table,
60
- x="step",
61
- y="value",
62
- stroke="series", # Group by the "series" column
63
- title="Multi-Series Line Plot",
64
- )
65
- run.log({"line-chart": line_chart})
66
- ```
57
+ # Initialize wandb run and log the line chart
58
+ with wandb.init(project="line_chart_example") as run:
59
+ line_chart = wandb.plot.line(
60
+ table=table,
61
+ x="step",
62
+ y="value",
63
+ stroke="series", # Group by the "series" column
64
+ title="Multi-Series Line Plot",
65
+ )
66
+ run.log({"line-chart": line_chart})
67
+ ```
67
68
  """
68
69
  return plot_table(
69
70
  data_table=table,
wandb/plot/line_series.py CHANGED
@@ -20,18 +20,18 @@ def line_series(
20
20
  """Constructs a line series chart.
21
21
 
22
22
  Args:
23
- xs (Iterable[Iterable] | Iterable): Sequence of x values. If a singular
23
+ xs: Sequence of x values. If a singular
24
24
  array is provided, all y values are plotted against that x array. If
25
25
  an array of arrays is provided, each y value is plotted against the
26
26
  corresponding x array.
27
- ys (Iterable[Iterable]): Sequence of y values, where each iterable represents
27
+ ys: Sequence of y values, where each iterable represents
28
28
  a separate line series.
29
- keys (Iterable[str]): Sequence of keys for labeling each line series. If
29
+ keys: Sequence of keys for labeling each line series. If
30
30
  not provided, keys will be automatically generated as "line_1",
31
31
  "line_2", etc.
32
- title (str): Title of the chart.
33
- xname (str): Label for the x-axis.
34
- split_table (bool): Whether the table should be split into a separate section
32
+ title: Title of the chart.
33
+ xname: Label for the x-axis.
34
+ split_table: Whether the table should be split into a separate section
35
35
  in the W&B UI. If `True`, the table will be displayed in a section named
36
36
  "Custom Chart Tables". Default is `False`.
37
37
 
@@ -40,103 +40,100 @@ def line_series(
40
40
  chart, pass it to `wandb.log()`.
41
41
 
42
42
  Examples:
43
- 1. Logging a single x array where all y series are plotted against
44
- the same x values:
45
-
46
- ```
47
- import wandb
48
-
49
- # Initialize W&B run
50
- with wandb.init(project="line_series_example") as run:
51
- # x values shared across all y series
52
- xs = list(range(10))
53
-
54
- # Multiple y series to plot
55
- ys = [
56
- [i for i in range(10)], # y = x
57
- [i**2 for i in range(10)], # y = x^2
58
- [i**3 for i in range(10)], # y = x^3
59
- ]
60
-
61
- # Generate and log the line series chart
62
- line_series_chart = wandb.plot.line_series(
63
- xs,
64
- ys,
65
- title="title",
66
- xname="step",
67
- )
68
- run.log({"line-series-single-x": line_series_chart})
69
- ```
70
-
71
- In this example, a single `xs` series (shared x-values) is used for all
72
- `ys` series. This results in each y-series being plotted against the
73
- same x-values (0-9).
74
-
75
- 2. Logging multiple x arrays where each y series is plotted against
76
- its corresponding x array:
77
-
78
- ```python
79
- import wandb
80
-
81
- # Initialize W&B run
82
- with wandb.init(project="line_series_example") as run:
83
- # Separate x values for each y series
84
- xs = [
85
- [i for i in range(10)], # x for first series
86
- [2 * i for i in range(10)], # x for second series (stretched)
87
- [3 * i for i in range(10)], # x for third series (stretched more)
88
- ]
89
-
90
- # Corresponding y series
91
- ys = [
92
- [i for i in range(10)], # y = x
93
- [i**2 for i in range(10)], # y = x^2
94
- [i**3 for i in range(10)], # y = x^3
95
- ]
96
-
97
- # Generate and log the line series chart
98
- line_series_chart = wandb.plot.line_series(
99
- xs, ys, title="Multiple X Arrays Example", xname="Step"
100
- )
101
- run.log({"line-series-multiple-x": line_series_chart})
102
- ```
103
-
104
- In this example, each y series is plotted against its own unique x series.
105
- This allows for more flexibility when the x values are not uniform across
106
- the data series.
107
-
108
- 3. Customizing line labels using `keys`:
109
-
110
- ```python
111
- import wandb
112
-
113
- # Initialize W&B run
114
- with wandb.init(project="line_series_example") as run:
115
- xs = list(range(10)) # Single x array
116
- ys = [
117
- [i for i in range(10)], # y = x
118
- [i**2 for i in range(10)], # y = x^2
119
- [i**3 for i in range(10)], # y = x^3
120
- ]
121
-
122
- # Custom labels for each line
123
- keys = ["Linear", "Quadratic", "Cubic"]
124
-
125
- # Generate and log the line series chart
126
- line_series_chart = wandb.plot.line_series(
127
- xs,
128
- ys,
129
- keys=keys, # Custom keys (line labels)
130
- title="Custom Line Labels Example",
131
- xname="Step",
132
- )
133
- run.log({"line-series-custom-keys": line_series_chart})
134
- ```
135
-
136
- This example shows how to provide custom labels for the lines using
137
- the `keys` argument. The keys will appear in the legend as "Linear",
138
- "Quadratic", and "Cubic".
139
-
43
+ Logging a single x array where all y series are plotted against the same x values:
44
+
45
+ ```python
46
+ import wandb
47
+
48
+ # Initialize W&B run
49
+ with wandb.init(project="line_series_example") as run:
50
+ # x values shared across all y series
51
+ xs = list(range(10))
52
+
53
+ # Multiple y series to plot
54
+ ys = [
55
+ [i for i in range(10)], # y = x
56
+ [i**2 for i in range(10)], # y = x^2
57
+ [i**3 for i in range(10)], # y = x^3
58
+ ]
59
+
60
+ # Generate and log the line series chart
61
+ line_series_chart = wandb.plot.line_series(
62
+ xs,
63
+ ys,
64
+ title="title",
65
+ xname="step",
66
+ )
67
+ run.log({"line-series-single-x": line_series_chart})
68
+ ```
69
+
70
+ In this example, a single `xs` series (shared x-values) is used for all
71
+ `ys` series. This results in each y-series being plotted against the
72
+ same x-values (0-9).
73
+
74
+ Logging multiple x arrays where each y series is plotted against its corresponding x array:
75
+
76
+ ```python
77
+ import wandb
78
+
79
+ # Initialize W&B run
80
+ with wandb.init(project="line_series_example") as run:
81
+ # Separate x values for each y series
82
+ xs = [
83
+ [i for i in range(10)], # x for first series
84
+ [2 * i for i in range(10)], # x for second series (stretched)
85
+ [3 * i for i in range(10)], # x for third series (stretched more)
86
+ ]
87
+
88
+ # Corresponding y series
89
+ ys = [
90
+ [i for i in range(10)], # y = x
91
+ [i**2 for i in range(10)], # y = x^2
92
+ [i**3 for i in range(10)], # y = x^3
93
+ ]
94
+
95
+ # Generate and log the line series chart
96
+ line_series_chart = wandb.plot.line_series(
97
+ xs, ys, title="Multiple X Arrays Example", xname="Step"
98
+ )
99
+ run.log({"line-series-multiple-x": line_series_chart})
100
+ ```
101
+
102
+ In this example, each y series is plotted against its own unique x series.
103
+ This allows for more flexibility when the x values are not uniform across
104
+ the data series.
105
+
106
+ Customizing line labels using `keys`:
107
+
108
+ ```python
109
+ import wandb
110
+
111
+ # Initialize W&B run
112
+ with wandb.init(project="line_series_example") as run:
113
+ xs = list(range(10)) # Single x array
114
+ ys = [
115
+ [i for i in range(10)], # y = x
116
+ [i**2 for i in range(10)], # y = x^2
117
+ [i**3 for i in range(10)], # y = x^3
118
+ ]
119
+
120
+ # Custom labels for each line
121
+ keys = ["Linear", "Quadratic", "Cubic"]
122
+
123
+ # Generate and log the line series chart
124
+ line_series_chart = wandb.plot.line_series(
125
+ xs,
126
+ ys,
127
+ keys=keys, # Custom keys (line labels)
128
+ title="Custom Line Labels Example",
129
+ xname="Step",
130
+ )
131
+ run.log({"line-series-custom-keys": line_series_chart})
132
+ ```
133
+
134
+ This example shows how to provide custom labels for the lines using
135
+ the `keys` argument. The keys will appear in the legend as "Linear",
136
+ "Quadratic", and "Cubic".
140
137
  """
141
138
  # If xs is a single array, repeat it for each y in ys
142
139
  if not isinstance(xs[0], Iterable) or isinstance(xs[0], (str, bytes)):