Trajectory clustering and stochastic approximation for robot programming by demonstration | Synapse