Bear naturally prefer to avoid close encounters with people, and will typically leave an area if they know you are coming (hence the advice to talk and make noise when hiking through their territory).