A confusion of weight

Hi all,
I have a confusion on the meaning of weight. For example, when I use BDT to distinguish signal and background, in real work , signal may 100 while background 10^6 . It is too little signal to avoid statistic error so I want to generate both signal and background 10^8 and use this data to analysis.

So that for signal , the weight should be 100/10^8 = 10^-6 and background’s 10^-2 . ? Am I right?

I want to know when the BDT in TMVA will use the weight , before training ? Or just use weight when test?

If I write my own BDT code , can I use , for example 10^8 signal and 10^8 background for training? And use some data to test , and I get the accuracy , and use weight when I need to calculate signal/sqart(Background)

I don’t know the use of weight in TMVA and other machine learning algorithm, can anyone help me?