class_docstr: Data object used for all RasaModels.
  
  It contains all features needed to train the models.
  'data' is a mapping of attribute name, e.g. TEXT, INTENT, etc., and feature name,
  e.g. SENTENCE, SEQUENCE, etc., to a list of feature arrays representing the actual
  features.
  'label_key' and 'label_sub_key' point to the labels inside 'data'. For
  example, if your intent labels are stored under INTENT -> IDS, 'label_key' would
  be "INTENT" and 'label_sub_key' would be "IDS".
class_docstr_tok: ["Data","object","used","for","all","RasaModels",".","It","contains","all","features","needed","to","train","the","models",".","'data","'","is","a","mapping","of","attribute","name",",","e.g",".","TEXT",",","INTENT",",","etc.",",","and","feature","name",",","e.g",".","SENTENCE",",","SEQUENCE",",","etc.",",","to","a","list","of","feature","arrays","representing","the","actual","features",".","'label_key","'","and","'label_sub_key","'","point","to","the","labels","inside","'data","'",".","For","example",",","if","your","intent","labels","are","stored","under","INTENT","-",">","IDS",",","'label_key","'","would","be","``","INTENT","''","and","'label_sub_key","'","would","be","``","IDS","''","."]
docstr: Obtain number of examples in data.
  
  Args:
      data: The data.
  
  Raises: A ValueError if number of examples differ for different features.
  
  Returns:
      The number of examples in data.
docstr_tok: ["Obtain","number","of","examples","in","data",".","Args",":","data",":","The","data",".","Raises",":","A","ValueError","if","number","of","examples","differ","for","different","features",".","Returns",":","The","number","of","examples","in","data","."]
code: def number_of_examples(self, data: Optional[Data] = None) -> int:
      """Obtain number of examples in data.
  
      Args:
          data: The data.
  
      Raises: A ValueError if number of examples differ for different features.
  
      Returns:
          The number of examples in data.
      """
      if not data:
          data = self.data
  
      if not data:
          return 0
  
      example_lengths = [
          len(f)
          for attribute_data in data.values()
          for features in attribute_data.values()
          for f in features
      ]
  
      if not example_lengths:
          return 0
  
      # check if number of examples is the same for all values
      if not all(
          length == example_lengths[0] for length in example_lengths
      ):
          raise ValueError(
              f"Number of examples differs for keys '{data.keys()}'. Number of "
              f"examples should be the same for all data."
          )
  
      return example_lengths[0]
  
imports: import logging
  from typing import Optional, DefaultDict, Dict, Iterable, Text, List, Tuple, Any, Union, NamedTuple, ItemsView, overload, cast
  from collections import defaultdict, OrderedDict
  import numpy
  import scipy.sparse
  from sklearn.model_selection import train_test_split
label_desc: Use image node_id 13 for calling the RasaModelData obj's underlying member method code with example usage: obj.number_of_examples(data) and returns: example_lengths, int, int