queso_cluster.atoms.base#
- file:
queso_cluster/atoms/base.py
- lang:
python
- synopsis:
- author:
Sarah Riley <academic@sriley.dev>
Functions#
|
Calculates the set of k decisions with a convergence threshold |
|
|
|
Function to concatenate several channels of data into one array for clustering |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Numba accelerated gradient |
|
Numba accelerated histogram function |
|
Rotates an array |
|
|
|
Heuristic k-means++. |
|
k-means++ initialization |
Module Contents#
- calcOptimization(k, data, decision, threshold=1e-06)[source]#
Calculates the set of k decisions with a convergence threshold
- Parameters:
k (int) – The number of groups
data (ndarray) – The data to be clustered
decision (ndarray) – The previous iteration’s decisions
threshold (float, optional) – The convergence threshold
- Raises:
ConvergenceError – If the convergence criteria cannot be evaulated or if the convergence criterion is not met after
covergeLimit- Returns:
decision (ndarray) – The current iteration’s representative profiles
data_label (ndarray) – The labels for the data
- concatSpectra(dataSquareLst)[source]#
Function to concatenate several channels of data into one array for clustering
- Parameters:
dataSquareLst (dask.array) – dask arrays containing spectral data to be concatenated
- Returns:
Concatenated spectral profiles
- Return type:
dask.array
- numba_histogram(a, bins, lim)[source]#
Numba accelerated histogram function
- Parameters:
a (int) – detail
bins (int) – the number of bins in the histogram
lim (ndarray) – the top and bottom of the histogram
- Returns:
hist (ndarray) – the histogram
bin_edges (ndarray) – 1D array of the bin edges
- rotateArray(image, turns)[source]#
Rotates an array
- Parameters:
image (ndarray) – 2D array to be rotated
turns (int) – Number of pi/2 turns to rotate
- Returns:
Rotated array
- Return type:
ndarray
- startMax(data, k, decisions)[source]#
Heuristic k-means++. Rather than selecting from a distribution around the furtherest datapoint, this initialization simply selects the furtherest datapoint as the next representative
- Parameters:
data (ndarray) – data pool for finding the initial representative profiles
k (int) – The number of clusters
decisions (ndarray) – Array containing the initial, randomly selected representative profile and empty slots for remaining profiles
- Returns:
decisions – Array containing a full set of representative profiles
- Return type:
ndarray
- startPlusPlus(data, k, decisions)[source]#
k-means++ initialization
- Parameters:
data (ndarray) – data pool for finding the initial representative profiles
k (int) – The number of clusters
decisions (ndarray) – Array containing the initial, randomly selected representative profile and empty slots for remaining profiles
- Returns:
decisions – Array containing a full set of representative profiles
- Return type:
ndarray