code: def test_predict_intervals_takes_in_custom_intervals():
      np.random.seed(0)
  
      (
          df_boston_train,
          df_boston_test,
      ) = utils.get_boston_regression_dataset()
  
      column_descriptions = {"MEDV": "output", "CHAS": "categorical"}
  
      ml_predictor = Predictor(
          type_of_estimator="regressor",
          column_descriptions=column_descriptions,
      )
  
      # df_boston_train = pd.concat([df_boston_train, df_boston_train, df_boston_train])
  
      ml_predictor.train(df_boston_train, predict_intervals=[0.4, 0.6])
  
      custom_intervals = ml_predictor.predict_intervals(
          df_boston_test, return_type="list"
      )
  
      assert isinstance(custom_intervals, list)
  
      singles = df_boston_test.head().to_dict("records")
  
      acceptable_keys = set(
          ["prediction", "interval_0.4", "interval_0.6"]
      )
      for row in singles:
          result = ml_predictor.predict_intervals(row)
          assert isinstance(result, dict)
          assert "prediction" in result
          assert "interval_0.4" in result
          assert "interval_0.6" in result
          for key in result.keys():
              assert key in acceptable_keys
  
      for row in singles:
          result = ml_predictor.predict_intervals(
              row, return_type="list"
          )
          assert isinstance(result, list)
          assert len(result) == 3
  
      df_intervals = ml_predictor.predict_intervals(
          df_boston_test, return_type="df"
      )
      assert df_intervals.shape[0] == df_boston_test.shape[0]
      assert isinstance(df_intervals, pd.DataFrame)
  
      # Now make sure that the interval values are actually different
      ml_predictor = Predictor(
          type_of_estimator="regressor",
          column_descriptions=column_descriptions,
      )
  
      ml_predictor.train(df_boston_train, predict_intervals=True)
  
      default_intervals = ml_predictor.predict_intervals(
          df_boston_test, return_type="list"
      )
  
      # This is a super flaky test, because we've got such a small datasize, and we're trying to get distributions from it
      len_intervals = len(custom_intervals)
      num_failures = 0
      for idx, custom_row in enumerate(custom_intervals):
          default_row = default_intervals[idx]
  
          if int(custom_row[1]) <= int(default_row[1]):
              num_failures += 1
              print(
                  "{} should be higher than {}".format(
                      custom_row[1], default_row[1]
                  )
              )
          if int(custom_row[2]) >= int(default_row[2]):
              print(
                  "{} should be lower than {}".format(
                      custom_row[1], default_row[1]
                  )
              )
              num_failures += 1
  
      assert num_failures < 0.18 * len_intervals
  
file_path: auto_ml/tests/core_tests/test_prediction_intervals.py
imports: import os
  import sys
  from auto_ml import Predictor
  import dill
  from nose.tools import assert_equal, assert_not_equal, with_setup
  import numpy
  import pandas
  from sklearn.model_selection import train_test_split
  import utils_testing
label_desc: Use image node_id 5 for calling a global function with example usage: test_predict_intervals_takes_in_custom_intervals() without return types