Beispiel #1
0
        public override int GetHashCode()
        {
            int hash = 13;

            hash = (hash * 7) + ExportNonTryptic.GetHashCode();
            hash = (hash * 7) + ExportPartiallyTryptic.GetHashCode();
            hash = (hash * 7) + ExportTryptic.GetHashCode();
            hash = (hash * 7) + MaxDelCN.GetHashCode();
            hash = (hash * 7) + MaxLogEValForXTandemAlignment.GetHashCode();
            hash = (hash * 7) + MaxLogEValForXTandemExport.GetHashCode();
            hash = (hash * 7) + MaxModificationsForAlignment.GetHashCode();
            hash = (hash * 7) + MaxModsForAlignment.GetHashCode();
            hash = (hash * 7) + MaxRankForExport.GetHashCode();
            hash = (hash * 7) + MinDelCNForExport.GetHashCode();
            hash = (hash * 7) + MinObservationsForExport.GetHashCode();
            hash = (hash * 7) + MinXCorrForAlignment.GetHashCode();
            hash = (hash * 7) + MinXCorrForExportNonTrytpic.GetHashCode();
            hash = (hash * 7) + MinXCorrForExportPartiallyTrytpic.GetHashCode();
            hash = (hash * 7) + MinXCorrForExportTrytpic.GetHashCode();
            if (PredictionAlgorithm != null)
            {
                hash = (hash * 7) + PredictionAlgorithm.GetHashCode();
            }
            hash = (hash * 7) + PredictorType.GetHashCode();
            hash = (hash * 7) + Regression.GetHashCode();
            hash = (hash * 7) + RegressionOrder.GetHashCode();
            hash = (hash * 7) + TargetFilterType.GetHashCode();
            hash = (hash * 7) + UseDelCN.GetHashCode();

            return(hash);
        }
        public static EncodedImage Encode(Bitmap image, PredictorSettings predictorSettings)
        {
            var originalImageMatrix = ImageMapper.GetPixelMatrixFromImage(image);

            var predictionAlgorithm = new PredictionAlgorithm(originalImageMatrix, predictorSettings);

            return(predictionAlgorithm.GetEncodedImage());
        }
        public void Setup()
        {
            var predictorSettings = new PredictorSettings
            {
                Predictor     = predictor,
                AcceptedError = acceptedError,
                Range         = range
            };

            predictionAlgorithm = new PredictionAlgorithm(originalMatrix, predictorSettings);
        }
        private void InitAlgorithms()
        {
            var stateSpace       = new[] { StateSpace.FairDice, StateSpace.LoadedDice };
            var observationSpace = Enumerable.Range(1, (int)numberOfSidesNumericUpDown.Value).ToArray();


            viterbiAlgorithm = new ViterbiAlgorithm <int, StateSpace>
            {
                StateSpace                   = stateSpace,
                ObservationSpace             = Enumerable.Range(1, casino.NumberOfSides).ToArray(),
                SequenceOfObservations       = casino.History.Select(el => el.Result).ToArray(),
                InitialProbabilitiesOfStates = new Dictionary <StateSpace, double>
                {
                    { StateSpace.FairDice, casino.SwitchToFairDiceProbability },
                    { StateSpace.LoadedDice, casino.SwitchToUnfairDiceProbability }
                },
                TransitionMatrix = new MatrixHashTable <StateSpace, StateSpace, double>(stateSpace, stateSpace)
                {
        public override void OnScannedRobot(IEnemy scannedEnemy)
        {
            if (scannedEnemy != null)
            {
                foreach (var predictionAlgorithm in _predictors)
                {
                    predictionAlgorithm.OnScannedRobot(scannedEnemy);
                }

                // GET THE BEST ALGORITHM
                _best = _predictors.Count() == 1 ? _predictors.Single() : scannedEnemy.Predictions.GetBestPredictionAlgorithm(scannedEnemy.Blips, Context.Time);

                if (_best != null)
                {
                    Context.Out.WriteLine("Best: {0}", _best);
                }

                // mAKE FUTURE PREDICTIONS
                if (scannedEnemy.BulletPower.HasValue && scannedEnemy.Direct != null)
                {
                    foreach (var predictionAlgorithm in _predictors)
                    {
                        Double bulletPower = scannedEnemy.BulletPower.Value;
                        long   flightTime  = (long)(scannedEnemy.Direct.Magnitude / Rules.GetBulletSpeed(bulletPower));

                        var futurePosition = predictionAlgorithm.GetFuturePosition(scannedEnemy, flightTime);
                        if (futurePosition != null)
                        {
                            scannedEnemy.Predictions.Add(
                                predictionAlgorithm,
                                Context.Time,
                                flightTime,
                                futurePosition);
                        }
                    }
                }
            }
        }
Beispiel #6
0
        public IActionResult PredictionResult(string category, float investment, int Products)
        {
            Prediction prediction = new Prediction();

            prediction.Categories       = category;
            prediction.Investment       = investment;
            prediction.numberOfProducts = Products;
            PredictionAlgorithm predictionAlgorithm = new PredictionAlgorithm(this._context, prediction.Categories, prediction.Investment, prediction.numberOfProducts);

            products = predictionAlgorithm.getAllProductsPredictions();
            if (products.Count == 0 || products == null)
            {
                return(this.View(products));
            }
            prediction.predictionValue    = products.ElementAt(0).PredictionValue;
            prediction.skuNumberOfProduct = products.ElementAt(0).SKUNumber;
            prediction.nameOfProduct      = products.ElementAt(0).ProductName;
            _Product = products.ElementAt(0);
            this.ViewBag.HightestPrediction = products.ElementAt(0).PredictionValue;
            this.ViewBag.NameOfProduct      = products.ElementAt(0).ProductName;
            this.ViewBag.SKUOfProduct       = products.ElementAt(0).SKUNumber;
            Analysis.products = products.Where(c => c.ProductSubCategory == products.ElementAt(0).ProductSubCategory).ToList();
            return(this.View(products));
        }