Pthon script to create the BN training database