Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lightfm/lightfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,10 @@ def fit(self, interactions,
num_threads: int, optional
Number of parallel computation threads to use. Should
not be higher than the number of physical cores.
verbose: bool, optional
whether to print progress messages.
verbose: bool or function, optional
if it's a bool, whether to print progress messages;
if it's a function, the print or logging function for printing
progress messages.

Returns
-------
Expand Down Expand Up @@ -513,8 +515,10 @@ def fit_partial(self, interactions,
num_threads: int, optional
Number of parallel computation threads to use. Should
not be higher than the number of physical cores.
verbose: bool, optional
whether to print progress messages.
verbose: bool or function, optional
if it's a bool, whether to print progress messages;
if it's a function, the print or logging function for printing
progress messages.

Returns
-------
Expand Down Expand Up @@ -567,7 +571,9 @@ def fit_partial(self, interactions,

for epoch in range(epochs):

if verbose:
if hasattr(verbose, '__call__'):
verbose('Epoch %s' % epoch)
elif verbose:
print('Epoch %s' % epoch)

self._run_epoch(item_features,
Expand Down