Does sklearn time cpu time or wall time

Viewed 200

Are the returned timing values for the random and grid search implementations of sklearn in CPU or wall time? All I can find in the documentation is the following:

The mean_fit_time, std_fit_time, mean_score_time and std_score_time are all in seconds.

So I am assuming that would mean wall time as the default, is this correct?

1 Answers

After going through the source code...

Line 748:

self.cv_results_ = results

Okay, what is results?

Line 706:

results = self._format_results(
          all_candidate_params, scorers, n_splits, all_out)
return results

Okay, what is all_out?

Line 703:

all_out.extend(out)

and then out is:

Line 682:

out = parallel(delayed(_fit_and_score)(clone(base_estimator),

and _fit_and_score is imported from sklearn.model_selection._validation.py so we look in there...

Line 543:

fit_time = time.time() - start_time

Aha! There we go. It's wall time, as Python's time.time()gives you the current Unix time.

Related