The following snippet shows how to mine closed sequences

// maps string items to ints
var symbolMapper = new SymbolMapper();
			
// sequences formatted "a,b,c;a,b;d,a,b"
// ";" seperates itemsets, "," seperates items
var sequenceFormatter = new SequenceFormatter();

// read sequences from input file -- this ignores case
var sequences = SequenceReader.ReadSequencesFromFile(@"input.txt", symbolMapper);

// create a closed sequence miner and do the mining
var miner = new ClosedSequenceMiner(4, 1);			
var supportCount = 2;
var result = miner.Mine(sequences, supportCount, 60000);

// print the results
foreach (var pattern in result.Patterns)
{
	Console.WriteLine("{0}: {1}", pattern.SupportCount,
		sequenceFormatter.SequenceToString(pattern, symbolMapper));
}		

Last edited Dec 13, 2013 at 11:19 AM by arthur_pitman, version 4

Comments

No comments yet.