private void populateSeqCounts(ItemsCounts counts, string[] seq)
 {
     for (int i = 0; i < seq.Count() - 1; i++)
     {
         counts.addItem(seq[i]);
     }
 }
 private void populateAllCounts(ItemsCounts counts, string[] seq)
 {
     string[] distinctSeq = seq.Distinct().ToArray();
     for (int i = 0; i < distinctSeq.Count(); i++)
     {
         counts.addItem(seq[i]);
     }
 }
        public void TrainCpModel()
        {
            ItemPairsCount allPairs  = new ItemPairsCount();
            ItemsCounts    allCounts = new ItemsCounts();

            if (trainSet == null)
            {
                throw new NullReferenceException("train set must be initialize first");
            }

            foreach (var session in trainSet)
            {
                populateAllPairs(allPairs, session);
                populateAllCounts(allCounts, session);
            }

            items.addAllPairs(allPairs);
            items.addAllCount(allCounts);
        }