Get xgboost type parameters.
974763
def get_xgb_params(self):
        """"""
        xgb_params = self.get_params()

        xgb_params['silent'] = 1 if self.silent else 0

        if self.nthread <= 0:
            xgb_params.pop('nthread', None)
        return xgb_params
46486
def get_list_qtype(array):
    '''
    '''
    if not isinstance(array, numpy.ndarray):
        raise ValueError('array parameter is expected to be of type: numpy.ndarray, got: %s' % type(array))

    if isinstance(array, QList):
        return -abs(array.meta.qtype)

    qtype = None

    if str(array.dtype) in ('|S1', '<U1', '>U1', '|U1') :
        qtype = QCHAR

    if qtype is None:
        qtype = Q_TYPE.get(array.dtype.type, None)

    if qtype is None and array.dtype.type in (numpy.datetime64, numpy.timedelta64):
        qtype = TEMPORAL_PY_TYPE.get(str(array.dtype), None)

    if qtype is None:
        # determinate type based on first element of the numpy array
        qtype = Q_TYPE.get(type(array[0]), QGENERAL_LIST)

    return qtype
1272505
def types(cls, **kwargs):
    """"""
    named = {name: factory(Arguments._fields.index(name), name)
             for name, factory in six.iteritems(kwargs)}
    return cls(**named)
736768
def _get_type(stype):
    ''' 
    '''
    stype = stype.lower()
    if stype == 'str':
        return str
    if stype == 'unicode':
        if PY2:
            return unicode
        else:
            return str
    if stype == 'int':
        return int
    if stype == 'float':
        return float
    if stype == 'bool':
        return bool
    raise AppConfigValueException('Unsuported type given: {0}'.format(stype))
561260
def get_xgboost_json(model):
    
    fnames = model.feature_names
    model.feature_names = None
    json_trees = model.get_dump(with_stats=True, dump_format="json")
    model.feature_names = fnames

    # this fixes a bug where XGBoost can return invalid JSON
    json_trees = [t.replace(": inf,", ": 1000000000000.0,") for t in json_trees]
    json_trees = [t.replace(": -inf,", ": -1000000000000.0,") for t in json_trees]

    return json_trees
1153332
def _parse_xgboost_simple_model(scope, model, inputs):
    '''
    
    '''
    this_operator = scope.declare_local_operator(_get_xgboost_operator_name(type(model)), model)
    this_operator.inputs = inputs

    if type(model) in xgboost_classifier_list:
        # For classifiers, we may have two outputs, one for label and the other one for probabilities of all classes.
        # Notice that their types here are not necessarily correct and they will be fixed in shape inference phase
        label_variable = scope.declare_local_variable('label', FloatTensorType())
        probability_map_variable = scope.declare_local_variable('probabilities', FloatTensorType())
        this_operator.outputs.append(label_variable)
        this_operator.outputs.append(probability_map_variable)
    else:
        # We assume that all scikit-learn operator can only produce a single float tensor.
        variable = scope.declare_local_variable('variable', FloatTensorType())
        this_operator.outputs.append(variable)
    return this_operator.outputs
326418
def getLCDType(self):
    """"""
    command = '$GE'
    settings = self.sendCommand(command)
    flags = int(settings[2], 16)
    if flags & 0x0100:
      lcdtype = 'monochrome'
    else:
      lcdtype = 'rgb'
    return lcdtype
567454
def get_x_inds(self, *dynac_type):
        
        return [i for i, x in enumerate(self.lattice) for y in dynac_type if dynac_from_ele(x) == y]
172006
def _getparams_rtype(cls, function):
        
        try:
            args, vargs, kwargs, default = getargspec(function)

        except TypeError:
            args, vargs, kwargs, default = (), (), (), ()

        indexlen = len(args) - (0 if default is None else len(default))

        params = OrderedDict()

        for index, arg in enumerate(args):

            pkwargs = {
                'name': arg,
                'mandatory': True
            }  # param kwargs

            if index >= indexlen:  # has default value
                value = default[index - indexlen]
                pkwargs['default'] = value
                pkwargs['ref'] = None if value is None else data2schema(value)
                pkwargs['mandatory'] = False

            params[arg] = pkwargs

        rtype = None

        # parse docstring
        if function.__doc__ is not None and not isbuiltin(function):

            scope = get_function_globals(function)

            for match in cls._REC.findall(function.__doc__):
                if rtype is None:
                    rrtype = match[4].strip() or None

                    if rrtype:

                        rtypes = rrtype.split(',')

                        schemas = []
                        for rtype_ in rtypes:

                            rtype_ = rtype_.strip()
                            islist = False

                            try:
                                lkrtype = lookup(rtype_, scope=scope)

                            except ImportError:
                                islist = True

                                try:
                                    if rtype_[-1] == 's':
                                        lkrtype = lookup(
                                            rtype_[:-1], scope=scope
                                        )

                                    elif rtype_.startswith('list of '):
                                        lkrtype = lookup(
                                            rtype_[8:], scope=scope
                                        )

                                    else:
                                        raise

                                except ImportError:
                                    msg = 'rtype "{0}" ({1}) from {2} not found.'
                                    raise ImportError(
                                        msg.format(rtype_, rrtype, function)
                                    )

                            try:
                                schemacls = datatype2schemacls(lkrtype)

                            except TypeError:
                                schemacls = ParamTypeSchema(type=lkrtype)

                            rschema = schemacls()

                            if islist:
                                rschema = ArraySchema(itemtype=rschema)

                            schemas.append(rschema)

                        if len(rtypes) > 1:
                            rtype = OneOfSchema(schemas=schemas, nullable=True)

                        else:
                            rtype = schemas[0]

                        continue

                pname = (match[1] or match[2]).strip()

                if pname and pname in params:

                    ptype = (match[0] or match[3]).strip()

                    ptypes = ptype.split(',')

                    schemas = []

                    for ptype in ptypes:

                        ptype = ptype.strip()

                        islist = False

                        try:
                            lkptype = lookup(ptype, scope=scope)

                        except ImportError:
                            islist = True

                            try:
                                if ptype[-1] == 's':
                                    lkptype = lookup(ptype[:-1], scope=scope)

                                elif ptype.startswith('list of '):
                                    lkptype = lookup(ptype[8:], scope=scope)

                                else:
                                    raise

                            except ImportError:

                                msg = 'Error on ptype "{0}" ({1}) from {2} not found.'
                                raise ImportError(
                                    msg.format(pname, ptype, function)
                                )

                        try:
                            schemacls = datatype2schemacls(lkptype)

                        except TypeError:
                            schemacls = ParamTypeSchema(type=lkptype)

                        pschema = schemacls()

                        if islist:
                            pschema = ArraySchema(itemtype=pschema)

                        schemas.append(pschema)

                    if len(ptypes) > 1:
                        pschema = OneOfSchema(schemas=schemas, nullable=True)

                    else:
                        pschema = schemas[0]

                    params[pname]['ref'] = pschema

        return params, rtype, vargs, kwargs
761524
def get_x_objs(self, *dynac_type):
        
        return [i for i in self.lattice for y in dynac_type if dynac_from_ele(i) == y]
786267
def types(self) -> GraphQLTypeList:
        """"""
        try:
            types = resolve_thunk(self._types)
        except GraphQLError:
            raise
        except Exception as error:
            raise TypeError(f"{self.name} types cannot be resolved: {error}")
        if types is None:
            types = []
        if not isinstance(types, (list, tuple)):
            raise TypeError(
                f"{self.name} types must be a list/tuple"
                " or a function which returns a list/tuple."
            )
        if not all(isinstance(value, GraphQLObjectType) for value in types):
            raise TypeError(f"{self.name} types must be GraphQLObjectType objects.")
        return types[:]
693847
def get
      gtype = self[:gtype]
      fundamental = ::GObject::g_type_fundamental gtype
      result = nil

      case gtype
      when GBOOL_TYPE
        result = ::GObject::g_value_get_boolean(self) != 0 ? true : false

      when GINT_TYPE
        result = ::GObject::g_value_get_int self

      when GUINT64_TYPE
        result = ::GObject::g_value_get_uint64 self

      when GDOUBLE_TYPE
        result = ::GObject::g_value_get_double self

      when GSTR_TYPE
        result = ::GObject::g_value_get_string self

      when Vips::REFSTR_TYPE
        len = Vips::SizeStruct.new
        result = ::Vips::vips_value_get_ref_string self, len

      when Vips::ARRAY_INT_TYPE
        len = Vips::IntStruct.new
        array = Vips::vips_value_get_array_int self, len
        result = array.get_array_of_int32 0, len[:value]

      when Vips::ARRAY_DOUBLE_TYPE
        len = Vips::IntStruct.new
        array = Vips::vips_value_get_array_double self, len
        result = array.get_array_of_double 0, len[:value]

      when Vips::ARRAY_IMAGE_TYPE
        len = Vips::IntStruct.new
        array = Vips::vips_value_get_array_image self, len
        result = array.get_array_of_pointer 0, len[:value]
        result.map! do |pointer|
          ::GObject::g_object_ref pointer
          Vips::Image.new pointer
        end

      when Vips::BLOB_TYPE
        len = Vips::SizeStruct.new
        array = Vips::vips_value_get_blob self, len
        result = array.get_bytes 0, len[:value]

      else
        case fundamental
        when GFLAGS_TYPE
          result = ::GObject::g_value_get_flags self

        when GENUM_TYPE
          enum_value = ::GObject::g_value_get_enum(self)
          result = GValue.to_nick self[:gtype], enum_value

        when GOBJECT_TYPE
          obj = ::GObject::g_value_get_object self
          # g_value_get_object() does not add a ref ... we need to add
          # one to match the unref in gobject release
          ::GObject::g_object_ref obj
          result = Vips::Image.new obj

        else
          raise Vips::Error, "unimplemented gtype for get: " +
              "#{::GObject::g_type_name gtype} (#{gtype})"

        end
      end

      # GLib::logger.debug("GObject::GValue.get") {
      #     "result = #{result.inspect[0..50]}"
      # }

      return result

    end
728292
def _get_param_names(cls):
        """"""
        # fetch the constructor or the original constructor before
        # deprecation wrapping if any
        init = getattr(cls.__init__, 'deprecated_original', cls.__init__)
        if init is object.__init__:
            # No explicit constructor to introspect
            return []

        # introspect the constructor arguments to find the model parameters
        # to represent
        init_signature = signature(init)
        # Consider the constructor parameters excluding 'self'
        parameters = [p for p in init_signature.parameters.values()
                      if p.name != 'self' and p.kind != p.VAR_KEYWORD]
        # Extract and sort argument names excluding 'self'
        parameters = set([p.name for p in parameters])

        # recurse
        for superclass in cls.__bases__:
            try:
                parameters.update(superclass._get_param_names())
            except AttributeError:
                # object and pygsp.graphs.Graph don't have this method
                pass

        return parameters
69451
def get_type(self):
        
        if self.total_size() == 0:
            return CONSTANT_TYPE_NULL
        return unpack_from(FMT_BE_INT, self._buffer, TYPE_OFFSET)[0]
1182028
def _get_x(self, kwargs):
        '''
        
        '''
        if 'x' in kwargs:
            return round(float(kwargs['x']), 6)
        elif self._element_x in kwargs:
            return round(float(kwargs[self._element_x]), 6)
        elif self._type == 3 and self._element_1mx in kwargs:
            return round(1. - float(kwargs[self._element_1mx]), 6)
        else:
            raise TypeError()
368847
def get_parameters(self, graph=None):
        
        g = graph if graph is not None else self.tf_graph

        with g.as_default():
            with tf.Session() as self.tf_session:
                self.tf_saver.restore(self.tf_session, self.model_path)

                return {
                    'W': self.W.eval(),
                    'bh_': self.bh_.eval(),
                    'bv_': self.bv_.eval()
                }
1051975
def _get_type(cls, ptr):
        """"""

        # fall back to the base class if unknown
        return cls.__types.get(lib.g_base_info_get_type(ptr), cls)