Prediction using many samples with models possibly containing partially shared parameters