code: def test_predict_uncertainty_true():
      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,
      )
  
      ml_predictor.train(df_boston_train, predict_intervals=True)
  
      intervals = ml_predictor.predict_intervals(df_boston_test)
  
      assert isinstance(intervals, pd.DataFrame)
      assert intervals.shape[0] == df_boston_test.shape[0]
  
      result_list = ml_predictor.predict_intervals(
          df_boston_test, return_type="list"
      )
  
      assert isinstance(result_list, list)
      assert len(result_list) == df_boston_test.shape[0]
      for idx, row in enumerate(result_list):
          assert isinstance(row, list)
          assert len(row) == 3
  
      singles = df_boston_test.head().to_dict("records")
  
      for row in singles:
          result = ml_predictor.predict_intervals(row)
          assert isinstance(result, dict)
          assert "prediction" in result
          assert "interval_0.05" in result
          assert "interval_0.95" in result
  
      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 isinstance(df_intervals, pd.DataFrame)
  
      try:
          ml_predictor.predict_intervals(
              df_boston_test, return_type="this will not work"
          )
          assert False
      except ValueError:
          assert True
  
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 1 for calling a global function with example usage: test_predict_uncertainty_true() without return types