Open mattagape opened 5 years ago
Problem statement:
Instructions (in bullet points):
Solution:
simulate
: Change string formatting from 'Energy = %f'% energy
to 'Energy = {}'.format(energy)
?test_move_particle_one_over
: "Check density is change" -> "changed"test_input_sanity
: "Check incorrect input do fail" -> "Check incorrect inputs [do] fail" (or something else). Also missing period at the end.test_accept_change
: Missing period at the endtest_accept_change
: In final lines, strange comma in assertion? Also don't need the float
in Python 3(?)test_main_algorithm
: Missing spaces between list elements in last line
what do we mean by density?
In MonteCarlo::random_agent(), what does enumerate() do?
In energy(), what is the coefficient for? It doesn't seem to be Beta, the coefficient mentioned above.
In accept_change(), how do we know that we should implement the following line? return exp(-(successor - prior) / self.temperature) > uniform()
What does this do? import sys sys.path.append('DiffusionExample')
In def test_move_particle_one_over(): "change" should be "changed"
In same function, what does multiply.reduce do?
In def test_equal_probability(): energy = MagicMock() But in def test_accept_change(): energy = MagicMock Do the missing brackets matter?
In def test_equal_probability(): It looks like changes_at_zero is a list of booleans. I'm not sure what the next line is doing or how: assert count_nonzero(changes_at_zero),etc.
In def test_accept_change(): please explain the final assertion.
NB Maybe some of this code isn't essential to be understood line-by-line??
In def test_main_algorithm(): I don't really understand what the Mocks are doing with their side effects This relates to issue 86
Error at end of page - UsageError: Cell magic
%%cmd
not found. - presumably it should be %%bash, although if we're not going to be using notebooks I guess this error doesn't matter