Example #1
0
        public DateStatistics(int numberOfSamples, string name, CorrelationFactory correlationFactory, Func <Person, int, Tuple <string, DateTime?, DateTime?> > getter) : base(numberOfSamples, name, correlationFactory, calculateValueForStatistic: null)
        {
            _numberOfSamples    = numberOfSamples;
            _name               = name;
            _correlationFactory = correlationFactory;
            DateDifference      = new Dictionary <string, DiscreteStatistic>();

            CalculateValueForStatistic = GetValueAsDouble(getter);
        }
 public StatisticsContainer(string sessionId, int numberOfSamplesToTake, int ageQuants, int?ageQuantLevel)
 {
     AgeQuants             = ageQuants;
     AgeQuantLevel         = ageQuantLevel;
     SessionId             = sessionId;
     NumberOfSamplesToTake = numberOfSamplesToTake;
     CorrelationFactory    = new CorrelationFactory();
     Statistics            = new Dictionary <string, Statistic>();
     CustomModels          = new Dictionary <string, ISetStatistics>();
     _howManyTaken         = 0;
 }
Example #3
0
        private NetMQTimer CreateInitTimer()
        {
            var guid        = CorrelationFactory.GetNextCorrelation();
            var rnd         = new Random(guid.GetHashCode());
            var randomStart = TimeSpan.FromMilliseconds(rnd.Next(500, 1000)); // Prevent self similar behaviour
            var result      = new NetMQTimer(randomStart);

            result.Elapsed += (sender, args) =>
            {
                args.Timer.Enable = false; // one shot only
            };

            return(result);
        }
Example #4
0
        public void Update(Person p, int ageQuant)
        {
            var value = GetValue(p, ageQuant, true);

            if (!value.HasValue)
            {
                return;
            }

            var valueToInsert = value.Value;

            CorrelationFactory?.Round1(Name, valueToInsert);

            Update(value);
        }
Example #5
0
 public Statistic(int howManySamplesToTake, string name, CorrelationFactory correlationFactory, Func <Person, int, double?> calculateValueForStatisticx)
     : this(howManySamplesToTake, name)
 {
     CorrelationFactory         = correlationFactory;
     CalculateValueForStatistic = (p, a, b) => calculateValueForStatisticx(p, a);
 }
 public BooleanStatistic(int howManySamplesToTake, string name, CorrelationFactory correlationFactory, Func <Person, int, double?> calculateValueForStatistic) : base(howManySamplesToTake, name, correlationFactory, calculateValueForStatistic)
 {
     IsBoolean = true;
 }
Example #7
0
 public void CorrelationFactory_GivenElement_FirstElementContainsCorr()
 {
     nodeScript = AssignNodeScript(nodeScript, path);
     Assert.IsTrue(CorrelationFactory.GetCorrelations(nodeScript)[0].Rule.Contains("corr"));
 }
Example #8
0
 public void CorrelationFactory_GivenElement_ReturnsCorrelationArray_NonEmpty()
 {
     nodeScript = AssignNodeScript(nodeScript, path);
     Assert.IsTrue(CorrelationFactory.GetCorrelations(nodeScript).Length > 0);
 }
Example #9
0
 public void CorrelationFactory_GivenElement_ReturnsCorrelationArrayType()
 {
     nodeScript = AssignNodeScript(nodeScript, path);
     Assert.IsInstanceOfType(CorrelationFactory.GetCorrelations(nodeScript), typeof(Correlation[]));
 }
Example #10
0
 public void CorrelationFactory_GivenElement_IsNotNull()
 {
     nodeScript = AssignNodeScript(nodeScript, path);
     Assert.IsNotNull(CorrelationFactory.GetCorrelations(nodeScript));
 }
        public DiscreteStringStatistics(int howManySamplesToTake, int?ageQuantLevel, string name, CorrelationFactory correlationFactory, Func <Person, int, string> calculateValueForStatistic) : base(howManySamplesToTake, name, correlationFactory, calculateValueForStatistic: null)
        {
            _ageQuantLevel = ageQuantLevel;

            Stats = new Dictionary <string, DiscreteStringStatisticElement>
            {
                { _emptyString, new DiscreteStringStatisticElement()
                  {
                      Count = 0
                  } }
            };

            IsDiscrete = true;
            CalculateValueForStatistic = GetValueAsDouble(calculateValueForStatistic);
        }
Example #12
0
        // To be made private

        // temporary
        public JoinNetwork EmitJoinNetwork()
        {
            return(new JoinNetwork(Identity, CorrelationFactory.GetNextCorrelation()));
        }
Example #13
0
 public DiscreteStatistic(int howManySamplesToTake, string name, CorrelationFactory correlationFactory, Func <Person, int, double?> calculateValueForStatistic) : base(howManySamplesToTake, name, correlationFactory, calculateValueForStatistic)
 {
     _stats     = new Dictionary <int, int>();
     IsDiscrete = true;
 }