code: def test_factorial_performance_analysis(space, n_levels):
      N = 20
      transformer = Transformer(space, n_levels)
      trials = get_n_completed_trials(space, N)
      oa_table = transformer.generate_oa_table(trials)
  
      factorial_performance_analysis = (
          get_factorial_performance_analysis(oa_table, space, n_levels)
      )
  
      assert factorial_performance_analysis.columns.to_list() == [
          "level"
      ] + list(space.keys())
  
      for key in space.keys():
          df = oa_table[[key, "objective"]].groupby([key]).mean()
          levels = df.index.values.tolist()
          ground_truth = df["objective"].to_list()
          for i in range(n_levels):
              if len(levels) - 1 < i or levels[i] > i + 1:
                  levels.insert(i, i + 1)
                  ground_truth.insert(i, float("inf"))
  
          assert (
              factorial_performance_analysis[key].to_list()
              == ground_truth
          )
  
file_path: orion/tests/unittests/algo/mofa/test_analysis.py
imports: import itertools
  import numpy
  import pandas
  import pytest
  from orion.algo.mofa.mofa import MOFA, get_factorial_importance_analysis, get_factorial_performance_analysis, select_new_region_of_interest
  from orion.algo.mofa.transformer import Transformer
  from orion.core.io.space_builder import SpaceBuilder
  from orion.core.worker.transformer import build_required_space
label_desc: Use image node_id 6 for calling a global function with example usage: test_factorial_performance_analysis(space, n_levels) without return types