public void Deveria_calcular_probabilidade_com_base_nos_dados_fornecidos()
        {
            var play = new PlayBasketball
            {
                HasBall         = true,
                NumberOfPlayers = 4,
                Rain            = false,
                Windy           = false,
                CanPlay         = true
            };

            var play2 = new PlayBasketball
            {
                HasBall         = false,
                NumberOfPlayers = 2,
                Rain            = true,
                Windy           = true,
                CanPlay         = true
            };

            _naiveBayes.Add(play);
            _naiveBayes.Add(play2);

            _naiveBayes.Fit();

            decimal probabilityFalse = _naiveBayes.Predict(play, false);

            probabilityFalse.Should().Be(0, because: "Não há probabilidade de não jogar");
        }
        public void Deveria_criar_probabilidade_com_cinquenta_porcento_de_chance_quando_possuir_apenas_dois_dados_completamente_distintos_no_treinamento()
        {
            var play = new PlayBasketball
            {
                HasBall         = true,
                NumberOfPlayers = 4,
                Rain            = false,
                Windy           = false,
                CanPlay         = true
            };

            var play2 = new PlayBasketball
            {
                HasBall         = false,
                NumberOfPlayers = 2,
                Rain            = true,
                Windy           = true,
                CanPlay         = false
            };

            _naiveBayes.Add(play);
            _naiveBayes.Add(play2);

            _naiveBayes.Fit();

            var correctValue = _naiveBayes.GetProbabilities().All(i => i.ProbabilityValue == 1);

            correctValue.Should().BeTrue();
        }
        public void Deveria_prever_que_ira_jogar_basquete_quando_dados_treinados_avaiarem_como_melhor_opcao_com_base_em_um_dado()
        {
            var play = new PlayBasketball
            {
                HasBall         = true,
                NumberOfPlayers = 4,
                Rain            = false,
                Windy           = false,
                CanPlay         = true
            };

            _naiveBayes.Add(play);

            _naiveBayes.Fit();

            bool canPlay = _naiveBayes.PredictExactly(play);

            canPlay.Should().Be(true);
        }
        public void Deveria_prever_com_cem_porcento_de_probabildade_quando_dado_fornecido_for_igual_ao_dado_treinado()
        {
            var play = new PlayBasketball
            {
                HasBall         = true,
                NumberOfPlayers = 4,
                Rain            = false,
                Windy           = false,
                CanPlay         = true
            };

            _naiveBayes.Add(play);

            _naiveBayes.Fit();

            decimal probability = _naiveBayes.Predict(play);

            probability.Should().Be(1);
        }
        public void Random_values()
        {
            Stopwatch s = new Stopwatch();

            s.Start();

            Random r = new Random();

            for (int i = 0; i < 1000000; i++)
            {
                var play = new PlayBasketball
                {
                    HasBall         = r.Next(1, 10) < 5 ? true : false,
                    NumberOfPlayers = r.Next(1, 10),
                    Rain            = r.Next(1, 10) < 5 ? true : false,
                    Windy           = r.Next(1, 10) < 5 ? true : false,
                    CanPlay         = r.Next(1, 10) < 5 ? true : false
                };

                _naiveBayes.Add(play);
            }

            _naiveBayes.Fit();

            bool canPlay = _naiveBayes.PredictExactly(new PlayBasketball
            {
                HasBall         = false,
                NumberOfPlayers = 2,
                Rain            = true,
                Windy           = true,
                CanPlay         = false
            });

            s.Stop();

            s.ElapsedMilliseconds.Should().BeLessThan(8500);
        }