[question]
Enter the chapter number
Chapter 3
Enter the page number
No response
What is the cell's number in the notebook
80
Enter the environment you are using to run the notebook
Jupyter on Windows
Question
Multioutput Classification
noise = np.random.randint(0, 100, (len(X_train), 784))
X_train_mod = X_train + noise
noise = np.random.randint(0, 100, (len(X_test), 784))
X_test_mod = X_test + noise
y_train_mod = X_train
y_test_mod = X_test
if take parameter 100 then end output is not clear. Rather than 100 take as 1 ,then output is completely clear
noise = np.random.randint(0, 1, (len(X_train), 784))
X_train_mod = X_train + noise
noise = np.random.randint(0, 1, (len(X_test), 784))
X_test_mod = X_test + noise
y_train_mod = X_train
y_test_mod = X_test
Thanks for your question.
If you use 1 instead of 100, the noise variable will just contain an array full of zeros, because the values output by np.randint(a, b) range from a to b – 1, so if you set a=0 and b=1, then you get only zeros.
Since your noise array is full of zeros, adding it to the image does not change it at all, so the model's task will be very easy: it just needs to output the same image it gets as input.
The point of this example is to show that it's possible to train a model to remove noise from an image, and since we're making a prediction for each pixel, it's a multioutput classification problem.
You can try lowering the noise level down to 10 if you prefer, but not all the way down to 1.
Hope this helps.
Thanks ageron!
On Mon, 19 May 2025 at 05:37, Aurélien Geron @.***> wrote:
ageron left a comment (ageron/handson-ml3#190) https://github.com/ageron/handson-ml3/issues/190#issuecomment-2889293135
Thanks for your question.
If you use 1 instead of 100, the noise variable will just contain an array full of zeros, because the values output by np.randint(a, b) range from a to b – 1, so if you set a=0 and b=1, then you get only zeros.
Since your noise array is full of zeros, adding it to the image does not change it at all, so the model's task will be very easy: it just needs to output the same image it gets as input.
The point of this example is to show that it's possible to train a model to remove noise from an image, and since we're making a prediction for each pixel, it's a multioutput classification problem.
You can try lowering the noise level down to 10 if you prefer, but not all the way down to 1.
Hope this helps.
— Reply to this email directly, view it on GitHub https://github.com/ageron/handson-ml3/issues/190#issuecomment-2889293135, or unsubscribe https://github.com/notifications/unsubscribe-auth/BMQMNBNNN2OAFRVPUHWEQ5327EOCLAVCNFSM6AAAAAB5G2T2GGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOBZGI4TGMJTGU . You are receiving this because you authored the thread.Message ID: @.***>