MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / set_reference

Method set_reference

python-package/lightgbmmt/basic.py:1325–1349  ·  view source on GitHub ↗

Set reference Dataset. Parameters ---------- reference : Dataset Reference that is used as a template to construct the current Dataset. Returns ------- self : Dataset Dataset with set reference.

(self, reference)

Source from the content-addressed store, hash-verified

1323 "set free_raw_data=False when construct Dataset to avoid this.")
1324
1325 def set_reference(self, reference):
1326 """Set reference Dataset.
1327
1328 Parameters
1329 ----------
1330 reference : Dataset
1331 Reference that is used as a template to construct the current Dataset.
1332
1333 Returns
1334 -------
1335 self : Dataset
1336 Dataset with set reference.
1337 """
1338 self.set_categorical_feature(reference.categorical_feature) \
1339 .set_feature_name(reference.feature_name) \
1340 ._set_predictor(reference._predictor)
1341 # we're done if self and reference share a common upstrem reference
1342 if self.get_ref_chain().intersection(reference.get_ref_chain()):
1343 return self
1344 if self.data is not None:
1345 self.reference = reference
1346 return self._free_handle()
1347 else:
1348 raise LightGBMError("Cannot set reference after freed raw data, "
1349 "set free_raw_data=False when construct Dataset to avoid this.")
1350
1351 def set_feature_name(self, feature_name):
1352 """Set feature name.

Callers 1

trainFunction · 0.80

Calls 6

get_ref_chainMethod · 0.95
_free_handleMethod · 0.95
LightGBMErrorClass · 0.85
_set_predictorMethod · 0.80
set_feature_nameMethod · 0.80

Tested by

no test coverage detected