Which is the hot wire, neutral wire and ground wire?
The cap colors have nothing to do with it

The color codes say the **size and quantity* of wires they're designed for.  For instance yellow can bind up to 3 14AWG wires, but red can bind up to 6.  Their ranges overlap broadly. 

It's all about the wire colors, except...

A bare, green, or green/yellow wire is always a ground.  Not every installation has grounds.  They are often pushed up into the back of the box.  

A gray or white wire (light blue in Europe/rest of world) is a neutral, except it can be tagged with tape to use as a "hot".  People often forget to tag the wires with tape, especially when the use is obvious. 

Any other wire color can only be a hot.  You should not mark a hot to be a neutral or ground.  But you can't count on the last guy doing right. 

So here's what we know


The black-black bundle can only be hots.  
The white-white bundle is certainly the actual neutrals.  
The black-white bundle, the black must be a hot, so the white must be a hot that should have been marked with tape, and wasn't (typically because the use is "obvious").  Here, the obvious use would be for a switch loop. 


In a switch loop, you have a black and (should be marked) white going down to the switch.  The switch shorts them together to light the light.   There's no standard which wire is always-hot and which is switched-hot.  So realistically the switched-hot will be either wire.

Your lamp needs neutral and switched-hot.  The neutral is easy; the switched-hot will be one of the others.  You can guess, but if you guess wrong, the lamp will be on continuously and won't respond to the switch.  That's exactly what you do to find out. 

Ground wires are not readily visible in your photo.  You'll have to look closer in the back of the box.  Some light circuits are ungrounded; in which case there is nothing to attach to.  Normally you have to replace a whole cable, not run a single wire; but as of 2014 it is legal to retrofit just a ground wire, if you really want to.