diff --git a/ax/plot/parallel_coordinates.py b/ax/plot/parallel_coordinates.py deleted file mode 100644 index fcbb93e9917..00000000000 --- a/ax/plot/parallel_coordinates.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# pyre-strict - - -import pandas as pd -from ax.core.experiment import Experiment -from ax.plot.base import AxPlotConfig, AxPlotTypes -from ax.service.utils.report_utils import _get_shortest_unique_suffix_dict, exp_to_df -from plotly import express as px, graph_objs as go - - -def prepare_experiment_for_plotting( - experiment: Experiment, - ignored_names: list[str] | None = None, -) -> pd.DataFrame: - """Strip variables not desired in the final plot and truncate names for readability - - Args: - experiment: Experiment containing trials to plot - ignored_names: Metrics present in the experiment data we wish to exclude from - the final plot. By default we ignore ["generation_method", "trial_status", - "arm_name"] - - Returns: - df.DataFrame: data frame ready for ingestion by plotly - """ - ignored_names = ( - ["generation_method", "trial_status", "arm_name"] - if ignored_names is None - else ignored_names - ) - - df = exp_to_df(experiment) - - dropped = df.drop(ignored_names, axis=1) - - renamed = dropped.rename( - columns=_get_shortest_unique_suffix_dict([str(c) for c in dropped.columns]) - ) - - return renamed - - -def plot_parallel_coordinates_plotly( - experiment: Experiment, ignored_names: list[str] | None = None -) -> go.Figure: - """Plot trials as a parallel coordinates graph - - Args: - experiment: Experiment containing trials to plot - ignored_names: Metrics present in the experiment data we wish to exclude from - the final plot. By default we ignore ["generation_method", "trial_status", - "arm_name"] - - Returns: - go.Figure: parellel coordinates plot of all experiment trials - """ - df = prepare_experiment_for_plotting( - experiment=experiment, ignored_names=ignored_names - ) - - return px.parallel_coordinates(df, color=df.columns[0]) - - -def plot_parallel_coordinates( - experiment: Experiment, ignored_names: list[str] | None = None -) -> AxPlotConfig: - """Plot trials as a parallel coordinates graph - - Args: - experiment: Experiment containing trials to plot - ignored_names: Metrics present in the experiment data we wish to exclude from - the final plot. By default we ignore ["generation_method", "trial_status", - "arm_name"] - - Returns: - AxPlotConfig: parellel coordinates plot of all experiment trials - """ - fig = plot_parallel_coordinates_plotly( - experiment=experiment, ignored_names=ignored_names - ) - - # pyre-fixme[6]: For 1st argument expected `Dict[str, typing.Any]` but got `Figure`. - return AxPlotConfig(data=fig, plot_type=AxPlotTypes.GENERIC) diff --git a/ax/plot/tests/test_parallel_coordinates.py b/ax/plot/tests/test_parallel_coordinates.py deleted file mode 100644 index f1f47448cea..00000000000 --- a/ax/plot/tests/test_parallel_coordinates.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# pyre-strict - - -from ax.plot.base import AxPlotConfig, AxPlotTypes -from ax.plot.parallel_coordinates import plot_parallel_coordinates -from ax.utils.common.testutils import TestCase -from ax.utils.testing.core_stubs import get_branin_experiment - - -class ParallelCoordinatesTest(TestCase): - def test_ParallelCoordinates(self) -> None: - exp = get_branin_experiment(with_batch=True) - exp.trials[0].run() - - # Assert that each type of plot can be constructed successfully - plot = plot_parallel_coordinates(experiment=exp) - - self.assertIsInstance(plot, AxPlotConfig) - self.assertEqual(plot.plot_type, AxPlotTypes.GENERIC) diff --git a/sphinx/source/plot.rst b/sphinx/source/plot.rst index e107c0160a4..445b5e0da86 100644 --- a/sphinx/source/plot.rst +++ b/sphinx/source/plot.rst @@ -111,14 +111,6 @@ Trace Plots :undoc-members: :show-inheritance: -Parallel Coordinates -~~~~~~~~~~~~~~~~~~~ - -.. automodule:: ax.plot.parallel_coordinates - :members: - :undoc-members: - :show-inheritance: - Plotting Utilities ------------------