Example #1
0
            public SelfEndpointingSingleGestureRecognizer
                (string label, Classifier classifier, ILoggingProvider <T> Provider)
                : base(label, classifier.Dataset as DataSet <T>, Provider, false)
            {
                Classifier   = classifier;
                SmoothedData = new SmoothedList <T>(3); // Half-life of the "weight" of a data point: three data points later (pretty fast - this is a light smoothing.)

                PeakFinder = new PeakFinder <T>(SmoothedData,
                                                (seq) =>
                {
                    var Seq = new Sequence <T>()
                    {
                        SourcePath = seq.ToArray()
                    };
                    var analyzedSeq = Current.Analyze(Seq).Result;

                    // If we've stated that we only care about one gesture class, and it's not that, then we're obviously not there yet.
                    //if (Target != null && Seq.RecognizedAsIndex != Target.index) return double.NaN;
                    if (Target != null && Seq.RecognizedAsName != Target.className)
                    {
                        return(double.NaN);
                    }
                    else
                    {
                        return(analyzedSeq.RecognitionScore);
                    }
                }, thresholdScore: 1.0, minLength: Classifier.Dataset?.MinSequenceLength ?? 5);
                InterimInterval = TimeSpan.FromMilliseconds(100);
            }
            public override double AssessShot(SmoothedList <float> distancesDodged, List <TimeSpan> timestamps, IncomingRangedAttack incoming)
            {
                var effectiveDodge   = distancesDodged.Last() / DistanceForOneSigma / (1.0 + 0.01 * incoming.DodgeCompensationBonus);
                var bellCurveDieRoll = Accord.Statistics.Distributions.Univariate.NormalDistribution.Random();
                var resultScore      = incoming.BaseZScore - effectiveDodge - bellCurveDieRoll;

                Log.Debug("Evasion|AssessShot", $"Resolved an evasion attempt with a {((resultScore > 0) ? "hit" : "miss")} ({resultScore:f2}) based on an EffectiveDodge of {effectiveDodge:f2} and a random dodge of {bellCurveDieRoll:f2}.");
                return(resultScore);
            }
 public override double AssessShot(SmoothedList <float> relevantFactors, List <TimeSpan> timestamps, IncomingRangedAttack incoming)
 {
     throw new NotImplementedException();
 }