Macbook pro keeps shutting down randomly
MacBook Pro (retina, 15", Late 2013)
Processor: 2GHz Intel Core i7
Memory: 8GB 1600 MHz DDR3
Graphics: Intel Iris Pro 1536MB
OS X Yosemite version 10.10.4
About a month ago my macbook pro started to shut down randomly. It suddenly without warning turns to black, but for about 15 seconds the screen stays on (all black screen but still lit up) along with the apple logo on the back, and I can hear the computer still running. It then turns off completely. After holding the power button, it turns back on and usually goes to the login screen normally as if nothing happened (sometime a message pops up saying 'an error occured', or 'your computer shut down unexpectedly' or something like that, but this is infrequent and there is no error code or specific message attached to it). This seems to almost exclusively occur when on the internet or using data.
Does anyone know what the issue could be here?
MacBook Pro (Retina, 15-inch, Late 2013), OS X Yosemite (10.10.4)