Example #1
0
        /// <summary>
        /// Returns the maximum distance for all values for the provided attribute
        /// using the provided ISimilarityMeasure
        /// </summary>
        /// <param name="attributeName">The name of the attribute to retrieve the maximum distance for</param>
        /// <param name="measure">The ISimilarityMeasure to use to calculate the distance</param>
        /// <returns>the maximum distance value for all values for the given attribute</returns>
        public double GetMaxDistance(string attributeName, ISimilarityMeasure measure)
        {
            Tuple <string, string> tuple = Tuple.Create(attributeName, measure.ToString());

            // Ensure that the maximum distance isn't already cached
            if (!this.distancesCache.ContainsKey(tuple))
            {
                // Get the maximum distance calculation, for the provided
                // attribute and measure, and cache it.
                this.distancesCache[tuple] = CalculateMaxDistance(attributeName, measure);
            }

            return(this.distancesCache[tuple]);
        }
Example #2
0
        /// <summary>
        /// Returns the standard deviation for all distances (over all values) for the
        /// given attribute and using the specified similarity measure.  This method
        /// attempts to use the cached value.  If one doesn't exist, it is calculated.
        /// </summary>
        /// <param name="attributeName">The attribute to compute the standard
        /// deviation for</param>
        /// <param name="measure">The similarity measure to be used</param>
        /// <returns>the standard deviation for all distances over all attribute
        /// values for the given attribute and similarity measure</returns>
        public double GetDistanceStandardDeviation(string attributeName, ISimilarityMeasure measure)
        {
            Tuple <string, string> tuple = Tuple.Create(attributeName, measure.ToString());

            // Ensure that the standard deviation distance value isn't already computed
            if (!this.sdCache.ContainsKey(tuple))
            {
                // Calculate the distance standard deviation
                this.sdCache[tuple] = CalculateDistanceSD(attributeName, measure);
            }

            // Returns the cached standard deviation value
            return(this.sdCache[tuple]);
        }
        /// <summary>
        /// Returns the maximum distance for all values for the provided attribute
        /// using the provided ISimilarityMeasure
        /// </summary>
        /// <param name="attributeName">The name of the attribute to retrieve the maximum distance for</param>
        /// <param name="measure">The ISimilarityMeasure to use to calculate the distance</param>
        /// <returns>the maximum distance value for all values for the given attribute</returns>
        public double GetMaxDistance(string attributeName, ISimilarityMeasure measure)
        {
            Tuple<string, string> tuple = Tuple.Create(attributeName, measure.ToString());

            // Ensure that the maximum distance isn't already cached
            if (!this.distancesCache.ContainsKey(tuple))
            {
                // Get the maximum distance calculation, for the provided
                // attribute and measure, and cache it.
                this.distancesCache[tuple] = CalculateMaxDistance(attributeName, measure);
            }

            return this.distancesCache[tuple];
        }
        /// <summary>
        /// Returns the standard deviation for all distances (over all values) for the
        /// given attribute and using the specified similarity measure.  This method
        /// attempts to use the cached value.  If one doesn't exist, it is calculated.
        /// </summary>
        /// <param name="attributeName">The attribute to compute the standard
        /// deviation for</param>
        /// <param name="measure">The similarity measure to be used</param>
        /// <returns>the standard deviation for all distances over all attribute
        /// values for the given attribute and similarity measure</returns>
        public double GetDistanceStandardDeviation(string attributeName, ISimilarityMeasure measure)
        {
            Tuple<string, string> tuple = Tuple.Create(attributeName, measure.ToString());

            // Ensure that the standard deviation distance value isn't already computed
            if (!this.sdCache.ContainsKey(tuple))
            {
                // Calculate the distance standard deviation
                this.sdCache[tuple] = CalculateDistanceSD(attributeName, measure);
            }

            // Returns the cached standard deviation value
            return this.sdCache[tuple];
        }