Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 10, 2023
commit c08165bc22058fb53011433d43cf092912777408
19 changes: 14 additions & 5 deletions machine_learning/decision_tree_churn/churn_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@
# print(df.head())

# Sorting the dependent and independent values
x = df[['CreditScore', 'Age', 'Tenure', 'Balance', 'NumOfProducts',
'HasCrCard', 'IsActiveMember', 'EstimatedSalary']].values
y = df['Exited']
x = df[
[
"CreditScore",
"Age",
"Tenure",
"Balance",
"NumOfProducts",
"HasCrCard",
"IsActiveMember",
"EstimatedSalary",
]
].values
y = df["Exited"]

# Splitting the dataset into training and testing data
x_test, x_train, y_test, y_train = train_test_split(
x, y, test_size=0.3, random_state=3)
x_test, x_train, y_test, y_train = train_test_split(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

Expand Down
44 changes: 22 additions & 22 deletions neural_network/simple_adaline.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
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

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):

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_and

Please provide return type hint for the function: wght_cng_and. 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

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
Expand All @@ -54,7 +54,7 @@ def 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

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:
Expand All @@ -63,7 +63,7 @@ def and_gate(wgt, A, B, T, al):

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

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:
Expand Down