1
$\begingroup$

Is it possible to show the training progress of the MultiOutputRegressor in sklearn? When a huge dataset is processed, my program runs a long time and I have no clue how long it will take. I have shortened my program to a minimal working example below.

import numpy as np
from sklearn.multioutput import MultiOutputRegressor
import xgboost as xgb

df = np.arange(50).reshape(10,5)
train = df[:8]
test = df[8:]
X_train = train[:,0:-2]
X_test  = test[:,0:-2]
y_train = train[:,-2:]
y_test  = test[:,-2:] 

eval_set = [(X_test, y_test)]
multioutputregressor = MultiOutputRegressor(xgb.XGBRegressor(eval_set=eval_set, verbose_eval=True))
multioutputregressor.fit(X_train, y_train)
predictions = multioutputregressor.predict(X_test)
print(predictions)
$\endgroup$
2
  • $\begingroup$ There is no built-in progress bar for scikit learn and most of the ML algorithms. There are might be a solution using tqdm package see :github.com/scikit-learn/scikit-learn/issues/7574, but I am not sure it will work on MultiOutputRegressor or not!! $\endgroup$ Aug 9, 2018 at 9:34
  • $\begingroup$ Thanks, I tried this but unfortunately it doesn't work in my case, since XGBRegressor doesn't have a partial_fit method. $\endgroup$
    – Dennis
    Aug 9, 2018 at 15:47

1 Answer 1

2
$\begingroup$

You can consider modifying the code of MultiOutputEstimator or XGBModel to introduce some debugging output. These seem to be the classes that implement the fitting logic of the two libraries. The corresponding source files should also be provided in the installations on your local hard drive.

For example, you can print information of when the separate threads are starting and stopping in MultiOutputEstimator.fit (inherited and thus reused in MultiOutputRegressor), lines 167-169. Also, consider the tip in the documentation of the n_jobs parameter:

If 1 is given, no parallel computing code is used at all, which is useful for debugging.

You can use a similar approach to expand the debugging in XGBModel.fit (the basis of XGBRegressor).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.