class_docstr: Test class for custom metric tests.
docstr: Test config with custom probabilistic metric.
docstr_tok: ["Test","config","with","custom","probabilistic","metric","."]
code: def test_config_with_custom_prob_metric(self):
      """Test config with custom probabilistic metric."""
      # run the first experiment that uses a custom probabilistic metric
      # for grid search but with a learner that does not produce probabilities
      train_file = other_dir / "examples_train.jsonlines"
      test_file = other_dir / "examples_test.jsonlines"
      config_path = fill_in_config_paths_for_single_file(
          config_dir / "test_custom_metrics_kwargs3.template.cfg",
          train_file,
          test_file,
      )
  
      # this should fail as expected
      assert_raises_regex(
          AttributeError,
          r"has none of the following attributes: predict_proba",
          run_configuration,
          config_path,
          local=True,
          quiet=True,
      )
  
      # now run the second experiment that is identical except that
      # the learner now produces probabilities
      config_path = fill_in_config_paths_for_single_file(
          config_dir / "test_custom_metrics_kwargs4.template.cfg",
          train_file,
          test_file,
      )
      # this should succeed and produce results
      run_configuration(config_path, local=True, quiet=True)
  
      # laod the results and verify them
      with open(
          output_dir / "test_custom_metrics_kwargs4_train_examples_"
          "train.jsonlines_SVC.results.json"
      ) as f:
          result_dict = json.load(f)
          grid_score = result_dict["grid_score"]
  
      self.assertTrue(grid_score > 0.95)
  
imports: import json
  import sys
  import unittest
  from itertools import chain
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_raises_regex
  from sklearn.metrics import fbeta_score
  import skll.metrics
  from skll.data import NDJReader
  from skll.experiments import run_configuration
  from skll.learner import Learner
  from skll.metrics import _CUSTOM_METRICS, register_custom_metric, use_score_func
  from skll.utils.testing import config_dir, fill_in_config_paths_for_single_file, make_classification_data, other_dir, output_dir, unlink
label_desc: Use image node_id 23 for calling the TestCustomMetrics obj's underlying member method code with example usage: obj.test_config_with_custom_prob_metric() without return types