class_docstr: Implements common methods among tree models:
  - BoostedTreesClassifier
  - BoostedTreesRegression
  - RandomForestClassifier
  - RandomForestRegression
  - DecisionTreeClassifier
  - DecisionTreeRegression
class_docstr_tok: ["Implements","common","methods","among","tree","models",":","-","BoostedTreesClassifier","-","BoostedTreesRegression","-","RandomForestClassifier","-","RandomForestRegression","-","DecisionTreeClassifier","-","DecisionTreeRegression"]
docstr: Dump the models into a list of strings. Each
  string is a text representation of a tree.
  
  Parameters
  ----------
  with_stats : bool
      If true, include node statistics in the output.
  
  Returns
  -------
  out : SFrame
      A table with two columns: feature, count,
      ordered by 'count' in descending order.
docstr_tok: ["Dump","the","models","into","a","list","of","strings",".","Each","string","is","a","text","representation","of","a","tree",".","Parameters","--","--","--","--","--","with_stats",":","bool","If","true",",","include","node","statistics","in","the","output",".","Returns","--","--","--","-","out",":","SFrame","A","table","with","two","columns",":","feature",",","count",",","ordered","by","'count","'","in","descending","order","."]
code: def _dump_to_json(self, with_stats):
      """
      Dump the models into a list of strings. Each
      string is a text representation of a tree.
  
      Parameters
      ----------
      with_stats : bool
          If true, include node statistics in the output.
  
      Returns
      -------
      out : SFrame
          A table with two columns: feature, count,
          ordered by 'count' in descending order.
      """
      import json
  
      trees_json_str = tc.extensions._xgboost_dump_model(
          self.__proxy__, with_stats=with_stats, format="json"
      )
      trees_json = [json.loads(x) for x in trees_json_str]
  
      # To avoid lose precision when using libjson, _dump_model with json format encode
      # numerical values in hexadecimal (little endian).
      # Now we need to convert them back to floats, using unpack. '<f' means single precision float
      # in little endian
      import struct
      import sys
  
      def hexadecimal_to_float(s):
          if sys.version_info[0] >= 3:
              return struct.unpack("<f", bytes.fromhex(s))[
                  0
              ]  # unpack always return a tuple
          else:
              return struct.unpack("<f", s.decode("hex"))[
                  0
              ]  # unpack always return a tuple
  
      for d in trees_json:
          nodes = d["vertices"]
          for n in nodes:
              if "value_hexadecimal" in n:
                  n["value"] = hexadecimal_to_float(
                      n["value_hexadecimal"]
                  )
      return trees_json
  
file_path: turicreate/src/python/turicreate/toolkits/_tree_model_mixin.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  from turicreate.toolkits._internal_utils import _raise_error_if_not_sframe
  from turicreate.toolkits._supervised_learning import select_default_missing_value_policy
  from turicreate.toolkits import _coreml_utils
label_desc: Use image node_id 5 for calling the TreeModelMixin obj's underlying member method code with example usage: obj._dump_to_json(with_stats) and returns: trees_json, struct, struct