MeanShift is a an unsupervised machine learning model that finds cluster centers by moving points towards higher density regions.
Contains a matrix.
Create new model object. If any of the arguments are nil, default argument values for that argument will be used.
MeanShift.new(maximumNumberOfIterations: integer, bandwidth: number, distanceFunction: string, kernelFunction: string, kernelParameters: table): ModelObject
maximumNumberOfIterations: How many times should the model needed to be trained.
bandwidth: The size of the area around each data point.
distanceFunction: The function to calculate the distance between the data points and the centroids. Available options are:
Euclidean (Default)
Manhattan
Cosine
kernelFunction: The function used to kernelize the distance between the data points and the centroids. Available options are:
Gaussian (Default)
Linear
Set model’s parameters. When any of the arguments are nil, previous argument values for that argument will be used.
MeanShift:setParameters(maximumNumberOfIterations: integer, bandwidth: number, distanceFunction: string, kernelFunction: string, kernelParameters: table)
maximumNumberOfIterations: How many times should the model needed to be trained.
bandwidth: The size of the area around each data point.
bandwidthStep: The size of the update for each clusters.
distanceFunction: The function to calculate the distance between the data points and the centroids. Available options are:
Euclidean (Default)
Manhattan
Cosine
kernelFunction: The function used to kernelize the distance between the data points and the centroids. Available options are:
Gaussian (Default)
Linear
Train the model.
MeanShift:train(featureMatrix: Matrix)
Predict which clusters does it belong to for a given data.
MeanShift:predict(featureMatrix: Matrix): integer, number
clusterNumber: The cluster which the data belongs to.
shortestDistance: The distance between the datapoint and the center of the cluster (centroids).