class_docstr: Serialize results to JSON in a numpy-compatible way.
  
  This class is used when serializing results, particularly the input label
  values if the input has int-valued labels.  Numpy int64 objects can't
  be serialized by the json module, so we must convert them to int objects.
  
  A related issue where this was adapted from:
  https://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp-arange5-fail-while-json-dumpsnp-arange5-tolis
class_docstr_tok: ["Serialize","results","to","JSON","in","a","numpy-compatible","way",".","This","class","is","used","when","serializing","results",",","particularly","the","input","label","values","if","the","input","has","int-valued","labels",".","Numpy","int64","objects","can't","be","serialized","by","the","json","module",",","so","we","must","convert","them","to","int","objects",".","A","related","issue","where","this","was","adapted","from",":","https",":","\/\/stackoverflow.com\/questions\/11561932\/why-does-json-dumpslistnp-arange5-fail-while-json-dumpsnp-arange5-tolis"]
docstr: Encode given object.
docstr_tok: ["Encode","given","object","."]
code: def default(self, obj):
      """Encode given object."""
      if isinstance(obj, (np.int32, np.int64)):
          return int(obj)
      elif isinstance(obj, np.ndarray):
          return obj.tolist()
      return json.JSONEncoder.default(self, obj)
  
imports: import json
  import math
  import re
  from collections import defaultdict
  from typing import Any, Dict, List, Union
  import numpy
  from sklearn.base import BaseEstimator
  from sklearn.pipeline import Pipeline
  from tabulate import tabulate
  from skll.types import EvaluateTaskResults, LabelType
  from skll.utils.logging import get_skll_logger
label_desc: Use image node_id 1 for calling the NumpyTypeEncoder obj's underlying member method code with example usage: obj.default(obj) and returns: json, int, obj