Ejemplo n.º 1
0
        private void CalcItem(EntropyResult pEntropyResult, EntropyItem pEntropyItem)
        {
            pEntropyItem.P = (double)pEntropyItem.Count / pEntropyResult.SignCount;
            double pI = 1 / pEntropyItem.P;

            pEntropyItem.I = Math.Log(pI, 2);
            pEntropyResult.ShannonEntropy += pEntropyItem.P * pEntropyItem.I;
        }
Ejemplo n.º 2
0
 private void SumLogicPartial(ThreadObject pThreadObject)
 {
     Parallel.ForEach(pThreadObject.EntropyResultList, (er) =>
     {
         EntropyResult er2 = resultList.Find(x => x.Logic.Name == er.Logic.Name);
         foreach (EntropyItem it in er.ItemList)
         {
             SumItem(er2, it);
         }
         er2.SignCount += er.SignCount;
     });
 }
Ejemplo n.º 3
0
        private void AddEntropyResults(ThreadParams pThreadParams, EntropyLogic pEntropyLogic, MatchCollection pMatchCollection)
        {
            EntropyResult er2 = pThreadParams.FindEntropyResult(pEntropyLogic.Name);

            if (er2 == null)
            {
                er2 = new EntropyResult()
                {
                    Logic = pEntropyLogic
                };
                pThreadParams.AddEntropyResult(er2);
            }
            AddEntropyResultItems(pEntropyLogic, pMatchCollection, er2);
        }
Ejemplo n.º 4
0
        private void SumItem(EntropyResult pEntropyResult, EntropyItem pEntropyItem)
        {
            EntropyItem it2 = pEntropyResult.ItemList.Find(x => x.Value == pEntropyItem.Value);

            if (it2 == null)
            {
                pEntropyResult.ItemList.Add(new EntropyItem()
                {
                    Value = pEntropyItem.Value, Count = pEntropyItem.Count
                });
            }
            else
            {
                it2.Count += pEntropyItem.Count;
            }
        }
Ejemplo n.º 5
0
 internal void AddEntropyResult(EntropyResult pEntropyResult)
 {
     threadParams.AddEntropyResult(pEntropyResult);
 }
Ejemplo n.º 6
0
 internal void AddEntropyResult(EntropyResult pEntropyResult)
 {
     entropyResultList.Add(pEntropyResult);
 }
Ejemplo n.º 7
0
 private void AddEntropyResultItems(EntropyLogic pEntropyLogic, MatchCollection pMatchCollection, EntropyResult pEntropyResult)
 {
     foreach (Match m in pMatchCollection)
     {
         string value = m.Value;
         if (pEntropyLogic.Trim != string.Empty)
         {
             value = value.Trim();
         }
         if (pEntropyLogic.NoEmpty && value == string.Empty)
         {
             continue;
         }
         EntropyItem it = pEntropyResult.ItemList.Find(x => x.Value == value);
         if (it == null)
         {
             pEntropyResult.ItemList.Add(new EntropyItem()
             {
                 Value = value, Count = 1
             });
         }
         else
         {
             it.Count++;
         }
         pEntropyResult.SignCount++;
     }
 }