Git Product home page Git Product logo

charting's Introduction

Chart data

Description

Chart data about coin flips.

Objectives

Learning Objectives

After completing this assignment, you should understand:

  • Basic statistics
  • The use of different plot types

Performance Objectives

After completing this assignment, you should be able to:

  • Use matplotlib
  • Use IPython Notebook
  • Use the statistics module

Details

Deliverables

  • A Git repo called charting containing at least:
    • an IPython notebook
    • a requirements.txt file

Requirements

  • Passing unit tests
  • No PEP8 or Pyflakes warnings or errors

Normal Mode

All of the following should be done in an IPython Notebook.

Create a function to flip a coin. It is up to you to determine what this returns to signify heads or tails. Then create a function to run a simulation of flipping a coin n number of times, default 100000, recording how many heads and tails it has at different intervals. The intervals are exponential, so record at 2 ** 0, 2 ** 1, 2 ** 2, and so on until you reach n. Record the final number as well.

Then make a line plot of the difference between heads and tails at each recorded point, and another with the ratio of heads to tails at each recorded point.

Create these plots again, but as scatter plots with a logarithmic scale for the x-axis.

Write notes about what you observe. Feel free to add more plots to help you.

Now we will look at the mean and standard deviation of these trials of flipping coins. Flip coins as before, but run 20 trials of 100000 each.

Use a scatter plot to plot the mean heads/tails ratio at each recorded point, and another scatter plot to plot the standard deviation of the heads/tails ratio at each recorded point. You will want to use a logarithmic scale for the x-axis in both. You may want to do the same for the y-axis with the standard deviation.

Write notes about what you observe. Feel free to add more plots to help you.

Lastly, run 100,000 trials of 100 coin flips each. Plot a histogram of the ratio of heads to total flips for each trial. Run 100,000 trials of 1,000 coin flips each and plot that histogram as well. Lastly, plot a box plot of your results from the 100 coin flip trials and your results from the 1,000 coin flip trials.

What do you observe? Write up your notes.

If possible, add the mean and standard deviation as text to each histogram.

Additional Resources

Credit

Some assignments adapted from Introduction to Computation and Programming Using Python.

charting's People

Contributors

brundleflytelepod avatar cndreisbach 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.