MCPcopy Create free account
hub / github.com/catboost/catboost / _check_weight_shape

Method _check_weight_shape

catboost/python-package/catboost/core.py:1024–1033  ·  view source on GitHub ↗

Check weight length.

(self, weight, samples_count)

Source from the content-addressed store, hash-verified

1022 raise CatBoostError("Invalid weight type={}: must be array like.".format(type(weight)))
1023
1024 def _check_weight_shape(self, weight, samples_count):
1025 """
1026 Check weight length.
1027 """
1028 if len(weight) != samples_count:
1029 raise CatBoostError("Length of weight={} and length of data={} are different.".format(len(weight), samples_count))
1030 if not isinstance(weight[0], (INTEGER_TYPES, FLOAT_TYPES)):
1031 raise CatBoostError(
1032 "Invalid weight value type={}: must be 1 dimensional data with elements of an integer or a floating-point type.".format(type(weight[0]))
1033 )
1034
1035 def _check_group_id_type(self, group_id):
1036 """

Callers 3

set_weightMethod · 0.95
set_pairs_weightMethod · 0.95
_initMethod · 0.95

Calls 5

lenFunction · 0.85
isinstanceFunction · 0.85
CatBoostErrorClass · 0.50
typeClass · 0.50
formatMethod · 0.45

Tested by

no test coverage detected