samples and code for the general algorithm translating preds to TA