For this blog, I will be discussing how 538’s baseball prediction works.

Team Ratings

First, they start with creating Team Rankings. To do this they collected game results and box scores going all the way back to 1871. They used data to create an Elo-based rating system and predictive model for baseball that accounts for home-field advantage, the margin of victory, park, and era effects, travel, rest, and — most importantly — starting pitchers.

Every MLB team carries a rating that estimates its current skill level. The league average is about 1500.

After every game a team plays, their rankings are adjusted…


What’s a function? In Python, a function is a group of related statements that perform a specific task.

A parameter is the variable listed inside the parentheses in the function definition.

An argument is the value that is sent to the function when it is called.

Main components of a function

  1. Keyword def that marks the start of the function header.
  2. A function name to uniquely identify the function. Function naming follows the same rules of writing identifiers in Python.
  3. Parameters (arguments) through which we pass values to a function. They are optional.
  4. A colon (:) to mark the end of the function header.
  5. Optional…


What is a List?

Lists are collections of data that are surrounded by brackets [ ] and each item in the list is separated by commas.

What can be in a list?

Strings, numbers, booleans, even other lists can be items in a list. Lists are ordered and mutable (changeable). This means that lists can be sorted and changed. The way we can change lists is through list methods.

Methods

They are many easy to use methods that can help us make sense of lists in Python

These quick and easy to use methods are great for editing and analyzing lists

append() Adds an element at the end of the list

Lorin Helfenstein

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store