From 8801c794be426d8004c1dd4e3885bea2b73bd843 Mon Sep 17 00:00:00 2001 From: Sait Cakmak Date: Wed, 21 Aug 2024 15:03:05 -0700 Subject: [PATCH] Simplify ax/analysis/plotly directory structure (#2684) Summary: Pull Request resolved: https://github.com/facebook/Ax/pull/2684 Having separate sub-directories for each analysis makes the directory structure & import paths overly verbose. It also necessitates adding an `__init__.py` file for each sub-directory, which is easy to miss and can lead to `module not found` errors elsewhere (see D61607199). This diff eliminates the separate sub-directory for the parallel coordinates analysis. Reviewed By: mpolson64 Differential Revision: D61611408 fbshipit-source-id: 3e91c860993f887cac994fff59950511e6c221b2 --- ax/analysis/plotly/__init__.py | 4 +--- .../{parallel_coordinates => }/parallel_coordinates.py | 0 .../tests/test_parallel_coordinates.py | 2 +- ax/service/scheduler.py | 4 +--- ax/service/tests/scheduler_test_utils.py | 4 +--- sphinx/source/analysis.rst | 8 ++++++++ 6 files changed, 12 insertions(+), 10 deletions(-) rename ax/analysis/plotly/{parallel_coordinates => }/parallel_coordinates.py (100%) rename ax/analysis/plotly/{parallel_coordinates => }/tests/test_parallel_coordinates.py (97%) diff --git a/ax/analysis/plotly/__init__.py b/ax/analysis/plotly/__init__.py index bff30ee07a2..17d16949c08 100644 --- a/ax/analysis/plotly/__init__.py +++ b/ax/analysis/plotly/__init__.py @@ -5,9 +5,7 @@ # pyre-strict -from ax.analysis.plotly.parallel_coordinates.parallel_coordinates import ( - ParallelCoordinatesPlot, -) +from ax.analysis.plotly.parallel_coordinates import ParallelCoordinatesPlot from ax.analysis.plotly.plotly_analysis import PlotlyAnalysis, PlotlyAnalysisCard __all__ = ["PlotlyAnalysis", "PlotlyAnalysisCard", "ParallelCoordinatesPlot"] diff --git a/ax/analysis/plotly/parallel_coordinates/parallel_coordinates.py b/ax/analysis/plotly/parallel_coordinates.py similarity index 100% rename from ax/analysis/plotly/parallel_coordinates/parallel_coordinates.py rename to ax/analysis/plotly/parallel_coordinates.py diff --git a/ax/analysis/plotly/parallel_coordinates/tests/test_parallel_coordinates.py b/ax/analysis/plotly/tests/test_parallel_coordinates.py similarity index 97% rename from ax/analysis/plotly/parallel_coordinates/tests/test_parallel_coordinates.py rename to ax/analysis/plotly/tests/test_parallel_coordinates.py index 29e93c57ff8..3f09b238c59 100644 --- a/ax/analysis/plotly/parallel_coordinates/tests/test_parallel_coordinates.py +++ b/ax/analysis/plotly/tests/test_parallel_coordinates.py @@ -7,7 +7,7 @@ import pandas as pd from ax.analysis.analysis import AnalysisCardLevel -from ax.analysis.plotly.parallel_coordinates.parallel_coordinates import ( +from ax.analysis.plotly.parallel_coordinates import ( _get_parameter_dimension, _select_metric, ParallelCoordinatesPlot, diff --git a/ax/service/scheduler.py b/ax/service/scheduler.py index 4c3da077f8b..115e4c2e8bb 100644 --- a/ax/service/scheduler.py +++ b/ax/service/scheduler.py @@ -19,9 +19,7 @@ import ax.service.utils.early_stopping as early_stopping_utils from ax.analysis.analysis import Analysis, AnalysisCard -from ax.analysis.plotly.parallel_coordinates.parallel_coordinates import ( - ParallelCoordinatesPlot, -) +from ax.analysis.plotly.parallel_coordinates import ParallelCoordinatesPlot from ax.core.base_trial import BaseTrial, TrialStatus from ax.core.experiment import Experiment from ax.core.generation_strategy_interface import GenerationStrategyInterface diff --git a/ax/service/tests/scheduler_test_utils.py b/ax/service/tests/scheduler_test_utils.py index ae6187fbca7..49548b1046e 100644 --- a/ax/service/tests/scheduler_test_utils.py +++ b/ax/service/tests/scheduler_test_utils.py @@ -17,9 +17,7 @@ from unittest.mock import call, Mock, patch, PropertyMock import pandas as pd -from ax.analysis.plotly.parallel_coordinates.parallel_coordinates import ( - ParallelCoordinatesPlot, -) +from ax.analysis.plotly.parallel_coordinates import ParallelCoordinatesPlot from ax.core.arm import Arm from ax.core.base_trial import BaseTrial, TrialStatus diff --git a/sphinx/source/analysis.rst b/sphinx/source/analysis.rst index 889a0617fb5..8589740f243 100644 --- a/sphinx/source/analysis.rst +++ b/sphinx/source/analysis.rst @@ -38,3 +38,11 @@ Healthcheck Analysis :members: :undoc-members: :show-inheritance: + +Parallel Coordinates Analysis +~~~~~~~~~~~~~~~ + +.. automodule:: ax.analysis.plotly.parallel_coordinates + :members: + :undoc-members: + :show-inheritance: