Features.repeat¶
- Features.repeat(totalCopies, copyFeatureByFeature, *, useLog=None)¶
Create an object using copies of this object’s features.
Copies of this object will be stacked horizontally. The returned object will have the same number of points as this object and the number of features will be equal to the number of features in this object times
totalCopies
. If this object contains featureNames, each feature name will have “_#” appended, where # is the number of the copy made.- Parameters:
totalCopies (int) – The number of times a copy of the data in this object will be present in the returned object.
copyFeatureByFeature (bool) – When False, copies are made as if iterating through the features in this object
totalCopies
times. When True, copies are made as if the object is only iterated once, makingtotalCopies
copies of each feature before iterating to the next feature.useLog (bool, None) – Local control for whether to send object creation to the logger. If None (default), use the value as specified in the “logger” “enabledByDefault” configuration option. If True, send to the logger regardless of the global option. If False, do NOT send to the logger, regardless of the global option.
- Returns:
nimble Base object – Object containing the copied data.
Examples
Single feature
>>> X = nimble.data([[1], [2], [3]]) >>> X.features.setNames(['a']) >>> X.features.repeat(totalCopies=3, ... copyFeatureByFeature=False) <Matrix 3pt x 3ft a_1 a_2 a_3 ┌────────────── 0 │ 1 1 1 1 │ 2 2 2 2 │ 3 3 3 >
Two-dimensional, copyFeatureByFeature is False
>>> X = nimble.data([[1, 2], [3, 4], [5, 6]]) >>> X.features.setNames(['a', 'b']) >>> X.features.repeat(totalCopies=2, ... copyFeatureByFeature=False) <Matrix 3pt x 4ft a_1 b_1 a_2 b_2 ┌─────────────────── 0 │ 1 2 1 2 1 │ 3 4 3 4 2 │ 5 6 5 6 >
Two-dimensional, copyFeatureByFeature is True
>>> X = nimble.data([[1, 2], [3, 4], [5, 6]]) >>> X.features.setNames(['a', 'b']) >>> X.features.repeat(totalCopies=2, ... copyFeatureByFeature=True) <Matrix 3pt x 4ft a_1 a_2 b_1 b_2 ┌─────────────────── 0 │ 1 1 2 2 1 │ 3 3 4 4 2 │ 5 5 6 6 >
Keywords: stack, horizontal, duplicate, replicate, hstack