implemented cost function
Merge pull request #3 from arnellebalane/cost-function

implemented cost function