In Term 2 Lesson 11 the solution for the quiz Initialize Priors Function contains code which just works for the given example.
Changing the landmarks line from
std::vector<float> landmark_positions {5, 10, 20};
to
std::vector<float> landmark_positions {0, 10, 20};
for example throws an error because the prior vector is accessed at -1.
Even worse setting two landmarks next to each other
std::vector<float> landmark_positions {9, 10, 20};
results in a wrong output. The probabilities should add up and not be overwritten.
I know it is just a quit but in my opinion students should not be encouraged to write wrong code.
A simple solution (assuming the map is cyclic) could be
In Term 2 Lesson 11 the solution for the quiz Initialize Priors Function contains code which just works for the given example.
Changing the landmarks line from
std::vector<float> landmark_positions {5, 10, 20};
tostd::vector<float> landmark_positions {0, 10, 20};
for example throws an error because the prior vector is accessed at -1.Even worse setting two landmarks next to each other
std::vector<float> landmark_positions {9, 10, 20};
results in a wrong output. The probabilities should add up and not be overwritten.I know it is just a quit but in my opinion students should not be encouraged to write wrong code.
A simple solution (assuming the map is cyclic) could be