Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
clustering means grouping i.e we can put the same items on one floder then briefly i will explain with realtime example. Actually you have number of color balls in one container(one box) then take the same color balls in another box that is called as grouping or clustering.pickup same items and store on one location is called as clustering or groupings.

Actually i have number of text files(.txt) in one folder then i had taken that folder and applied clustering concepts using fuzzy c means clustering alogrithm.

successfully clustering works on that folder(set of text files)i.e grouping the same items successfully done but i have problem at after grouping task is complete then how can be store the grouping the same items in one folder.my problem is how to store the same items in one folder after grouping is complete

my code like as:
C#
float fvalue = resultSet.Count;
string foldername = @"E:\ClusterGroups";

//directory creation.......
if (!System.IO.Directory.Exists(foldername))
{
    Directory.CreateDirectory(foldername);
    MessageBox.Show(" Created Successfully..........");
}
else
{
    MessageBox.Show("Directory Already Exist ..........");
}

foreach (Centroid c in resultSet)
{
    foreach (DocumentVector dv in c.GroupedDocument)
    {
        int docs = c.GroupedDocument.Count;
        //sub folder creation
        for (int j = 1; j <= fvalue; j++)
        {
            DirectoryInfo dr= Directory.CreateDirectory(foldername + "\\" + (j).ToString());
        }
        MessageBox.Show("folders created successfully..........");               
    }
}

i had traced the grouping the files at resultset collection
C#
foreach (Centroid c in resultSet)

also i had create directory and sub directory in code centroid proprty class:
C#
using System;
using System.Collections.Generic;
using System.Linq;

namespace cluster_form.Lib
{
    public class Centroid
    {
        public List<DocumentVector> GroupedDocument { get; set; }
    }
}

Document vectory property class:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cluster_form.Lib
{
    /// <summary>
    /// Represents each document in n-dimensional vector space using Vector Space Model
    /// </summary>
    public class DocumentVector
    {
        
        // it represent the content of document to be clustered
        public string content { get; set; }
        //represents the tf*idf of  each document
        public float[] VectorSpace { get; set; }
    }
}  

one thing remember that whenever i had took the folder(set of files) for clustering at the time only reading the content of files only (but not for filenames) then apply clustering concept using fuzzy k means clustering alogrithem then grouping successfully done but i want to store the grouping files or clustering files in sub folder(E:\clustering groups).

IMPORTANT:
resultset collection store the grouping files(grouping documents)(foreach loop).

pls help me for coding.
Posted
Updated 3-Feb-15 1:12am
v5
Comments
Richard MacCutchan 3-Feb-15 6:48am    
Why do you convert a value to a string just so you can convert it back to an integer? Also it is difficult to understand exactly what you are trying to do; you may need to get someone to help you translate your problem into English.
Krishna Veni 3-Feb-15 7:15am    
sorry i didn't see that instruction.i had updated that statment
BillWoodruff 3-Feb-15 10:11am    
I'm not clear what you are asking help with: can you give more details ?
Krishna Veni 3-Feb-15 10:49am    
i want how can u store the grouping documents in folders.if u have related code or link pls tell me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900