/// <summary> /// Add a item to this cluster and adjust the cluster vector, itemship list and sum vector accordingly. /// </summary> /// <param name="item">The item to be added.</param> public void AddItemToCluster(FeatureItem item) { if (!ClusterItemList.Contains(item)) { ClusterItemList.Add(item); AdaptiveIntersect.UpdateFeatureIntersectionByLast(ClusterItemList, ClusterVector); AdaptiveIntersect.UpdateFeatureSummaryByLast(ClusterItemList, ClusterVectorSummary); //----- remove for debugging and tests only tempClusterVectorMagnitude = AdaptiveIntersect.CalculateVectorMagnitude(ClusterVector); //remove for debugging and tests only tempClusterVectorSummaryMagnitude = AdaptiveIntersect.CalculateVectorMagnitude(ClusterVectorSummary); //remove for debugging and tests only } }
public void AddClusterToHyperCluster(Cluster cluster) { ClusterList.Add(cluster); AdaptiveIntersect.UpdateClusterIntersectionByLast(ClusterList, HyperClusterVector); AdaptiveIntersect.UpdateClusterSummaryByLast(ClusterList, HyperClusterVectorSummary); ValidHyperClusterItemList = false; //TODO: rendutant analyse to remove it //for (int i = 0; i < cluster.ClusterItemList.Count; i++) //{ // HyperClusterItemList.Add(cluster.ClusterItemList[i]); //} }
/// <summary> /// Constructor. Cluster vector is set to the initial feature vector. /// </summary> /// <param name="item">The item used to construct this cluster</param> public Cluster(FeatureItem item) { //resulting values should be copied ClusterVector = new double[item.FeatureVector.Length]; Array.Copy(item.FeatureVector, ClusterVector, item.FeatureVector.Length); ClusterVectorSummary = new double[item.FeatureVector.Length]; Array.Copy(item.FeatureVector, ClusterVectorSummary, item.FeatureVector.Length); ClusterItemList = new List <FeatureItem>(); ClusterItemList.Add(item); //----- remove for debugging and tests only tempClusterVectorMagnitude = AdaptiveIntersect.CalculateVectorMagnitude(ClusterVector); //remove for debugging and tests only tempClusterVectorSummaryMagnitude = AdaptiveIntersect.CalculateVectorMagnitude(ClusterVectorSummary); //remove for debugging and tests only }
/// <summary> /// Remove a item from this cluster and update cluster Vector accordingly (basd on other assigned items) /// Return false if ItemList is empty /// </summary> /// <param name="item">The item to be removed</param> public bool RemoveItemFromCluster(FeatureItem item) { if (ClusterItemList.Remove(item) == true) { if (ClusterItemList.Count > 0) //recalculate vector summary only if not empty { AdaptiveIntersect.CalculateFeatureIntersection(ClusterItemList, ClusterVector); AdaptiveIntersect.CalculateFeatureSummary(ClusterItemList, ClusterVectorSummary); //----- remove for debugging and tests only tempClusterVectorMagnitude = AdaptiveIntersect.CalculateVectorMagnitude(ClusterVector); //remove for debugging and tests only tempClusterVectorSummaryMagnitude = AdaptiveIntersect.CalculateVectorMagnitude(ClusterVectorSummary); //remove for debugging and tests only } } return(ClusterItemList.Count > 0); }
public bool RemoveClusterFromHyperCluster(Cluster cluster) { if (ClusterList.Remove(cluster) == true) { if (ClusterList.Count > 0) { AdaptiveIntersect.CalculateClusterIntersection(ClusterList, HyperClusterVector); AdaptiveIntersect.CalculateClusterSummary(ClusterList, HyperClusterVectorSummary); //TODO: redundant analyse to remove it // nie ma senzu sa kazdym razem tworzyc listy, tylko wtedy gdy bedzie do niej potrzebny dostep //HyperClusterItemList.Clear(); //for(int i=0; i< ClusterList.Count; i++) //{ // for(int j = 0; j < ClusterList[i].ClusterItemList.Count; j++) // { // HyperClusterItemList.Add(ClusterList[i].ClusterItemList[j]); // } //} } ValidHyperClusterItemList = false; } return(ClusterList.Count > 0); }