Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fangfang Wang HW8 #149

Merged
merged 1 commit into from
Dec 2, 2014
Merged

Fangfang Wang HW8 #149

merged 1 commit into from
Dec 2, 2014

Conversation

ffCrack
Copy link

@ffCrack ffCrack commented Nov 25, 2014

Approaches to debug:
There are 3 functions defined in the code, I checked the functions one
by one, and validated by plugging in trial parameters.
Firstly, I checked the syntax errors.
At the apply_optimizer() function, I deleted the "," following
"function_calls".
Currently, I didn't notice any runtime error. Then I checked the
semantic errors.
In the code of compare_optimizers(optimizers), I noticed that in the
for loop, "for optimizer in OPTIMIZERS:", since the parameter taken is
"optimizers", I changed it to "for optimizer in optimizers:"
After correcting the above error, I noticed that the total calls of
brentq, ridder, bisect algorithms were all 0, only the first
algorithm's number of calls output is around 602000. Actually, I'm
still not quite confident in explaining this. But this could possibly
be because the 2nd to 4th algorithms took the optimizer calculated from
the first algorithm as the initial value, so it reached the desired
value at the 1st iteration. I also tested this assumption by running
the two algorithms consecutively using some test numbers. This won't
compare the efficiency of the 4 algorithms, so I move the code of
creating random arrays random_a and random_b into the loop, so this
will let each algorithm's initial value to be different of the
optimizer.
In addition,I notice that the above code will throw valueError
excepetion when the interval [a,b] does not contain 0.

Approaches to debug:
There are 3 functions defined in the code, I checked the functions one
by one, and validated by plugging in trial parameters.
Firstly, I checked the syntax errors.
At the apply_optimizer() function, I deleted the "," following
"function_calls".
Currently, I didn't notice any runtime error. Then I checked the
semantic errors.
In the code of compare_optimizers(optimizers), I noticed that in the
for loop, "for optimizer in OPTIMIZERS:", since the parameter taken is
"optimizers", I changed it to "for optimizer in optimizers:"
After correcting the above error, I noticed that the total calls of
brentq, ridder, bisect algorithms were all 0, only the first
algorithm's number of calls output is around 602000. Actually, I'm
still not quite confident in explaining this. But this could possibly
be because the 2nd to 4th algorithms took the optimizer calculated from
the first algorithm as the initial value, so it reached the desired
value at the 1st iteration. I also tested this assumption by running
the two algorithms consecutively using some test numbers. This won't
compare the efficiency of the 4 algorithms, so I move the code of
creating random arrays random_a and random_b into the loop, so this
will let each algorithm's initial value to be different of the
optimizer.
In addition,I notice that the above code will throw valueError
excepetion when the interval [a,b] does not contain 0.
@jakevdp
Copy link
Contributor

jakevdp commented Dec 2, 2014

Looks good – thanks!

jakevdp added a commit that referenced this pull request Dec 2, 2014
@jakevdp jakevdp merged commit fc66ad1 into uw-python:master Dec 2, 2014
@ffCrack
Copy link
Author

ffCrack commented Dec 3, 2014

Hi Jake,
Just want to double check that you've got my 6 homework: HW2,3,4,6,7,8, meeting the requirement of the class.
Thanks so much!
Fangfang Wang

@jakevdp
Copy link
Contributor

jakevdp commented Dec 8, 2014

Hi – I'm just going over all of this today. Yes, I have those six assignments from you. Thanks!

@ffCrack
Copy link
Author

ffCrack commented Dec 9, 2014

Thanks so much Jake and I really enjoy working on this course!
Fangfang

On Mon, Dec 8, 2014 at 10:38 AM, Jake Vanderplas [email protected]
wrote:

Hi – I'm just going over all of this today. Yes, I have those six
assignments from you. Thanks!


Reply to this email directly or view it on GitHub
#149 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants