class_docstr: Tests for dataset analysis utilities.
class_docstr_tok: ["Tests","for","dataset","analysis","utilities","."]
docstr: Helper method for relation pattern classification.
docstr_tok: ["Helper","method","for","relation","pattern","classification","."]
code: def test_relation_pattern_types(self):
      """Helper method for relation pattern classification."""
      df = dataset_analysis.get_relation_pattern_types_df(
          dataset=self.dataset,
          drop_confidence=False,
      )
  
      # check correct type
      assert isinstance(df, pandas.DataFrame)
  
      # check relation_id value range
      assert (
          df[triple_analysis.RELATION_ID_COLUMN_NAME]
          .isin(self.dataset.relation_to_id.values())
          .all()
      )
  
      # check pattern value range
      assert (
          df[triple_analysis.PATTERN_TYPE_COLUMN_NAME]
          .isin(triple_analysis.RELATION_PATTERN_TYPES)
          .all()
      )
  
      # check confidence value range
      x = df[triple_analysis.CONFIDENCE_COLUMN_NAME].values
      assert (0 <= x).all()
      assert (x <= 1).all()
  
      # check support value range
      x = df[triple_analysis.SUPPORT_COLUMN_NAME].values
      assert (1 <= x).all()
  
imports: import itertools
  import unittest
  from typing import Iterable, Mapping
  import numpy
  import pandas
  from pykeen.datasets import Dataset, Nations
  from pykeen.datasets import analysis
  from pykeen.triples import analysis
  from pykeen.typing import LABEL_HEAD, LABEL_TAIL
label_desc: Use image node_id 5 for calling the DatasetAnalysisTests obj's underlying member method code with example usage: obj.test_relation_pattern_types() without return types