Skip to content

Commit e2eb91c

Browse files
authored
Merge pull request #818 from rasbt/learning-curve
learning curve doc
2 parents f2ce3b2 + 3b99cb2 commit e2eb91c

File tree

3 files changed

+60
-19
lines changed

3 files changed

+60
-19
lines changed

docs/sources/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The CHANGELOG for the current development version is available at
2525
- Updates unit tests for scikit-learn 0.24.1 compatibility. ([#774](https://github.com/rasbt/mlxtend/pull/774))
2626
- `StackingRegressor` now requires setting `StackingRegressor(..., multi_output=True)` if the target is multi-dimensional; this allows for better input validation. ([#802](https://github.com/rasbt/mlxtend/pull/802))
2727
- Removes deprecated `res` argument from `plot_decision_regions`. ([#803](https://github.com/rasbt/mlxtend/pull/803))
28+
- Adds a `title_fontsize` parameter to `plot_learning_curves` for controlling the title font size; also the plot style is now the matplotlib default. ([#818](https://github.com/rasbt/mlxtend/pull/818))
2829

2930
##### Bug Fixes
3031

docs/sources/user_guide/plotting/plot_learning_curves.ipynb

+47-14
Large diffs are not rendered by default.

mlxtend/plotting/learning_curves.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ def plot_learning_curves(X_train, y_train,
1616
train_marker='o',
1717
test_marker='^',
1818
scoring='misclassification error',
19-
suppress_plot=False, print_model=True,
20-
style='fivethirtyeight',
19+
suppress_plot=False,
20+
print_model=True,
21+
title_fontsize=12,
22+
style='default',
2123
legend_loc='best'):
2224
"""Plots learning curves of a classifier.
2325
@@ -49,8 +51,11 @@ def plot_learning_curves(X_train, y_train,
4951
for testing purposes.
5052
print_model : bool (default: True)
5153
Print model parameters in plot title if True.
52-
style : str (default: 'fivethirtyeight')
53-
Matplotlib style
54+
title_fontsize : int (default: 12)
55+
Determines the size of the plot title font.
56+
style : str (default: 'default')
57+
Matplotlib style. For more styles, please see
58+
https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html
5459
legend_loc : str (default: 'best')
5560
Where to place the plot legend:
5661
{'best', 'upper left', 'upper right', 'lower left', 'lower right'}
@@ -124,7 +129,9 @@ def misclf_err(y_predict, y):
124129
with plt.style.context(style):
125130
plt.ylabel('Performance ({})'.format(scoring))
126131
if print_model:
127-
plt.title('Learning Curves\n\n{}\n'.format(model))
132+
plt.title(
133+
'Learning Curves\n\n{}\n'.format(model),
134+
fontsize=title_fontsize)
128135
plt.legend(loc=legend_loc, numpoints=1)
129136
plt.xlim([0, 110])
130137
max_y = max(max(test_errors), max(training_errors))

0 commit comments

Comments
 (0)