-
-
Couldn't load subscription status.
- Fork 49k
added my code in 'machine_learning' and 'neural_network' folder #10243
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
Changes from 1 commit
31faa5f bb40ab3 578b159 0154cd4 c08165b 5f373c1 b3a7404 d5af854 669cf9d df219a0 7dd3fb5 537d850 38a8a0b e0f8aa1 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
for more information, see https://pre-commit.ci
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,51 @@ | ||
| def wght_cng_or(wgt, T, al): | ||
| ||
| O = wgt[0]*0+wgt[1]*0 | ||
| O = wgt[0] * 0 + wgt[1] * 0 | ||
| if O <= T: | ||
| Ol = wgt[0]*0+wgt[1]*1 | ||
| Ol = wgt[0] * 0 + wgt[1] * 1 | ||
| if Ol >= T: | ||
| Ole = wgt[0]*1+wgt[1]*0 | ||
| Ole = wgt[0] * 1 + wgt[1] * 0 | ||
| if Ole >= T: | ||
| Ola = wgt[0]*1+wgt[1]*1 | ||
| Ola = wgt[0] * 1 + wgt[1] * 1 | ||
| if Ola >= T: | ||
| return wgt | ||
| else: | ||
| wgt[0] = wgt[0]+al*1*1 | ||
| wgt[1] = wgt[1]+al*1*1 | ||
| wgt[0] = wgt[0] + al * 1 * 1 | ||
| wgt[1] = wgt[1] + al * 1 * 1 | ||
| return wght_cng_or(wgt, T, al) | ||
| else: | ||
| wgt[0] = wgt[0]+al*1*1 | ||
| wgt[1] = wgt[1]+al*1*0 | ||
| wgt[0] = wgt[0] + al * 1 * 1 | ||
| wgt[1] = wgt[1] + al * 1 * 0 | ||
| return wght_cng_or(wgt, T, al) | ||
| else: | ||
| wgt[0] = wgt[0]+al*1*0 | ||
| wgt[1] = wgt[1]+al*1*1 | ||
| wgt[0] = wgt[0] + al * 1 * 0 | ||
| wgt[1] = wgt[1] + al * 1 * 1 | ||
| return wght_cng_or(wgt, T, al) | ||
| else: | ||
| T += al | ||
| return wght_cng_or(wgt, T, al) | ||
| | ||
| | ||
| def wght_cng_and(wgt, T, al): | ||
| ||
| O = wgt[0]*0+wgt[1]*0 | ||
| O = wgt[0] * 0 + wgt[1] * 0 | ||
| if O <= T: | ||
| Ol = wgt[0]*0+wgt[1]*1 | ||
| Ol = wgt[0] * 0 + wgt[1] * 1 | ||
| if Ol <= T: | ||
| Ole = wgt[0]*1+wgt[1]*0 | ||
| Ole = wgt[0] * 1 + wgt[1] * 0 | ||
| if Ole <= T: | ||
| Ola = wgt[0]*1+wgt[1]*1 | ||
| Ola = wgt[0] * 1 + wgt[1] * 1 | ||
| if Ola >= T: | ||
| return wgt | ||
| else: | ||
| wgt[0] = wgt[0]+(al*1*1) | ||
| wgt[1] = wgt[1]+(al*1*1) | ||
| wgt[0] = wgt[0] + (al * 1 * 1) | ||
| wgt[1] = wgt[1] + (al * 1 * 1) | ||
| return wght_cng_and(wgt, T, al) | ||
| else: | ||
| wgt[0] = wgt[0]-(al*1*1) | ||
| wgt[1] = wgt[1]-(al*1*0) | ||
| wgt[0] = wgt[0] - (al * 1 * 1) | ||
| wgt[1] = wgt[1] - (al * 1 * 0) | ||
| return wght_cng_and(wgt, T, al) | ||
| else: | ||
| wgt[0] = wgt[0]-(al*1*0) | ||
| wgt[1] = wgt[1]-(al*1*1) | ||
| wgt[0] = wgt[0] - (al * 1 * 0) | ||
| wgt[1] = wgt[1] - (al * 1 * 1) | ||
| return wght_cng_and(wgt, T, al) | ||
| else: | ||
| T += al | ||
| | @@ -54,7 +54,7 @@ def wght_cng_and(wgt, T, al): | |
| | ||
| def and_gate(wgt, A, B, T, al): | ||
| ||
| wgt = wght_cng_and(wgt, T, al) | ||
| O = wgt[0]*A+wgt[1]*B | ||
| O = wgt[0] * A + wgt[1] * B | ||
| if O >= T: | ||
| return 1 | ||
| else: | ||
| | @@ -63,7 +63,7 @@ def and_gate(wgt, A, B, T, al): | |
| | ||
| def or_gate(wgt, A, B, T, al): | ||
| ||
| wgt = wght_cng_or(wgt, T, al) | ||
| O = wgt[0]*A+wgt[1]*B | ||
| O = wgt[0] * A + wgt[1] * B | ||
| if O >= T: | ||
| return 1 | ||
| else: | ||
| | ||
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.
Variable and function names should follow the
snake_casenaming convention. Please update the following name accordingly:decTree