This is a simple python script that calculates the memory settings for YARN and MapReduce. It generates the values based on Hortonworks' recommendations and should serve as a good starting point for new clusters.
The script prompts for cores, ram, and disk specs of the nodes in the cluster.
Refer to Hortonworks Documentation for details on the calculation: http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.0.6.0/bk_installing_manually_book/content/rpm-chap1-11.html