Skip to content

Conversation

IBR-41379
Copy link

@IBR-41379 IBR-41379 commented Oct 10, 2023

Describe your change:

added my code in 'machine_learning' and 'neural_network' folder

  • Add an algorithm?
  • --Dicsion Tree Classifier
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".
@algorithms-keeper algorithms-keeper bot added require descriptive names This PR needs descriptive function and/or variable names require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Oct 10, 2023
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

x, y, test_size=0.3, random_state=3)

# Creating the decision tree classifier
decTree = DecisionTreeClassifier(criterion="entropy", max_depth=4)

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_case naming convention. Please update the following name accordingly: decTree

decTree.fit(x_train, y_train)

# Predicting the values
predTree = decTree.predict(x_test)

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_case naming convention. Please update the following name accordingly: predTree

@@ -0,0 +1,81 @@
def wght_cng_or(wgt, T, al):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function wght_cng_or

Please provide return type hint for the function: wght_cng_or. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: wgt

Please provide type hint for the parameter: T

Please provide descriptive name for the parameter: T

Please provide type hint for the parameter: al

def wght_cng_or(wgt, T, al):
O = wgt[0]*0+wgt[1]*0
if O <= T:
Ol = wgt[0]*0+wgt[1]*1

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_case naming convention. Please update the following name accordingly: Ol

if O <= T:
Ol = wgt[0]*0+wgt[1]*1
if Ol >= T:
Ole = wgt[0]*1+wgt[1]*0

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_case naming convention. Please update the following name accordingly: Ole

def wght_cng_and(wgt, T, al):
O = wgt[0]*0+wgt[1]*0
if O <= T:
Ol = wgt[0]*0+wgt[1]*1

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_case naming convention. Please update the following name accordingly: Ol

if O <= T:
Ol = wgt[0]*0+wgt[1]*1
if Ol <= T:
Ole = wgt[0]*1+wgt[1]*0

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_case naming convention. Please update the following name accordingly: Ole

if Ol <= T:
Ole = wgt[0]*1+wgt[1]*0
if Ole <= T:
Ola = wgt[0]*1+wgt[1]*1

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_case naming convention. Please update the following name accordingly: Ola

return wght_cng_and(wgt, T, al)


def and_gate(wgt, A, B, T, al):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function and_gate

Please provide return type hint for the function: and_gate. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: wgt

Please provide type hint for the parameter: A

Please provide descriptive name for the parameter: A

Please provide type hint for the parameter: B

Please provide descriptive name for the parameter: B

Please provide type hint for the parameter: T

Please provide descriptive name for the parameter: T

Please provide type hint for the parameter: al

return 0


def or_gate(wgt, A, B, T, al):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function or_gate

Please provide return type hint for the function: or_gate. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: wgt

Please provide type hint for the parameter: A

Please provide descriptive name for the parameter: A

Please provide type hint for the parameter: B

Please provide descriptive name for the parameter: B

Please provide type hint for the parameter: T

Please provide descriptive name for the parameter: T

Please provide type hint for the parameter: al

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 10, 2023
@IBR-41379 IBR-41379 closed this Oct 10, 2023
@IBR-41379 IBR-41379 reopened this Oct 10, 2023
@algorithms-keeper algorithms-keeper bot removed require descriptive names This PR needs descriptive function and/or variable names require type hints https://docs.python.org/3/library/typing.html labels Oct 10, 2023
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.


from typing import List, Tuple

def weight_change_or(weight: List[float], threshold: float, learning_rate: float) -> List[float]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function weight_change_or

return weight_change_or(weight, threshold, learning_rate)


def weight_change_and(weight: List[float], threshold: float, learning_rate: float) -> List[float]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function weight_change_and

return weight_change_and(weight, threshold, learning_rate)


def and_gate(weight: List[float], input_a: int, input_b: int, threshold: float, learning_rate: float) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function and_gate

return 0


def or_gate(weight: List[float], input_a: int, input_b: int, threshold: float, learning_rate: float) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function or_gate

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 10, 2023
@IBR-41379 IBR-41379 closed this Oct 10, 2023
@IBR-41379 IBR-41379 reopened this Oct 10, 2023
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

@@ -0,0 +1,108 @@
# This program implements the AND and OR gates using the Adaline algorithm.
def weight_change_or(weight: list[float], threshold: float, learning_rate: float) -> list[float]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function weight_change_or

return weight_change_or(weight, threshold, learning_rate)


def weight_change_and(weight: list[float], threshold: float, learning_rate: float) -> list[float]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function weight_change_and

return weight_change_and(weight, threshold, learning_rate)


def and_gate(weight: list[float], input_a: int, input_b: int, threshold: float, learning_rate: float) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function and_gate

return 0


def or_gate(weight: list[float], input_a: int, input_b: int, threshold: float, learning_rate: float) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function or_gate

Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

@@ -0,0 +1,108 @@
# This program implements the AND and OR gates using the Adaline algorithm.
def weight_change_or(weight: list[float], threshold: float, learning_rate: float) -> list[float]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function weight_change_or

return weight_change_or(weight, threshold, learning_rate)


def weight_change_and(weight: list[float], threshold: float, learning_rate: float) -> list[float]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function weight_change_and

return weight_change_and(weight, threshold, learning_rate)


def and_gate(weight: list[float], input_a: int, input_b: int, threshold: float, learning_rate: float) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function and_gate

return 0


def or_gate(weight: list[float], input_a: int, input_b: int, threshold: float, learning_rate: float) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file neural_network/simple_adaline.py, please provide doctest for the function or_gate

@IBR-41379 IBR-41379 closed this Oct 10, 2023
@IBR-41379 IBR-41379 reopened this Oct 10, 2023
@algorithms-keeper algorithms-keeper bot removed the require tests Tests [doctest/unittest/pytest] are required label Oct 10, 2023
@IBR-41379 IBR-41379 closed this Oct 10, 2023
@IBR-41379 IBR-41379 reopened this Oct 10, 2023
@IBR-41379
Copy link
Author

I cannot understand why it is failing the test. Please help me understanding this. I worked a lot to make my programs good for this repository.

@cclauss
Copy link
Member

cclauss commented Oct 10, 2023

* [x] This PR only changes one algorithm file.

@cclauss cclauss closed this Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass

2 participants