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

Method get_data

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

Get the raw data of the Dataset. Returns ------- data : string, numpy array, pandas DataFrame, H2O DataTable's Frame, scipy.sparse, list of numpy arrays or None Raw data used in the Dataset construction.

(self)

Source from the content-addressed store, hash-verified

1516 return self.init_score
1517
1518 def get_data(self):
1519 """Get the raw data of the Dataset.
1520
1521 Returns
1522 -------
1523 data : string, numpy array, pandas DataFrame, H2O DataTable's Frame, scipy.sparse, list of numpy arrays or None
1524 Raw data used in the Dataset construction.
1525 """
1526 if self.handle is None:
1527 raise Exception("Cannot get data before construct Dataset")
1528 if self.need_slice and self.used_indices is not None and self.reference is not None:
1529 self.data = self.reference.data
1530 if self.data is not None:
1531 if isinstance(self.data, np.ndarray) or scipy.sparse.issparse(self.data):
1532 self.data = self.data[self.used_indices, :]
1533 elif isinstance(self.data, DataFrame):
1534 self.data = self.data.iloc[self.used_indices].copy()
1535 elif isinstance(self.data, DataTable):
1536 self.data = self.data[self.used_indices, :]
1537 else:
1538 warnings.warn("Cannot subset {} type of raw data.\n"
1539 "Returning original raw data".format(type(self.data).__name__))
1540 self.need_slice = False
1541 if self.data is None:
1542 raise LightGBMError("Cannot call `get_data` after freed raw data, "
1543 "set free_raw_data=False when construct Dataset to avoid this.")
1544 return self.data
1545
1546 def get_group(self):
1547 """Get the group of the Dataset.

Callers 3

constructMethod · 0.95
test_init_with_subsetMethod · 0.95
preprocess_dataMethod · 0.80

Calls 3

typeEnum · 0.85
LightGBMErrorClass · 0.85
formatMethod · 0.80

Tested by 2

test_init_with_subsetMethod · 0.76
preprocess_dataMethod · 0.64