# Negative weight when using BDTG

**URL:** <https://root-forum.cern.ch/t/negative-weight-when-using-bdtg/36389>\
**Category:** TMVA\
**Created:** [October 17, 2019, 3:36pm UTC](https://root-forum.cern.ch/t/negative-weight-when-using-bdtg/36389 "2019-10-17T15:36:35Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [October 21, 2019, 1:17pm UTC](https://root-forum.cern.ch/t/negative-weight-when-using-bdtg/36389/4 "2019-10-21T13:17:32Z")

</div>

Hi and welcome to the ROOT (online) community!

The reason for the error is most probably that you are using negative weights.

You can either:

1. specify the bin width of the generated histograms by inserting (adapted from [Kolmogorov-Smirnov test values](https://root-forum.cern.ch/t/kolmogorov-smirnov-test-values/32868/4)) `TMVA::gConfig().GetVariablePlotting()).fNbinsMVAoutput = 25;` at the top of your training script (default is `fNbinsMVAoutput = 40`),

2. or use a larger training sample!

## Details

Negative event weights are sometimes included as correction terms in simulations, however, the events themselves are unphysical. A histogram modelling a probability distribution cannot contain bins with a negative sum, the events with negative weight only make sense in _on average_. This is what TMVA is complaining about! (The implication is that with the current training data the region in the histogram having a negative sum is poorly modelled.)

---

_[View the full topic](https://root-forum.cern.ch/t/negative-weight-when-using-bdtg/36389)._
