class_docstr: The Sketch object contains a sketch of a single SArray (a column of an
  SFrame). Using a sketch representation of an SArray, many approximate and
  exact statistics can be computed very quickly.
  
  To construct a Sketch object, the following methods are equivalent:
  
  >>> my_sarray = turicreate.SArray([1,2,3,4,5])
  >>> sketch = turicreate.Sketch(my_sarray)
  >>> sketch = my_sarray.summary()
  
  Typically, the SArray is a column of an SFrame:
  
  >>> my_sframe =  turicreate.SFrame({'column1': [1,2,3]})
  >>> sketch = turicreate.Sketch(my_sframe['column1'])
  >>> sketch = my_sframe['column1'].summary()
  
  The sketch computation is fast, with complexity approximately linear in the
  length of the SArray. After the Sketch is computed, all queryable functions
  are performed nearly instantly.
  
  A sketch can compute the following information depending on the dtype of the
  SArray:
  
  For numeric columns, the following information is provided exactly:
  
   - length (:func:`~turicreate.Sketch.size`)
   - number of missing Values (:func:`~turicreate.Sketch.num_missing`)
   - minimum  value (:func:`~turicreate.Sketch.min`)
   - maximum value (:func:`~turicreate.Sketch.max`)
   - mean (:func:`~turicreate.Sketch.mean`)
   - variance (:func:`~turicreate.Sketch.var`)
   - standard deviation (:func:`~turicreate.Sketch.std`)
  
  And the following information is provided approximately:
  
   - number of unique values (:func:`~turicreate.Sketch.num_unique`)
   - quantiles (:func:`~turicreate.Sketch.quantile`)
   - frequent items (:func:`~turicreate.Sketch.frequent_items`)
   - frequency count for any value (:func:`~turicreate.Sketch.frequency_count`)
  
  For non-numeric columns(str), the following information is provided exactly:
  
   - length (:func:`~turicreate.Sketch.size`)
   - number of missing values (:func:`~turicreate.Sketch.num_missing`)
  
  And the following information is provided approximately:
  
   - number of unique Values (:func:`~turicreate.Sketch.num_unique`)
   - frequent items (:func:`~turicreate.Sketch.frequent_items`)
   - frequency count of any value (:func:`~turicreate.Sketch.frequency_count`)
  
  For SArray of type list or array, there is a sub sketch for all sub elements.
  The sub sketch flattens all list/array values and then computes sketch
  summary over flattened values. Element sub sketch may be retrieved through:
  
   - element_summary(:func:`~turicreate.Sketch.element_summary`)
  
  For SArray of type dict, there are sub sketches for both dict key and value.
  The sub sketch may be retrieved through:
  
   - dict_key_summary(:func:`~turicreate.Sketch.dict_key_summary`)
   - dict_value_summary(:func:`~turicreate.Sketch.dict_value_summary`)
  
  For SArray of type dict, user can also pass in a list of dictionary keys to
  summary function, this would generate one sub sketch for each key.
  For example:
  
       >>> sa = turicreate.SArray([{'a':1, 'b':2}, {'a':3}])
       >>> sketch = sa.summary(sub_sketch_keys=["a", "b"])
  
  Then the sub summary may be retrieved by:
  
       >>> sketch.element_sub_sketch()
  
  or to get subset keys:
  
       >>> sketch.element_sub_sketch(["a"])
  
  Similarly, for SArray of type vector(array), user can also pass in a list of
  integers which is the index into the vector to get sub sketch
  For example:
  
       >>> sa = turicreate.SArray([[100,200,300,400,500], [100,200,300], [400,500]])
       >>> sketch = sa.summary(sub_sketch_keys=[1,3,5])
  
  Then the sub summary may be retrieved by:
  
       >>> sketch.element_sub_sketch()
  
  Or:
  
       >>> sketch.element_sub_sketch([1,3])
  
  for subset of keys
  
  Please see the individual function documentation for detail about each of
  these statistics.
  
  Parameters
  ----------
  array : SArray
      Array to generate sketch summary.
  
  background : boolean
    If True, the sketch construction will return immediately and the
    sketch will be constructed in the background. While this is going on,
    the sketch can be queried incrementally, but at a performance penalty.
    Defaults to False.
  
  References
  ----------
  - Wikipedia. `Streaming algorithms. <http://en.wikipedia.org/wiki/Streaming_algorithm>`_
  - Charikar, et al. (2002) `Finding frequent items in data streams.
    <https://www.cs.rutgers.edu/~farach/pubs/FrequentStream.pdf>`_
  - Cormode, G. and Muthukrishnan, S. (2004) `An Improved Data Stream Summary:
    The Count-Min Sketch and its Applications.
    <http://dimacs.rutgers.edu/~graham/pubs/papers/cm-latin.pdf>`_
class_docstr_tok: ["The","Sketch","object","contains","a","sketch","of","a","single","SArray","(","a","column","of","an","SFrame",")",".","Using","a","sketch","representation","of","an","SArray",",","many","approximate","and","exact","statistics","can","be","computed","very","quickly",".","To","construct","a","Sketch","object",",","the","following","methods","are","equivalent",":",">",">",">","my_sarray","=","turicreate.SArray","(","[","1,2,3,4,5","]",")",">",">",">","sketch","=","turicreate.Sketch","(","my_sarray",")",">",">",">","sketch","=","my_sarray.summary","(",")","Typically",",","the","SArray","is","a","column","of","an","SFrame",":",">",">",">","my_sframe","=","turicreate.SFrame","(","{","'column1","'",":","[","1,2,3","]","}",")",">",">",">","sketch","=","turicreate.Sketch","(","my_sframe","[","'column1","'","]",")",">",">",">","sketch","=","my_sframe","[","'column1","'","]",".summary","(",")","The","sketch","computation","is","fast",",","with","complexity","approximately","linear","in","the","length","of","the","SArray",".","After","the","Sketch","is","computed",",","all","queryable","functions","are","performed","nearly","instantly",".","A","sketch","can","compute","the","following","information","depending","on","the","dtype","of","the","SArray",":","For","numeric","columns",",","the","following","information","is","provided","exactly",":","-","length","(",":","func",":","`","~turicreate.Sketch.size","`",")","-","number","of","missing","Values","(",":","func",":","`","~turicreate.Sketch.num_missing","`",")","-","minimum","value","(",":","func",":","`","~turicreate.Sketch.min","`",")","-","maximum","value","(",":","func",":","`","~turicreate.Sketch.max","`",")","-","mean","(",":","func",":","`","~turicreate.Sketch.mean","`",")","-","variance","(",":","func",":","`","~turicreate.Sketch.var","`",")","-","standard","deviation","(",":","func",":","`","~turicreate.Sketch.std","`",")","And","the","following","information","is","provided","approximately",":","-","number","of","unique","values","(",":","func",":","`","~turicreate.Sketch.num_unique","`",")","-","quantiles","(",":","func",":","`","~turicreate.Sketch.quantile","`",")","-","frequent","items","(",":","func",":","`","~turicreate.Sketch.frequent_items","`",")","-","frequency","count","for","any","value","(",":","func",":","`","~turicreate.Sketch.frequency_count","`",")","For","non-numeric","columns","(","str",")",",","the","following","information","is","provided","exactly",":","-","length","(",":","func",":","`","~turicreate.Sketch.size","`",")","-","number","of","missing","values","(",":","func",":","`","~turicreate.Sketch.num_missing","`",")","And","the","following","information","is","provided","approximately",":","-","number","of","unique","Values","(",":","func",":","`","~turicreate.Sketch.num_unique","`",")","-","frequent","items","(",":","func",":","`","~turicreate.Sketch.frequent_items","`",")","-","frequency","count","of","any","value","(",":","func",":","`","~turicreate.Sketch.frequency_count","`",")","For","SArray","of","type","list","or","array",",","there","is","a","sub","sketch","for","all","sub","elements",".","The","sub","sketch","flattens","all","list\/array","values","and","then","computes","sketch","summary","over","flattened","values",".","Element","sub","sketch","may","be","retrieved","through",":","-","element_summary","(",":","func",":","`","~turicreate.Sketch.element_summary","`",")","For","SArray","of","type","dict",",","there","are","sub","sketches","for","both","dict","key","and","value",".","The","sub","sketch","may","be","retrieved","through",":","-","dict_key_summary","(",":","func",":","`","~turicreate.Sketch.dict_key_summary","`",")","-","dict_value_summary","(",":","func",":","`","~turicreate.Sketch.dict_value_summary","`",")","For","SArray","of","type","dict",",","user","can","also","pass","in","a","list","of","dictionary","keys","to","summary","function",",","this","would","generate","one","sub","sketch","for","each","key",".","For","example",":",">",">",">","sa","=","turicreate.SArray","(","[","{","'","a':1",",","'","b':2","}",",","{","'","a':3","}","]",")",">",">",">","sketch","=","sa.summary","(","sub_sketch_keys=","[","``","a","''",",","``","b","''","]",")","Then","the","sub","summary","may","be","retrieved","by",":",">",">",">","sketch.element_sub_sketch","(",")","or","to","get","subset","keys",":",">",">",">","sketch.element_sub_sketch","(","[","``","a","''","]",")","Similarly",",","for","SArray","of","type","vector","(","array",")",",","user","can","also","pass","in","a","list","of","integers","which","is","the","index","into","the","vector","to","get","sub","sketch","For","example",":",">",">",">","sa","=","turicreate.SArray","(","[","[","100,200,300,400,500","]",",","[","100,200,300","]",",","[","400,500","]","]",")",">",">",">","sketch","=","sa.summary","(","sub_sketch_keys=","[","1,3,5","]",")","Then","the","sub","summary","may","be","retrieved","by",":",">",">",">","sketch.element_sub_sketch","(",")","Or",":",">",">",">","sketch.element_sub_sketch","(","[","1,3","]",")","for","subset","of","keys","Please","see","the","individual","function","documentation","for","detail","about","each","of","these","statistics",".","Parameters","--","--","--","--","--","array",":","SArray","Array","to","generate","sketch","summary",".","background",":","boolean","If","True",",","the","sketch","construction","will","return","immediately","and","the","sketch","will","be","constructed","in","the","background",".","While","this","is","going","on",",","the","sketch","can","be","queried","incrementally",",","but","at","a","performance","penalty",".","Defaults","to","False",".","References","--","--","--","--","--","-","Wikipedia",".","`","Streaming","algorithms",".","<","http",":","\/\/en.wikipedia.org\/wiki\/Streaming_algorithm",">","`","_","-","Charikar",",","et","al",".","(","2002",")","`","Finding","frequent","items","in","data","streams",".","<","https",":","\/\/www.cs.rutgers.edu\/~farach\/pubs\/FrequentStream.pdf",">","`","_","-","Cormode",",","G.","and","Muthukrishnan",",","S.","(","2004",")","`","An","Improved","Data","Stream","Summary",":","The","Count-Min","Sketch","and","its","Applications",".","<","http",":","\/\/dimacs.rutgers.edu\/~graham\/pubs\/papers\/cm-latin.pdf",">","`","_"]
docstr: Returns the sketch summary for the element length. This is only valid for
  a sketch constructed SArray of type list/array/dict, raises Runtime
  exception otherwise.
  
  Examples
  --------
  >>> sa = turicreate.SArray([[j for j in range(i)] for i in range(1,1000)])
  >>> sa.summary().element_length_summary()
  +--------------------+---------------+----------+
  |        item        |     value     | is exact |
  +--------------------+---------------+----------+
  |       Length       |      999      |   Yes    |
  |        Min         |      1.0      |   Yes    |
  |        Max         |     999.0     |   Yes    |
  |        Mean        |     500.0     |   Yes    |
  |        Sum         |    499500.0   |   Yes    |
  |      Variance      | 83166.6666667 |   Yes    |
  | Standard Deviation | 288.386314978 |   Yes    |
  |  # Missing Values  |       0       |   Yes    |
  |  # unique values   |      992      |    No    |
  +--------------------+---------------+----------+
  Most frequent items:
  +-------+---+---+---+---+---+---+---+---+---+----+
  | value | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
  +-------+---+---+---+---+---+---+---+---+---+----+
  | count | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1  |
  +-------+---+---+---+---+---+---+---+---+---+----+
  Quantiles:
  +-----+------+------+-------+-------+-------+-------+-------+-------+
  |  0% |  1%  |  5%  |  25%  |  50%  |  75%  |  95%  |  99%  |  100% |
  +-----+------+------+-------+-------+-------+-------+-------+-------+
  | 1.0 | 10.0 | 50.0 | 250.0 | 500.0 | 750.0 | 950.0 | 990.0 | 999.0 |
  +-----+------+------+-------+-------+-------+-------+-------+-------+
  
  Returns
  -------
  out : Sketch
    An new sketch object regarding the element length of the current SArray
docstr_tok: ["Returns","the","sketch","summary","for","the","element","length",".","This","is","only","valid","for","a","sketch","constructed","SArray","of","type","list\/array\/dict",",","raises","Runtime","exception","otherwise",".","Examples","--","--","--","--",">",">",">","sa","=","turicreate.SArray","(","[","[","j","for","j","in","range","(","i",")","]","for","i","in","range","(","1,1000",")","]",")",">",">",">","sa.summary","(",")",".element_length_summary","(",")","+","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","+","|","item","|","value","|","is","exact","|","+","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","+","|","Length","|","999","|","Yes","|","|","Min","|","1.0","|","Yes","|","|","Max","|","999.0","|","Yes","|","|","Mean","|","500.0","|","Yes","|","|","Sum","|","499500.0","|","Yes","|","|","Variance","|","83166.6666667","|","Yes","|","|","Standard","Deviation","|","288.386314978","|","Yes","|","|","#","Missing","Values","|","0","|","Yes","|","|","#","unique","values","|","992","|","No","|","+","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","+","Most","frequent","items",":","+","--","--","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","--","+","|","value","|","1","|","2","|","3","|","4","|","5","|","6","|","7","|","8","|","9","|","10","|","+","--","--","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","--","+","|","count","|","1","|","1","|","1","|","1","|","1","|","1","|","1","|","1","|","1","|","1","|","+","--","--","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","-+","--","--","+","Quantiles",":","+","--","--","-+","--","--","--","+","--","--","--","+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","|","0","%","|","1","%","|","5","%","|","25","%","|","50","%","|","75","%","|","95","%","|","99","%","|","100","%","|","+","--","--","-+","--","--","--","+","--","--","--","+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","|","1.0","|","10.0","|","50.0","|","250.0","|","500.0","|","750.0","|","950.0","|","990.0","|","999.0","|","+","--","--","-+","--","--","--","+","--","--","--","+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","--","--","--","-+","Returns","--","--","--","-","out",":","Sketch","An","new","sketch","object","regarding","the","element","length","of","the","current","SArray"]
code: def element_length_summary(self):
      """
      Returns the sketch summary for the element length. This is only valid for
      a sketch constructed SArray of type list/array/dict, raises Runtime
      exception otherwise.
  
      Examples
      --------
      >>> sa = turicreate.SArray([[j for j in range(i)] for i in range(1,1000)])
      >>> sa.summary().element_length_summary()
      +--------------------+---------------+----------+
      |        item        |     value     | is exact |
      +--------------------+---------------+----------+
      |       Length       |      999      |   Yes    |
      |        Min         |      1.0      |   Yes    |
      |        Max         |     999.0     |   Yes    |
      |        Mean        |     500.0     |   Yes    |
      |        Sum         |    499500.0   |   Yes    |
      |      Variance      | 83166.6666667 |   Yes    |
      | Standard Deviation | 288.386314978 |   Yes    |
      |  # Missing Values  |       0       |   Yes    |
      |  # unique values   |      992      |    No    |
      +--------------------+---------------+----------+
      Most frequent items:
      +-------+---+---+---+---+---+---+---+---+---+----+
      | value | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
      +-------+---+---+---+---+---+---+---+---+---+----+
      | count | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1  |
      +-------+---+---+---+---+---+---+---+---+---+----+
      Quantiles:
      +-----+------+------+-------+-------+-------+-------+-------+-------+
      |  0% |  1%  |  5%  |  25%  |  50%  |  75%  |  95%  |  99%  |  100% |
      +-----+------+------+-------+-------+-------+-------+-------+-------+
      | 1.0 | 10.0 | 50.0 | 250.0 | 500.0 | 750.0 | 950.0 | 990.0 | 999.0 |
      +-----+------+------+-------+-------+-------+-------+-------+-------+
  
      Returns
      -------
      out : Sketch
        An new sketch object regarding the element length of the current SArray
      """
  
      with cython_context():
          return Sketch(_proxy=self.__proxy__.element_length_summary())
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from .._cython.cy_sketch import UnitySketchProxy
  from .._cython.context import debug_trace
  from .sarray import SArray
  from .sframe import SFrame
  import operator
  from math import sqrt
label_desc: Use image node_id 18 for calling the Sketch obj's underlying member method code with example usage: obj.element_length_summary() and returns: Sketch