Example #1
0
		public static ClassCharacteristicSetKmer<A> BuildSubtractiveDifference(string name, MultisetKmer<A> baselineClass, MultisetKmer<A> thisClass, uint countCutoff)
		{
			ClassCharacteristicSetKmer<A> newSet = new ClassCharacteristicSetKmer<A>(name, Math.Min (baselineClass.maxK, thisClass.maxK));

			//TODO statistically significant?
			//TODO diffence amount?

			foreach(Kmer<A> key in thisClass.Keys){
				if(thisClass.getCount(key) > countCutoff){
					double thisFrac = thisClass.GetKeyFrac(key);
					double baseFrac = baselineClass.GetKeyFrac (key);
					if(thisFrac > baseFrac){
						newSet.Add (key, thisFrac - baseFrac);
					}
				}
			}

			//TODO select top x?
			//double[] function?

			return newSet;
		}
Example #2
0
        public void TrainModelRatios(MultisetKmer <A> baselineClass, MultisetKmer <A> thisClass)
        {
            List <KeyValuePair <Kmer <A>, double> > rawModel = new List <KeyValuePair <Kmer <A>, double> >();

            int totalCount = 0;

            foreach (Kmer <A> key in thisClass.Keys)
            {
                int thisCount = thisClass.getCount(key);
                totalCount += thisCount;
                if (thisCount > regressor.minSignificantCount)
                {
                    double thisFrac = thisClass.GetKeyFrac(key);
                    double baseFrac = baselineClass.GetKeyFracLaplace(key, regressor.smoothingAmount);
                    if (thisFrac > baseFrac)
                    {
                        rawModel.Add(key, thisFrac / baseFrac);
                    }
                }
            }

            regressor.finalizeModel(rawModel, totalCount);
        }