Hey..i have no idea to solve this problem..could some one help me....
If i add in the min support, the result will all run away...
i do not know why like this:
The result will like this:
2 3:1
2 3 4:1
2 4 2 3:1
3 4 4: 1
3 2: 3
3 4 2:3
4 2:3
2 5:1
3 4:1
:1
:1
:3
this is not what i wanted.
the expected result i want is like this
if is eliminate item 5
1 2:1
1 2 3:1
1 2 3 4:1
1 2 4:1
1 3:3
1 3 4:3
1 4:3
2 3:1
2 3 4:1
2 4:1
2 :1
3 4:3
here is my code:
private void USTreetoFPTree()
{
DateTime startTime = DateTime.Now; //Count start time now
//single item + support in desc order
var v = from k in SingleI.Keys
orderby SingleI[k] descending
select k;
SingleSupport.Clear();
foreach (var k in v)
{
SingleItemValue.AppendText(k + ":" + SingleI[k] + "\r\n");
hs1.Add(k);
}
//key for comabination
ArrayList myArray1 = new ArrayList();
ArrayList sArray1 = new ArrayList();
IDictionaryEnumerator et = itemS.GetEnumerator();
while (et.MoveNext())
{
KeyitemS.AppendText(et.Key.ToString() + ":" + et.Value.ToString() + "\r\n");
myArray1.Add(et.Key.ToString());
}
HashSet<string> hs2 = new HashSet<string>(hs1);
HashSet<string> hs3 = new HashSet<string>();
List<string> storehs2 = new List<string>();
for (int i = 0; i < myArray1.Count; i++)
{
foreach (string t in myArray1[i].ToString().Split(' '))
{
hs3.Add(t);
}
var clone = new HashSet<string>(hs2);
hs2.IntersectWith(hs3);
foreach (string f in hs2)
{
storehs2.Add(f);
}
hs2 = clone;
hs3.Clear();
}
string[] strarry = storehs2.ToArray();
string[] myArray2 = new string[myArray1.Count];
int[] lens = new int[myArray1.Count];
int index = 0;
foreach (string y in myArray1)
{
lens[index] = y.Replace(" ", "").Length;
index++;
}
index = 0;
int index2 = 0;
string[] temp = new string[lens[0]];
foreach (string q in strarry)
{
if (index2 < lens[index])
{
temp[index2] = q;
index2++;
}
else
{
myArray2[index] = String.Join(" ", temp);
index++;
temp = new string[lens[index]];
temp[0] = q;
index2 = 1;
}
}
myArray2[index] = String.Join(" ", temp);
string message = String.Join("\r\n", myArray2);
string[]myArray3 = new string[myArray2.Length];
et.Reset();
for (int i = 0; i < myArray3.Length; i++)
{
et.MoveNext();
myArray3[i] = String.Format("{0}:{1}", myArray2[i], et.Value.ToString());
}
string message2 = String.Join("\r\n", myArray3);
showFP.AppendText(message2);
TimeSpan elapsed = DateTime.Now - startTime;
textBox5.Text = elapsed.Milliseconds + " Miliseconds ";
}