fixed bug

-weights were being updated multiple times for every example
-add documentation