private void btnStartClustering_Click(object sender, EventArgs e)
        {
            List <DocumentVector> vSpace   = VectorSpaceModel.ProcessDocumentCollection(docCollection);
            int             totalIteration = 0;
            List <Centroid> resultSet      = DocumnetClustering.PrepareDocumentCluster(int.Parse(txtClusterNo.Text), vSpace, ref totalIteration);
            string          msg            = string.Empty;
            int             count          = 1;

            foreach (Centroid c in resultSet)
            {
                msg += String.Format("------------------------------[ CLUSTER {0} ]-----------------------------{1}", count, System.Environment.NewLine);
                foreach (DocumentVector document in c.GroupedDocument)
                {
                    msg += document.Content + System.Environment.NewLine;
                    if (c.GroupedDocument.Count > 1)
                    {
                        msg += String.Format("{0}-------------------------------------------------------------------------------{0}", System.Environment.NewLine);
                    }
                }
                msg += "-------------------------------------------------------------------------------" + System.Environment.NewLine;
                count++;
            }

            richTextBox1.Text      = msg;
            lblTotalIteration.Text = totalIteration.ToString();
        }
Example #2
0
        private void btnStartClustering_Click(object sender, EventArgs e)
        {
            int totalIteration = 0;

            DocumnetClustering.mainCentroids = DocumnetClustering.PrepareDocumentCluster(
                int.Parse(txtClusterNo.Text), vSpace, ref totalIteration, ddl_sim.Text, mainCLusterNodeList, cboxDataSet.Text, maxNoDoc);
            printAlll();
            lblTotalIteration.Text = totalIteration.ToString();
            //MessageBox.Show("Done");
        }
Example #3
0
        /// <summary>
        /// 開始訓練
        /// </summary>
        public void train()
        {
            List <DocumentVector> vSpace = VectorSpaceModel.ProcessDocumentCollection(docCollection);

            totalIteration = 0;
            resultSet      = DocumnetClustering.PrepareDocumentCluster(txtClusterNum, vSpace, ref totalIteration);


            Console.WriteLine("totalIteration: " + totalIteration.ToString());
        }
Example #4
0
        public string GetFromCurrency(string priceToConvert)
        {
            var from_currency = "";

            Preprocess(priceToConvert);

            int totalIteration   = 0;
            int final_index      = -1;
            int collectionNumber = docCollection.DocumentList.Count - 1;

            List <DocumentVector> vSpace    = VectorSpaceModel.ProcessDocumentCollection(docCollection);
            List <Centroid>       resultSet = DocumnetClustering.PrepareDocumentCluster(collectionNumber, vSpace, ref totalIteration, ref final_index, currency);

            from_currency = resultSet[final_index].GroupedDocument[0].Content.Split(',')[0];

            return(from_currency);
        }
Example #5
0
        private void btnStartClustering_Click(object sender, EventArgs e)
        {
            List <DocumentVector> vSpace   = VectorSpaceModel.ProcessDocumentCollection(docCollection);
            int             totalIteration = 0;
            List <Centroid> resultSet      = DocumnetClustering.PrepareDocumentCluster(int.Parse(txtClusterNo.Text), vSpace, ref totalIteration);
            string          msg            = string.Empty;
            int             count          = 1;
            string          k     = string.Empty;
            string          max   = string.Empty;
            List <string>   topic = new List <string>();

            foreach (Centroid c in resultSet)
            {
                msg += String.Format("------------------------------[ CLUSTER {0} ]-----------------------------{1}", count, System.Environment.NewLine);
                k   += String.Format("[ CLUSTER {0} ]", count, System.Environment.NewLine);
                max  = string.Empty;
                foreach (DocumentVector document in c.GroupedDocument)
                {
                    for (int i = 0; i < document.keys.Length; i++)
                    {
                        float m = document.VectorSpace[0];
                        if (document.VectorSpace[i] > 0.005 && document.keys[i] != ".")
                        {
                            k += document.keys[i] + ",";
                        }
                        msg += document.Content + System.Environment.NewLine;
                        if (c.GroupedDocument.Count > 1)
                        {
                            msg += String.Format("{0}-------------------------------------------------------------------------------{0}", System.Environment.NewLine);
                        }
                    }

                    msg += "-------------------------------------------------------------------------------" + System.Environment.NewLine;
                    k   += System.Environment.NewLine;
                    topic.Add(max);
                    count++;
                }
            }

            richTextBox2.Text = k;
            richTextBox1.Text = msg;
            label10.Text      = totalIteration.ToString();
        }
Example #6
0
        public decimal GetExchangedValue(string priceToConvert, string to_currency)
        {
            var     from_currency = "";
            decimal exchangedValue;

            Preprocess(priceToConvert);

            int totalIteration   = 0;
            int final_index      = -1;
            int collectionNumber = docCollection.DocumentList.Count - 1;

            List <DocumentVector> vSpace    = VectorSpaceModel.ProcessDocumentCollection(docCollection);
            List <Centroid>       resultSet = DocumnetClustering.PrepareDocumentCluster(collectionNumber, vSpace, ref totalIteration, ref final_index, currency);

            from_currency = resultSet[final_index].GroupedDocument[0].Content.Split(',')[0];
            WriteInCurrencyDocument(from_currency, currency);
            decimal rate = GetRate(from_currency, to_currency);

            exchangedValue = value * rate;
            return(exchangedValue);
        }