For cycling, a bike bell is usually the way to go. It can be louder than yelling, is more pleasant to hear, and identifies you as a cyclist without anyone having to look. Also good for signaling to motorists. When passing pedestrians on a multi-use path, I often put a finger on the bell so it rings quietly.