Physical Activity Recognition using Wearable Accelerometers in Controlled and Free-Living Environments