Skip to content

Commit c8932c0

Browse files
committed
Update Bonus Calculation Method to Use Min-Max Scaling
1 parent f904ef1 commit c8932c0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

1-Introduction/04-stats-and-probability/notebook.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@
830830
"source": [
831831
"## Correlation and Evil Baseball Corp\n",
832832
"\n",
833-
"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:"
833+
"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):"
834834
]
835835
},
836836
{
@@ -848,7 +848,7 @@
848848
],
849849
"source": [
850850
"heights = df['Height']\n",
851-
"salaries = 1000+(heights-heights.min())/(heights.max()-heights.mean())*100\n",
851+
"salaries = 1000+(heights-heights.min())/(heights.max()-heights.min())*100\n",
852852
"print(list(zip(heights, salaries))[:10])"
853853
]
854854
},
@@ -935,7 +935,7 @@
935935
}
936936
],
937937
"source": [
938-
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.mean()))*100\n",
938+
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.min()))*100\n",
939939
"print(f\"Correlation = {np.corrcoef(heights, salaries)[0,1]}\")"
940940
]
941941
},
@@ -960,7 +960,7 @@
960960
}
961961
],
962962
"source": [
963-
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.mean()))*100+np.random.random(size=len(heights))*20-10\n",
963+
"salaries = 1000+np.sin((heights-heights.min())/(heights.max()-heights.min()))*100+np.random.random(size=len(heights))*20-10\n",
964964
"print(f\"Correlation = {np.corrcoef(heights, salaries)[0,1]}\")"
965965
]
966966
},

0 commit comments

Comments
 (0)