public GaussianNoiseDistance(IDistance <T> distance, float std) { distance.NullCheck(); (std >= 0).AssertTrue(); this.InnerDistance = distance; this.StandardDeviation = std; this.normal = new Normal(this.Mean, this.StandardDeviation); }
public NGramSemanticGraphDistance(IDistance <float> e, Func <float, float> transform, float tolerance = 0F, float empty = 1F) { e.NullCheck(); transform.NullCheck(); this.TolerancePerNode = tolerance; this.EmptyNodeWeight = empty; this.ProbabilityDistace = e; this.TransformFunction = transform; }
public KMeans(IEnumerable <T[]> vectors, IDistance <T> func, int k, int[] centers) { vectors.NullCheck(); centers.NullCheck(); func.NullCheck(); (centers.Length == k).AssertTrue(); this.values = vectors.ToArray(); this.Function = func; this.K = k; this.centers = new Dictionary <T[], List <T[]> >(); foreach (var item in centers) { if (!this.centers.ContainsKey(this.values[item])) { this.centers.Add(this.values[item], new List <T[]>()); } } this.AssignToNewCenters(); }