dasf.feature_extraction.histogram
Histogram module.
Classes
Operator to extract the histogram of a data. |
Module Contents
- class dasf.feature_extraction.histogram.Histogram(bins=None, range=None, normed=False, weights=None, density=None, *args, **kwargs)[source]
Bases:
dasf.transforms.base.TargeteredTransform
,dasf.transforms.base.Transform
Operator to extract the histogram of a data.
Parameters
- binsOptional[int]
Number of bins (the default is None).
- rangetuple
2-element tuple with the lower and upper range of the bins. If not provided, range is simply (X.min(), X.max()) (the default is None).
- normedbool
If the historgram must be normalized (the default is False).
- weightstype
An array of weights, of the same shape as X. Each value in a only contributes its associated weight towards the bin count (the default is None).
- densitytype
If False, the result will contain the number of samples in each bin. If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1 (the default is None).
Attributes
bins range normed weights density
Generic constructor of the class Histogram.
- _bins
- _range
- _normed
- _weights
- _density
- _lazy_transform_generic(X)[source]
Compute the histogram of a dataset using Dask.
Parameters
- Xarray_like
Input data. The histogram is computed over the flattened array.
Returns
- histarray
The values of the histogram. See density and weights for a description of the possible semantics. If weights are given,
hist.dtype
will be taken from weights.- bin_edgesarray of dtype float
Return the bin edges
(length(hist)+1)
.
- _transform_generic(X, xp)[source]
Compute the histogram of a dataset using local libraries.
Parameters
- Xarray_like
Input data. The histogram is computed over the flattened array.
Returns
- histarray
The values of the histogram. See density and weights for a description of the possible semantics. If weights are given,
hist.dtype
will be taken from weights.- bin_edgesarray of dtype float
Return the bin edges
(length(hist)+1)
.
- _lazy_transform_cpu(X)[source]
Compute the histogram of a dataset using Dask with CPUs only.
Parameters
- Xarray_like
Input data. The histogram is computed over the flattened array.
Returns
- histarray
The values of the histogram. See density and weights for a description of the possible semantics. If weights are given,
hist.dtype
will be taken from weights.- bin_edgesarray of dtype float
Return the bin edges
(length(hist)+1)
.
- _lazy_transform_gpu(X, **kwargs)[source]
Compute the histogram of a dataset using Dask with GPUs only.
Parameters
- Xarray_like
Input data. The histogram is computed over the flattened array.
Returns
- histarray
The values of the histogram. See density and weights for a description of the possible semantics. If weights are given,
hist.dtype
will be taken from weights.- bin_edgesarray of dtype float
Return the bin edges
(length(hist)+1)
.
- _transform_cpu(X, **kwargs)[source]
Compute the histogram of a dataset using CPU only.
Parameters
- Xarray_like
Input data. The histogram is computed over the flattened array.
Returns
- histarray
The values of the histogram. See density and weights for a description of the possible semantics. If weights are given,
hist.dtype
will be taken from weights.- bin_edgesarray of dtype float
Return the bin edges
(length(hist)+1)
.
- _transform_gpu(X, **kwargs)[source]
Compute the histogram of a dataset using GPU only.
Parameters
- Xarray_like
Input data. The histogram is computed over the flattened array.
Returns
- histarray
The values of the histogram. See density and weights for a description of the possible semantics. If weights are given,
hist.dtype
will be taken from weights.- bin_edgesarray of dtype float
Return the bin edges
(length(hist)+1)
.
- Parameters:
bins (int)
range (tuple)
normed (bool)