Repalce data.table in train function with matrices