Example #1
0
        private void Swap_Modified()
        {
            if (!Params.StoreSamples)
            {
                throw new InvalidOperationException("Unable to swap modified because samples are not stored in memory.");
            }

            this.IsLeafNode = false;

            for (int i = 0; i < Params.q; i++)
            {
                // create node + set save path
                Node node = new Node(this, this.path + "node" + (children.Count + 1).ToString() + @"\", this.deltaX * Params.deltaMultiplyReduction, this.deltaY * Params.deltaMultiplyReduction, this.blx * Params.blxMultiplyIncrease, this.bly * Params.blyMultiplyIncrease);
                List<ClusterPair> clPairs = this.clusterPairs.Where(cp => cp.CurrentCenter == i).ToList();

                // set id of node
                node.Id = this.children.Count + 1;

                List<Sample> sampleForNewNode = new List<Sample>();
                foreach (var item in clPairs)
                {
                    // set reference to ClusterPair, which node correspond to this ClusterPair
                    item.CorrespondChild = node;
                    sampleForNewNode.AddRange(item.Samples);
                }

                foreach (var item in sampleForNewNode)
                {
                    node.UpdateNode_ForSwapping(item);
                }

                // set parent to clusters X
                node.SetParentToXClusters();

                // count covariance patrix mean for probability counting
                // node.CountCovarianceMatrixMean();

                // set plastic/non plastic
                this.UpdatePlasticityOfParents(node);

                // add children
                this.children.Add(node);
            }
        }
Example #2
0
        private void Swap()
        {
            this.IsLeafNode = false;

            for (int i = 0; i < Params.q; i++)
            {
                // create node + set save path
                Node node = new Node(this, this.path + "node" + (children.Count + 1).ToString() + @"\", this.deltaX * Params.deltaMultiplyReduction, this.deltaY * Params.deltaMultiplyReduction, this.blx * Params.blxMultiplyIncrease, this.bly * Params.blyMultiplyIncrease);
                List<ClusterPair> clPairs = this.clusterPairs.Where(cp => cp.CurrentCenter == i).ToList();

                // set id of node
                node.Id = this.children.Count + 1;

                foreach (var item in clPairs)
                {
                    ClusterPair clusterPair = item.GetClone();
                    node.AddClusterPair(clusterPair);

                    // set reference to ClusterPair, which node correspond to this ClusterPair
                    item.CorrespondChild = node;

                    if (node == null)
                    {
                        throw new InvalidOperationException("Node cant be null");
                    }
                }

                // set parent to clusters X
                node.SetParentToXClusters();

                // count covariance patrix mean for probability counting
                // node.CountCovarianceMatrixMean();

                // set plastic/non plastic
                this.UpdatePlasticityOfParents(node);

                // add children
                this.children.Add(node);
            }
        }