diff --git a/notebooks/Chapter_07.ipynb b/notebooks/Chapter_07.ipynb index 18871e8..fc9b6f7 100644 --- a/notebooks/Chapter_07.ipynb +++ b/notebooks/Chapter_07.ipynb @@ -978,18 +978,18 @@ " bullish = df[predictions == True]\n", " bullish_gains = bullish.sort_index().groupby(bullish.index.date).head(1)['gain']\n", " bullish_gains.cumsum().plot(label='Bullish Only', legend=True)\n", - " print(f'% of time with profit: {(bullish_gains.cumsum() > 0).mean():.3f}')\n", + " print(f'Percentage of time with profit for bullish only: {(bullish_gains.cumsum() > 0).mean():.3f}')\n", " print(f'Total Gains for bullish is {bullish_gains.sum():.3f}')\n", " \n", " bearish = df[predictions == False]\n", " bearish_gains = bearish.sort_index().groupby(bearish.index.date).head(1)['gain']\n", " bearish_gains.cumsum().plot(label='Bearish Only', legend=True)\n", - " print(f'% of time with profit: {(bearish_gains.cumsum() > 0).mean():.3f}')\n", + " print(f'Percentage of time with profit for bearish only: {(bearish_gains.cumsum() > 0).mean():.3f}')\n", " print(f'Total Gains for bearish is {bearish_gains.sum():.3f}')\n", " \n", " gains = df.sort_index().groupby(df.index.date).head(1)['gain']\n", " gains.cumsum().plot(label='All Predictions', legend=True)\n", - " print(f'% of time with profit: {(gains.cumsum() > 0).mean():.3f}')\n", + " print(f'Percentage of time with profit for all predictions: {(gains.cumsum() > 0).mean():.3f}')\n", " print(f'Total Gains for all predictions is {gains.sum():.3f}')\n", " \n", " plt.title('Gains')\n", @@ -1007,11 +1007,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "% of time with profit: 0.077\n", + "Percentage of time with profit for bullish only: 0.077\n", "Total Gains for bullish is -0.043\n", - "% of time with profit: 0.500\n", + "Percentage of time with profit for bearish only: 0.500\n", "Total Gains for bearish is -0.004\n", - "% of time with profit: 0.308\n", + "Percentage of time with profit for all predictions: 0.308\n", "Total Gains for all predictions is -0.021\n" ] }, @@ -1818,11 +1818,11 @@ "\n", "Best params: {'classifier__criterion': 'entropy', 'classifier__max_depth': 10, 'classifier__max_features': None, 'classifier__min_samples_split': 3, 'select_from_model__estimator': LogisticRegression(random_state=0), 'select_from_model__threshold': 'median'}\n", "Overall took 263.71 seconds\n", - "% of time with profit: 0.000\n", + "Percentage of time with profit for bullish only: 0.000\n", "Total Gains for bullish is -0.038\n", - "% of time with profit: 1.000\n", + "Percentage of time with profit for bearish only: 1.000\n", "Total Gains for bearish is 0.017\n", - "% of time with profit: 0.923\n", + "Percentage of time with profit for all predictions: 0.923\n", "Total Gains for all predictions is 0.004\n" ] }, @@ -1924,11 +1924,11 @@ "\n", "Best params: {'classifier__criterion': 'entropy', 'classifier__max_depth': 10, 'classifier__max_features': None, 'classifier__min_samples_split': 5, 'rfe__estimator': LogisticRegression(random_state=0), 'rfe__n_features_to_select': 0.8}\n", "Overall took 675.54 seconds\n", - "% of time with profit: 0.000\n", + "Percentage of time with profit for bullish only: 0.000\n", "Total Gains for bullish is -0.063\n", - "% of time with profit: 0.381\n", + "Percentage of time with profit for bearish only: 0.381\n", "Total Gains for bearish is -0.027\n", - "% of time with profit: 0.077\n", + "Percentage of time with profit for all predictions: 0.077\n", "Total Gains for all predictions is -0.100\n" ] }, @@ -4048,11 +4048,11 @@ "\n", "Best params: {'classifier__criterion': 'entropy', 'classifier__max_depth': None, 'classifier__max_features': None, 'classifier__min_samples_split': 2, 'poly__degree': 2, 'select_from_model__estimator': RandomForestClassifier(n_estimators=20, random_state=0), 'select_from_model__threshold': 'mean'}\n", "Overall took 947.51 seconds\n", - "% of time with profit: 0.737\n", + "Percentage of time with profit for bullish only: 0.737\n", "Total Gains for bullish is 0.028\n", - "% of time with profit: 1.000\n", + "Percentage of time with profit for bearish only: 1.000\n", "Total Gains for bearish is 0.095\n", - "% of time with profit: 1.000\n", + "Percentage of time with profit for all predictions: 1.000\n", "Total Gains for all predictions is 0.158\n" ] },