for learn algorithm