class_docstr: A Pipeline expression computing a categorical output.
  
  Classifiers are most commonly useful for describing grouping keys for
  complex transformations on Factor outputs. For example, Factor.demean() and
  Factor.zscore() can be passed a Classifier in their ``groupby`` argument,
  indicating that means/standard deviations should be computed on assets for
  which the classifier produced the same label.
class_docstr_tok: ["A","Pipeline","expression","computing","a","categorical","output",".","Classifiers","are","most","commonly","useful","for","describing","grouping","keys","for","complex","transformations","on","Factor","outputs",".","For","example",",","Factor.demean","(",")","and","Factor.zscore","(",")","can","be","passed","a","Classifier","in","their","``","groupby","``","argument",",","indicating","that","means\/standard","deviations","should","be","computed","on","assets","for","which","the","classifier","produced","the","same","label","."]
docstr: Construct a Filter indicating whether values are in ``choices``.
  
  Parameters
  ----------
  choices : iterable[str or int]
      An iterable of choices.
  
  Returns
  -------
  matches : Filter
      Filter returning True for all sid/date pairs for which ``self``
      produces an entry in ``choices``.
docstr_tok: ["Construct","a","Filter","indicating","whether","values","are","in","``","choices","``",".","Parameters","--","--","--","--","--","choices",":","iterable","[","str","or","int","]","An","iterable","of","choices",".","Returns","--","--","--","-","matches",":","Filter","Filter","returning","True","for","all","sid\/date","pairs","for","which","``","self","``","produces","an","entry","in","``","choices","``","."]
code: def element_of(self, choices):
      """
      Construct a Filter indicating whether values are in ``choices``.
  
      Parameters
      ----------
      choices : iterable[str or int]
          An iterable of choices.
  
      Returns
      -------
      matches : Filter
          Filter returning True for all sid/date pairs for which ``self``
          produces an entry in ``choices``.
      """
      try:
          choices = frozenset(choices)
      except Exception as e:
          raise TypeError(
              "Expected `choices` to be an iterable of hashable values,"
              " but got {} instead.\n"
              "This caused the following error: {!r}.".format(
                  choices, e
              )
          )
  
      if self.missing_value in choices:
          raise ValueError(
              "Found self.missing_value ({mv!r}) in choices supplied to"
              " {typename}.{meth_name}().\n"
              "Missing values have NaN semantics, so the"
              " requested comparison would always produce False.\n"
              "Use the isnull() method to check for missing values.\n"
              "Received choices were {choices}.".format(
                  mv=self.missing_value,
                  typename=(type(self).__name__),
                  choices=sorted(choices),
                  meth_name=self.element_of.__name__,
              )
          )
  
      def only_contains(type_, values):
          return all(isinstance(v, type_) for v in values)
  
      if self.dtype == int64_dtype:
          if only_contains(int, choices):
              return ArrayPredicate(
                  term=self,
                  op=vectorized_is_element,
                  opargs=(choices,),
              )
          else:
              raise TypeError(
                  "Found non-int in choices for {typename}.element_of.\n"
                  "Supplied choices were {choices}.".format(
                      typename=type(self).__name__,
                      choices=choices,
                  )
              )
      elif self.dtype == categorical_dtype:
          if only_contains((bytes, unicode), choices):
              return ArrayPredicate(
                  term=self,
                  op=LabelArray.element_of,
                  opargs=(choices,),
              )
          else:
              raise TypeError(
                  "Found non-string in choices for {typename}.element_of.\n"
                  "Supplied choices were {choices}.".format(
                      typename=type(self).__name__,
                      choices=choices,
                  )
              )
      assert False, (
          "Unknown dtype in Classifier.element_of %s." % self.dtype
      )
  
imports: from numbers import Number
  import operator
  import re
  from numpy import where, isnan, nan, zeros
  import pandas
  from catalyst.lib.labelarray import LabelArray
  from catalyst.lib.quantiles import quantiles
  from catalyst.pipeline.api_utils import restrict_to_dtype
  from catalyst.pipeline.sentinels import NotSpecified
  from catalyst.pipeline.term import ComputableTerm
  from catalyst.utils.compat import unicode
  from catalyst.utils.input_validation import expect_types, expect_dtypes
  from catalyst.utils.memoize import classlazyval
  from catalyst.utils.numpy_utils import categorical_dtype, int64_dtype, vectorized_is_element
  from ..filters import ArrayPredicate, NotNullFilter, NullFilter, NumExprFilter
  from ..mixins import AliasedMixin, CustomTermMixin, DownsampledMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs
label_desc: Use image node_id 10 for calling the Classifier obj's underlying member method code with example usage: obj.element_of(choices) and returns: all, ArrayPredicate, ArrayPredicate