# Question about Dropout setting in neural network configuration

**URL:** <https://root-forum.cern.ch/t/question-about-dropout-setting-in-neural-network-configuration/55493>\
**Category:** Newbie\
**Created:** [June 30, 2023, 11:38am UTC](https://root-forum.cern.ch/t/question-about-dropout-setting-in-neural-network-configuration/55493 "2023-06-30T11:38:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oleg\_dobrovsky](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/o/a183cd/32.png) [@oleg\_dobrovsky](https://root-forum.cern.ch/u/oleg_dobrovsky)\
**Post date:** [June 30, 2023, 11:38am UTC](https://root-forum.cern.ch/t/question-about-dropout-setting-in-neural-network-configuration/55493/1 "2023-06-30T11:38:33Z")

</div>

_ROOT Version:_ v6-28-02-5  
_Platform:_ Ubuntu 22.04.2 LTS  
_Compiler:_ (GCC) 12.2.0

Dear experts. I have a small question to ask. I’m using TMVA::kDL through Python. And in the neural network training setting I use dropout regularization. In the TMVA manual it’s written “Dropout is a regularization technique that with a certain probability sets neuron activations to zero. This probability can be set for all layers at once by giving a single floating point value or a value for each hidden layer of the network separated by ’+’ signs. Probabilities should be given by a value in the interval [0, 1].”  
I use the code

```auto
factory.BookMethod(dataloader, ROOT.TMVA.Types.kDL, "DNN1", "!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:WeightInitialization=XAVIER: Layout=DENSE|256|TANH,DENSE|256|TANH,DENSE|256|TANH,DENSE|256|TANH,LINEAR:TrainingStrategy=LearningRate=1e3,ConvergenceSteps=30,BatchSize=2048,TestRepetitions=1,MaxEpochs=50,Optimizer=ADAM,DropConfig=0.0++0.3+0.3+0.3")

```

to book neural network method and when the network starts training part of the output I have in the terminal is

```auto
DEEP NEURAL NETWORK: Depth = 5 Input = ( 1, 1, 20 ) Batch size = 2048 Loss function = C
	Layer 0 DENSE Layer: ( Input = 20 , Width = 256 ) Output = ( 1 , 2048 , 256 ) Activation Function = Tanh
	Layer 1 DENSE Layer: ( Input = 256 , Width = 256 ) Output = ( 1 , 2048 , 256 ) Activation Function = Tanh Dropout prob. = 0.7
	Layer 2 DENSE Layer: ( Input = 256 , Width = 256 ) Output = ( 1 , 2048 , 256 ) Activation Function = Tanh Dropout prob. = 0.7
	Layer 3 DENSE Layer: ( Input = 256 , Width = 256 ) Output = ( 1 , 2048 , 256 ) Activation Function = Tanh Dropout prob. = 0.7
	Layer 4 DENSE Layer: ( Input = 256 , Width = 1 ) Output = ( 1 , 2048 , 1 ) Activation Function = Identity

```

Here it states that Dropout probability is 0.7 though in network config I’ve put 0.3 for all the layers except the first one. So the question is how should I interprent it? Is the probability that the radrom neuron will be deactivated during training is 0.3 or 0.7? I’m a bit confused about the output.

* * *

---

<div class="post-metadata">

**Author:** ![mczurylo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mczurylo/32/33269_2.png) [@mczurylo](https://root-forum.cern.ch/u/mczurylo)\
**Post date:** [June 30, 2023, 2:24pm UTC](https://root-forum.cern.ch/t/question-about-dropout-setting-in-neural-network-configuration/55493/2 "2023-06-30T14:24:50Z")

</div>

Hi @oleg_dobrovsky,

thank you for your question. Maybe @moneta can help here?

Cheers,  
Marta

---

<div class="post-metadata">

**Author:** ![oleg\_dobrovsky](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/o/a183cd/32.png) [@oleg\_dobrovsky](https://root-forum.cern.ch/u/oleg_dobrovsky)\
**Post date:** [July 4, 2023, 4:19pm UTC](https://root-forum.cern.ch/t/question-about-dropout-setting-in-neural-network-configuration/55493/3 "2023-07-04T16:19:54Z")

</div>

Deer @moneta, maybe you can take a look at this question?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [July 4, 2023, 5:12pm UTC](https://root-forum.cern.ch/t/question-about-dropout-setting-in-neural-network-configuration/55493/4 "2023-07-04T17:12:56Z")

</div>

Hi,

Sorry for the late replay. The probability that the neutron will be de-activated is actually 0.3 and not 0.7. See the code around line 40 at [ROOT: tmva/tmva/src/DNN/Architectures/Cpu/Dropout.hxx Source File](https://root.cern.ch/doc/master/Cpu_2Dropout_8hxx_source.html)

and in the DenseLayer [documentation](https://root.cern.ch/doc/master/classTMVA_1_1DNN_1_1TDenseLayer.html#acc4e7c15c7923f5df45a2ed45ee47535), Dropout probability is considered the probability that a neutron is active.

If you have some further issues, please let me know

Lorenzo
