Multiple Instance Dictionary Learning using Functions of Multiple Instances