Activity Recognition Using a Single Accelerometer Placed at the Wrist or Ankle