Code Monkey home page Code Monkey logo

the-grass-is-greener's Introduction

Is the grass greener on the other side?

Build Status Quality Gate Status Coverage

Here you can find out whether this common expression is fake or not. I created this code for using in the solution of a probability problem proposed by Dr. Ruth Urner on one of her assignments for the Machine Learning Course at YU.

Problem

The problem consists of choosing two courses out of three in two sections. First, the student was presented with two randomly chosen courses to pick one. On the second pick, they would pick another out of the remained ones (including the one not picked in the first try).

How to execute

This solution was written in Java using JUnit tests. For checking the results, execute the unit test named probabilityAllThreeCourses under the class SelectorTest. For the assert of the test, we have these three probabilities:

assertEquals(new BigDecimal("0.666"), probabilityA);
assertEquals(new BigDecimal("0.666"), probabilityB);
assertEquals(new BigDecimal("0.666"), probabilityC);

Notice that all three are identical to 2/3 when we have a large number of executions, defined by the variable EXECUTIONS. The class Selector is responsible for randomly selecting our courses.
The test was made with 500000 executions, and the precision is three decimal places.

the-grass-is-greener's People

Contributors

jaimedantas avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.