Non hierarchical clustering
PortfolioOptimisers.KMeansAlgorithm Type
julia
struct KMeansAlgorithm{__T_rng, __T_seed, __T_kwargs} <: AbstractNonHierarchicalClusteringAlgorithmK-means clustering algorithm configuration for non-hierarchical clustering in PortfolioOptimisers.jl.
KMeansAlgorithm is a composable clustering algorithm type that specifies the use of the k-means algorithm (via Clustering.kmeans) for constructing non-hierarchical clusterings from a distance matrix.
Fields
rng: Random number generator.seed: Seed for the random number generator.kwargs: Keyword arguments forClustering.kmeans.
Constructors
julia
KMeansAlgorithm(;
rng::Random.AbstractRNG = Random.default_rng(),
seed::Option{<:Integer} = nothing,
kwargs::NamedTuple = (;)
) -> KMeansAlgorithmKeywords correspond to the struct's fields.
Validation
- If
kwargscontainsweights, it must be a non-emptyAbstractVector.
Examples
julia
julia> KMeansAlgorithm()
KMeansAlgorithm
rng ┼ Random.TaskLocalRNG: Random.TaskLocalRNG()
seed ┼ nothing
kwargs ┴ @NamedTuple{}: NamedTuple()Related
source