Skip to content

Commit

Permalink
Update Bonus Calculation Method to Use Min-Max Scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
mike96265 committed Sep 23, 2023
1 parent f904ef1 commit c8932c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 1-Introduction/04-stats-and-probability/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@
"source": [
"## Correlation and Evil Baseball Corp\n",
"\n",
"Correlation allows us to find relations between data sequences. In our toy example, let's pretend there is an evil baseball corporation that pays its players according to their height - the taller the player is, the more money he/she gets. Suppose there is a base salary of $1000, and an additional bonus from $0 to $100, depending on height. We will take the real players from MLB, and compute their imaginary salaries:"
"Correlation allows us to find relations between data sequences. In our toy example, let's pretend there is an evil baseball corporation that pays its players according to their height - the taller the player is, the more money he/she gets. Suppose there is a base salary of $1000, and an additional bonus from $0 to $100, depending on height. We will take the real players from MLB, and compute their imaginary salaries(based on Min-Max scaling):"
]
},
{
Expand All @@ -848,7 +848,7 @@
],
"source": [
"heights = df['Height']\n",
"salaries = 1000+(heights-heights.min())/(heights.max()-heights.mean())*100\n",
"salaries = 1000+(heights-heights.min())/(heights.max()-heights.min())*100\n",
"print(list(zip(heights, salaries))[:10])"
]
},
Expand Down Expand Up @@ -935,7 +935,7 @@
}
],
"source": [
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.mean()))*100\n",
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.min()))*100\n",
"print(f\"Correlation = {np.corrcoef(heights, salaries)[0,1]}\")"
]
},
Expand All @@ -960,7 +960,7 @@
}
],
"source": [
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.mean()))*100+np.random.random(size=len(heights))*20-10\n",
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.min()))*100+np.random.random(size=len(heights))*20-10\n",
"print(f\"Correlation = {np.corrcoef(heights, salaries)[0,1]}\")"
]
},
Expand Down

0 comments on commit c8932c0

Please sign in to comment.