simple sample prediction algorithm