-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,7 @@ | |
| import os | ||
|
|
||
| def find_files(substring, path): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function find_files refactored with the following changes:
|
||
| results = [] | ||
| for f in os.listdir(path): | ||
| if substring in f: | ||
| results.append(os.path.join(path, f)) | ||
| return results | ||
| return [os.path.join(path, f) for f in os.listdir(path) if substring in f] | ||
|
|
||
| # E.g. | ||
| # find_files('Untitled', '/Users/sebastian/Desktop/') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,11 +16,7 @@ def likelihood_poisson(x, lam): | |
| Poisson distribution | ||
|
|
||
| """ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function likelihood_poisson refactored with the following changes:
|
||
| if x // 1 != x: | ||
| likelihood = 0 | ||
| else: | ||
| likelihood = math.e**(-lam) * lam**(x) / math.factorial(x) | ||
| return likelihood | ||
| return 0 if x // 1 != x else math.e**(-lam) * lam**x / math.factorial(x) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,7 @@ def comp_theta_mle(d): | |
| dataset for a Rayleigh distribution. | ||
|
|
||
| """ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function comp_theta_mle refactored with the following changes:
|
||
| theta = len(d) / sum([x**2 for x in d]) | ||
| return theta | ||
| return len(d) / sum(x**2 for x in d) | ||
|
|
||
| def likelihood_ray(x, theta): | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function values_in_col refactored with the following changes: