ECOCPAK v0.9
Data Structures | Functions
Op_kmeans

Data Structures

class  ecocpak::op_kmeans

Functions

template<typename eT >
static eT ecocpak::op_kmeans::compute_distance (const subview_row< eT > &sample_in, const subview_row< eT > &centroid_in)
template<typename eT >
static void ecocpak::op_kmeans::compute_distance (Row< eT > &dist_out, u32 &winner, const Mat< eT > &centroids_in, const subview_row< eT > &sample_in)
template<typename eT >
static void ecocpak::op_kmeans::init_centroids (Mat< eT > &centroids_out, const Mat< eT > &samples_in, const u32 k)
 Initialize centroids.
template<typename eT >
static void ecocpak::op_kmeans::direct_kmeans (Col< u32 > &indices_out, Col< u32 > &ranks, Mat< eT > &centroids_out, const Mat< eT > &in, const u32 k, const eT lr)
 K-means clustering.
template<typename eT >
static eT op_kmeans::compute_distance (const subview_row< eT > &sample_in, const subview_row< eT > &centroid_in)
template<typename eT >
static void op_kmeans::compute_distance (Row< eT > &dist_out, u32 &winner, const Mat< eT > &centroids_in, const subview_row< eT > &sample_in)
template<typename eT >
static void op_kmeans::init_centroids (Mat< eT > &centroids_out, const Mat< eT > &samples_in, const u32 k)
 Initialize centroids.
template<typename eT >
static void op_kmeans::direct_kmeans (Col< u32 > &indices_out, Col< u32 > &ranks, Mat< eT > &centroids_out, const Mat< eT > &in, const u32 k, const eT lr)
 K-means clustering.

Function Documentation

template<typename eT >
eT op_kmeans::compute_distance ( const subview_row< eT > &  sample_in,
const subview_row< eT > &  centroid_in 
) [inline, static]
  • Calculate distance between one sample and one centroid (returns a scalar).
  • Input Arguments:
    • sample_in : Subview row vector which represents one sample.
    • centroid_in : Subview row vector which represents the centroid.
  • Output Argument:
    • Scalar which denotes the squared euclidean distance between sample_in and centroid_in.
template<typename eT >
void op_kmeans::compute_distance ( Row< eT > &  dist_out,
u32 &  winner,
const Mat< eT > &  centroids_in,
const subview_row< eT > &  sample_in 
) [inline, static]
  • Compute distances between one sample and all the centroids.
  • Input Arguments:
    • cetroids_in : Matrix of the centroids (i.e., each row represents a centroid).
    • sample_in : Row vector which represents the sample.
  • Output Arguments :
    • dist_out : Row vector of input sample's distances from each one of the centroids.
    • winner : Index which indicates the winning centroid.
template<typename eT >
eT op_kmeans::compute_distance ( const subview_row< eT > &  sample_in,
const subview_row< eT > &  centroid_in 
) [inline, static]
  • Calculate distance between one sample and one centroid (returns a scalar).
  • Input Arguments:
    • sample_in : Subview row vector which represents one sample.
    • centroid_in : Subview row vector which represents the centroid.
  • Output Argument:
    • Scalar which denotes the squared euclidean distance between sample_in and centroid_in.
template<typename eT >
void op_kmeans::compute_distance ( Row< eT > &  dist_out,
u32 &  winner,
const Mat< eT > &  centroids_in,
const subview_row< eT > &  sample_in 
) [inline, static]
  • Compute distances between one sample and all the centroids.
  • Input Arguments:
    • cetroids_in : Matrix of the centroids (i.e., each row represents a centroid).
    • sample_in : Row vector which represents the sample.
  • Output Arguments :
    • dist_out : Row vector of input sample's distances from each one of the centroids.
    • winner : Index which indicates the winning centroid.
template<typename eT >
void op_kmeans::direct_kmeans ( Col< u32 > &  indices_out,
Col< u32 > &  ranks,
Mat< eT > &  centroids_out,
const Mat< eT > &  samples_in,
const u32  k,
const eT  lr 
) [inline, static]

K-means clustering.

  • Input Arguments:
    • samples_in : Samples' matrix (i.e., each row is a sample).
    • k : k denotes the number of desired clusters.
    • lr : Starting learning rate for online phase version of K-means.
  • Output Arguments:
    • indices_out : Cluster indices for each point.
    • ranks_out : Vector which holds the number of samples that correspond to each centroid.
    • centroids_out : Cluster centroid locations.
template<typename eT >
void op_kmeans::direct_kmeans ( Col< u32 > &  indices_out,
Col< u32 > &  ranks,
Mat< eT > &  centroids_out,
const Mat< eT > &  samples_in,
const u32  k,
const eT  lr 
) [inline, static]

K-means clustering.

  • Input Arguments:
    • samples_in : Samples' matrix (i.e., each row is a sample).
    • k : k denotes the number of desired clusters.
    • lr : Starting learning rate for online phase version of K-means.
  • Output Arguments:
    • indices_out : Cluster indices for each point.
    • ranks_out : Vector which holds the number of samples that correspond to each centroid.
    • centroids_out : Cluster centroid locations.
template<typename eT >
void op_kmeans::init_centroids ( Mat< eT > &  centroids_out,
const Mat< eT > &  samples_in,
const u32  k 
) [inline, static]

Initialize centroids.

  • Input Arguments:
    • samples_in : Samples' matrix (i.e., each row is a sample).
    • k : k denotes the number of desired clusters.
  • Output Arguments:
    • centroids_out : Centroids' matrix (i.e., each row is a centroid).
template<typename eT >
void op_kmeans::init_centroids ( Mat< eT > &  centroids_out,
const Mat< eT > &  samples_in,
const u32  k 
) [inline, static]

Initialize centroids.

  • Input Arguments:
    • samples_in : Samples' matrix (i.e., each row is a sample).
    • k : k denotes the number of desired clusters.
  • Output Arguments:
    • centroids_out : Centroids' matrix (i.e., each row is a centroid).
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerator Defines