Ejemplo n.º 1
0
 public void SetUp()
 {
     Matcher    = new NaNConstraint();
     GoodValues = new object[] { double.NaN, float.NaN };
     BadValues  = new object[] { null, "hello", 42, 4.2, 4.2f, 4.2m,
                                 double.PositiveInfinity, double.NegativeInfinity,
                                 float.PositiveInfinity, float.NegativeInfinity };
     Description = "NaN";
 }
Ejemplo n.º 2
0
        /// <summary> Calculates an optimal lambda (rigidity) value by the variance of values_ array.</summary>
        protected double BestRigidityEstimate()
        {
            if (!IsInitialized)
            {
                return(0);
            }
            const double minSmoothParam = 1e-6;
            const double maxSmoothParam = 1 - 1e-6;

            if (values_.Length < 1)
            {
                return(minSmoothParam);
            }
            var sT = new double[values_.Length];

            if (values_.Length < 2)
            {
                return(minSmoothParam);
            }
            for (var i = 0; i < sT.Length - 1; i++)
            {
                sT[i] = values_[i + 1] - values_[i];
            }
            var varSt           = sT.Variance();
            var smoothParameter = 1.0 / (varSt * Math.Pow(sT.Length, 1.0 / 2) + 1);
            var param           = new NaNConstraint();

            if ((smoothParameter > 0.1) && _isPca)
            {
                smoothParameter /= Math.Sqrt(sT.Length);
            }
            if ((param.Matches(smoothParameter)) || smoothParameter > maxSmoothParam)
            {
                smoothParameter = minSmoothParam;
            }
            return(smoothParameter);
        }
Ejemplo n.º 3
0
 public void SetUp()
 {
     theConstraint        = new NaNConstraint();
     stringRepresentation = "<nan>";
     expectedDescription  = "NaN";
 }
Ejemplo n.º 4
0
 public void SetUp()
 {
     theConstraint = new NaNConstraint();
     stringRepresentation = "<nan>";
     expectedDescription = "NaN";
 }