ClusteringBase<T>

Base Classes · AiDotNet.Clustering.Base

Provides a base implementation for clustering algorithms that group similar data points together.

Implements: IClustering<T>, IFeatureAware, IGradientComputable<T, Matrix<T>, Vector<T>>, IModelShape, IParameterChunkSource<T>, IParameterManifestProvider

Known derived types: AffinityPropagation<T>, AgglomerativeClustering<T>, BIRCH<T>, BisectingKMeans<T>, CLARANS<T>, CLIQUE<T>, COPKMeans<T>, CURE<T>, ConsensusClustering<T>, DBSCAN<T>, Denclue<T>, FuzzyCMeans<T>, GMeans<T>, GaussianMixtureModel<T>, HDBSCAN<T>, KMeans<T>, KMedoids<T>, MeanShift<T>, MiniBatchKMeans<T>, OPTICS<T>, OnlineKMeans<T>, SUBCLU<T>, SeededKMeans<T>, SelfOrganizingMap<T>, SpectralClustering<T>, XMeans<T>

Properties

Property Summary
ILossFunction<T> DefaultLossFunction { get; }
Matrix<T> ClusterCenters { get; set; }
ParameterLayoutSnapshot ParameterLayout { get; }
T Inertia { get; set; }
Vector<T> Labels { get; set; }
bool IsTrained { get; set; } Gets or sets whether the model has been trained.
bool SupportsParameterInitialization { get; } Whether this clustering model supports direct parameter-based initialization.
int NumClusters { get; set; }
int NumFeatures { get; set; } Gets or sets the number of features.
long ParameterCount { get; }
string[] FeatureNames { get; set; } Gets or sets the feature names.

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance()
DynamicShapeInfo GetDynamicShapeInfo()
IEnumerable<ParameterChunk<T>> GetParameterStateChunks() Enumerates canonical persistent state without flattening tensor-backed components.
IEnumerable<Tensor<T>> GetParameterChunks() Streams state in the same order as the parameter manifest.
IEnumerable<int> GetActiveFeatureIndices()
IFullModel<T, Matrix<T>, Vector<T>> Clone()
IFullModel<T, Matrix<T>, Vector<T>> DeepCopy()
IFullModel<T, Matrix<T>, Vector<T>> WithParameters(Vector<T> parameters)
Matrix<T> Transform(Matrix<T> x)
ModelMetadata<T> GetModelMetadata() Returns the model type identifier.
ModelOptions GetOptions()
Vector<T> ComputeGradients(Matrix<T> input, Vector<T> target, ILossFunction<T> lossFunction)
Vector<T> FitPredict(Matrix<T> x)
Vector<T> GetFeatureImportances()
Vector<T> GetParameters()
Vector<T> Predict(Matrix<T> input)
Vector<T> SanitizeParameters(Vector<T> parameters)
bool IsFeatureUsed(int featureIndex)
byte[] Serialize()
int[] GetInputShape()
int[] GetOutputShape()
void ApplyGradients(Vector<T> gradients, T learningRate)
void Deserialize(byte[] modelData)
void Dispose()
void Fit(Matrix<T> x) Fits the model on data (unsupervised).
void LoadCheckpoint(string path)
void LoadModel(string filePath)
void LoadState(Stream stream)
void SaveCheckpoint(string path)
void SaveModel(string filePath)
void SaveState(Stream stream)
void SetActiveFeatureIndices(IEnumerable<int> featureIndices)
void SetParameterChunks(IEnumerable<Tensor<T>> chunks) Restores tensor-backed chunks on their device and retains custom-setter semantics.
void SetParameters(Vector<T> parameters)
void Train(Matrix<T> x) Trains the model on data (unsupervised convenience method).
void Train(Matrix<T> x, Vector<T> y)