diff --git a/.gitignore b/.gitignore index 1cc6a47..178d1a7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ # dist VERSION -neptune_lib.egg-info/ +neptune_contrib.egg-info/ dist/ # tests @@ -21,5 +21,5 @@ tests/.pytest_cache docs/_build docs/_templates -# nbooks +# notebooks *.ipynb_checkpoints diff --git a/docs/examples/hiplot_visualizations.ipynb b/docs/examples/hiplot_visualizations.ipynb index 28a1f6c..c20f16a 100644 --- a/docs/examples/hiplot_visualizations.ipynb +++ b/docs/examples/hiplot_visualizations.ipynb @@ -17,26 +17,27 @@ "1. Setup the visualization to your liking.\n", "1. Inspect experiments lineage.\n", "\n", - "## Before we start, make sure that you have dependencies installed\n", + "### Before we start, make sure that you have dependencies installed\n", "* `neptune-client`\n", "* `neptune-contrib[viz]`\n", "* `hiplot`\n", "\n", - "## Example notebooks in Neptune\n", + "### Example notebooks in Neptune\n", "* [credit-default-prediction](https://ui.neptune.ai/neptune-ai/credit-default-prediction/n/parallel-plot-04e5c379-0837-42ff-a11c-a8861ca4a408/c486644a-a356-4317-b397-6cdae86b7575)\n", "* [example-project](https://ui.neptune.ai/USERNAME/example-project/n/parallel-plot-cb5394cc-edce-41e3-9a25-7970865c66ad/59377976-6651-40ed-b3c3-eb0fa5aa79bc)\n", "\n", "These notebooks are tracked in Neptune public projects. You are free to play with the plots - they are interactive.\n", "\n", - "## Remember to set the project before you call visualization function\n", - "For example: `neptune.init('USERNAME/example-project')`" + "### Learn more\n", + "Check integration [documentation](https://neptune-contrib.readthedocs.io/user_guide/viz/parallel_coordinates_plot.html) for more details." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Set project" + "## Set project\n", + "Remember to set the project before you call visualization function" ] }, { @@ -133,7 +134,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.9" + "version": "3.6.8" } }, "nbformat": 4, diff --git a/neptunecontrib/viz/parallel_coordinates_plot.py b/neptunecontrib/viz/parallel_coordinates_plot.py index 6772c00..065bf1b 100644 --- a/neptunecontrib/viz/parallel_coordinates_plot.py +++ b/neptunecontrib/viz/parallel_coordinates_plot.py @@ -37,7 +37,12 @@ def make_parallel_coordinates_plot(html_file_path=None, You can also inspect the lineage of experiments. **See** `example `_ - **for full use case.** + **for the full use case.** + + Axes are ordered as follows: first axis is neptune ``experiment id``, + second is experiment ``owner``, + then ``params`` and ``properties`` in alphabetical order. + Finally, ``metrics`` on the right side (alphabetical order as well). This visualization it built using `HiPlot `_. It is a library published by the Facebook AI group. @@ -197,6 +202,18 @@ def make_parallel_coordinates_plot(html_file_path=None, df = df.sort_values(by='neptune_exp_number', ascending=True) df = df.drop(columns='neptune_exp_number') + # Prepare order of axes, where 'neptune_id' is first, metrics to the right. + all_axes = df.columns.to_list() + if metrics: + metric_names = [j[1] for j in metrics] + metric_names.sort() + for metric in metric_names: + all_axes.remove(metric) + all_axes.sort() + all_axes.sort(reverse=True, key='owner'.__eq__) + all_axes.sort(reverse=True, key='neptune_id'.__eq__) + all_axes = all_axes + metric_names + # Prepare HiPlot visualization input_to_hiplot = df.T.to_dict().values() hiplot_vis = hip.Experiment().from_iterable(input_to_hiplot) @@ -212,7 +229,7 @@ def make_parallel_coordinates_plot(html_file_path=None, hiplot_vis.to_html(html_file_path) hiplot_vis.display_data(hip.Displays.PARALLEL_PLOT).update({'categoricalMaximumValues': df.shape[0], 'hide': ['uid', 'from_uid'], - 'order': ['neptune_id']}) + 'order': all_axes}) return hiplot_vis.display()