Base.unflatten¶
- Base.unflatten(dataDimensions, order='point', *, useLog=None)¶
Adjust a single point or feature to contain multiple points.
The flat object is reshaped to match the dimensions of
dataDimensions
.order
determines whether point or feature vectors are created from the data. ProvideddataDimensions
of (m, n), the first n values become the first point whenorder='point'
or the first m values become the first feature whenorder='feature'
. For higher dimension data, ‘point’ is the only acceptedorder
. If pointNames or featureNames match the format established inflatten
, “ptName | ftName”, and they align eith thedataDimensions
, point and feature names will be unflattened as well, otherwise the result will not have pointNames or featureNames. This is an inplace operation.- Parameters:
dataDimensions (tuple, list) – The dimensions of the unflattend object.
order (str) – Either ‘point’ or ‘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.
See also
Examples
Unflatten a point in point order with default names.
>>> lst = [[1, 2, 3, 4, 5, 6, 7, 8, 9]] >>> X = nimble.data(lst) >>> X.unflatten((3, 3)) >>> X <Matrix 3pt x 3ft 0 1 2 ┌──────── 0 │ 1 2 3 1 │ 4 5 6 2 │ 7 8 9 >
Unflatten a point in feature order with default names.
>>> lst = [[1, 2, 3, 4, 5, 6, 7, 8, 9]] >>> X = nimble.data(lst) >>> X.unflatten((3, 3), order='feature') >>> X <Matrix 3pt x 3ft 0 1 2 ┌──────── 0 │ 1 4 7 1 │ 2 5 8 2 │ 3 6 9 >
Unflatten a feature in feature order with default names.
>>> lst = [[1], [4], [7], [2], [5], [8], [3], [6], [9]] >>> X = nimble.data(lst) >>> X.unflatten((3, 3), order='feature') >>> X <Matrix 3pt x 3ft 0 1 2 ┌──────── 0 │ 1 2 3 1 │ 4 5 6 2 │ 7 8 9 >
Unflatten a feature in point order with default names.
>>> lst = [[1], [4], [7], [2], [5], [8], [3], [6], [9]] >>> X = nimble.data(lst) >>> X.unflatten((3, 3), order='point') >>> X <Matrix 3pt x 3ft 0 1 2 ┌──────── 0 │ 1 4 7 1 │ 2 5 8 2 │ 3 6 9 >
Unflatten a point with names that can be unflattened.
>>> lst = [[1, 2, 3, 4, 5, 6, 7, 8, 9]] >>> ftNames = ['1 | a', '1 | b', '1 | c', ... '4 | a', '4 | b', '4 | c', ... '7 | a', '7 | b', '7 | c'] >>> X = nimble.data(lst, featureNames=ftNames) >>> X.unflatten((3, 3)) >>> X <Matrix 3pt x 3ft a b c ┌──────── 1 │ 1 2 3 4 │ 4 5 6 7 │ 7 8 9 >
Keywords: reshape, shape, dimensions, 2d, 3d, two dimensional, three dimensional, multi dimensional