inversion_ideas.base.WrappedArray#
- class inversion_ideas.base.WrappedArray(array)#
Wraps a Numpy array into a class.
Wraps a single Numpy array into a class to create custom hyperparameter classes.
- Parameters:
- array
array Array to be wrapped.
- array
Attributes
Transpose.
The data-type for the wrapped array.
Number of dimensions in the wrapped array.
Shape of the wrapped array.
Total number of elements in the wrapped array.
Methods
max([axis, out])Maximum value in the wrapped array along a given axis.
min([axis, out])Minimum value in the wrapped array along a given axis.
Transpose.
copy
Examples
Wrap an array using this class:
>>> import numpy as np >>> a = np.array([1., 2., 3., 4., 5.]) >>> array_wrapped = WrappedArray(a) >>> array_wrapped WrappedArray([1., 2., 3., 4., 5.])
We can operate with this
array_wrappedas with any other array:>>> array_wrapped * 2 array([ 2., 4., 6., 8., 10.]) >>> array_wrapped @ array_wrapped np.float64(55.0)
We can also pass it to Numpy functions:
>>> np.mean(array_wrapped) np.float64(3.0) >>> np.abs(array_wrapped) array([1., 2., 3., 4., 5.])
Attributes#
- WrappedArray.dtype#
The data-type for the wrapped array.
Methods#
Methods documentation
- WrappedArray.copy()#
- WrappedArray.max(axis=None, out=None, **kwargs)#
Maximum value in the wrapped array along a given axis.
See also
numpy.maxupstream function
- WrappedArray.min(axis=None, out=None, **kwargs)#
Minimum value in the wrapped array along a given axis.
See also
numpy.minupstream function