I have built Predictive model with Scikit learn. I have deployed this model with Flask, joblib. Whenever I predict for new incoming request with loaded models, its printing message on console about total time taken on cores.
Now, I want to disable this print. How can i suppress the given message while model predicts for new incoming data.
[Parallel(n_jobs=24)]: Done 117 out of 174 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 121 out of 179 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 122 out of 181 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 123 out of 183 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 125 out of 185 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 127 out of 188 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 128 out of 190 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 129 out of 192 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 132 out of 196 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 133 out of 198 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 135 out of 201 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 137 out of 204 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 138 out of 205 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 140 out of 208 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 143 out of 213 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 148 out of 220 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 149 out of 222 | elapsed: 0.0s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 153 out of 228 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 155 out of 231 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 159 out of 237 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 165 out of 246 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 168 out of 250 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 169 out of 252 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 171 out of 255 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 173 out of 258 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 177 out of 264 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 181 out of 270 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 183 out of 273 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 185 out of 276 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 187 out of 279 | elapsed: 0.1s remaining: 0.0s
[Parallel(n_jobs=24)]: Done 335 out of 500 | elapsed: 0.3s remaining: 0.1s
[Parallel(n_jobs=24)]: Done 500 out of 500 | elapsed: 0.3s finished
I had a similar complaint while using sklearn.linear_model.LinearRegression. In this method, I could find no verbose argument in either the .fit() method or the constructor. So the python code:
import numpy as np
from sklearn.linear_model import LinearRegression as LR
lr = LR()
y = np.random.rand(100) + 0.01 * np.arange(100) # noisy line to fit
x = np.arange(100)
x = np.reshape(y,[100,1])
lr.fit(x,y)
I get the annoying output:
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)
Because the fit() method returns a pointer to itself, and this text represents that object. A simple way to suppress this is by amending the above code to read:
a = lr.fit(x,y)
Thereby assigning the pointer to some variable and not your screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With