Conversation
Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
There was a problem hiding this comment.
Code Review
This pull request correctly updates a code example in the writing-code-snippets.rst documentation to match the new ray.data.Dataset string representation. The changes, including updating the .. testoutput:: block and using np.round for cleaner output, are accurate and improve the documentation. I have one minor suggestion to improve the readability of the example code.
| vec_a = batch["petal length (cm)"] | ||
| vec_b = batch["petal width (cm)"] | ||
| batch["petal area (cm^2)"] = vec_a * vec_b | ||
| batch["petal area (cm^2)"] = np.round(vec_a * vec_b, 2) |
There was a problem hiding this comment.
For better readability and to set a good example in this guide on writing code snippets, consider using more descriptive variable names instead of vec_a and vec_b. For example, petal_length and petal_width would make the code's intent clearer.
| vec_a = batch["petal length (cm)"] | |
| vec_b = batch["petal width (cm)"] | |
| batch["petal area (cm^2)"] = vec_a * vec_b | |
| batch["petal area (cm^2)"] = np.round(vec_a * vec_b, 2) | |
| petal_length = batch["petal length (cm)"] | |
| petal_width = batch["petal width (cm)"] | |
| batch["petal area (cm^2)"] = np.round(petal_length * petal_width, 2) |
| │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │ | ||
| │ double ┆ double ┆ double ┆ double ┆ int64 ┆ double │ | ||
| ╞═══════════════════╪══════════════════╪═══════════════════╪══════════════════╪════════╪═══════════════════╡ | ||
| │ 5.1 ┆ 3.5 ┆ 1.4 ┆ 0.2 ┆ 0 ┆ 0.28 │ |
There was a problem hiding this comment.
these are some very specific data.
There was a problem hiding this comment.
It's the data in the canonical Iris dataset. We should enable preserve_order for Data doctest, so these results should be deterministic
richardliaw
left a comment
There was a problem hiding this comment.
any reason how this wasn't caught in earlier tests?
|
@richardliaw I guess the contributor guide doctests don't run on Data premerge |
#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Signed-off-by: abrar <abrar@anyscale.com>
…project#60351) ray-project#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Signed-off-by: jinbum-kim <jinbum9958@gmail.com>
…project#60351) ray-project#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Signed-off-by: 400Ping <jiekaichang@apache.org>
…project#60351) ray-project#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu>
…project#60351) ray-project#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Signed-off-by: peterxcli <peterxcli@gmail.com>
…project#60351) ray-project#59631 changed the way the `Dataset` representations look, but CI didn't test `writing-code-snippet` in that PR's premerge CI. This PR fixes the incorrect output. Signed-off-by: Balaji Veeramani <bveeramani@berkeley.edu> Signed-off-by: peterxcli <peterxcli@gmail.com>
#59631 changed the way the
Datasetrepresentations look, but CI didn't testwriting-code-snippetin that PR's premerge CI. This PR fixes the incorrect output.