add weighted loss function