[mypy] fix small folders 2 (#4293)

* Update perceptron.py

* Update binary_tree_traversals.py

* fix machine_learning

* Update build.yml

* Update perceptron.py

* Update machine_learning/forecasting/run.py

Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
algobytewise
2021-03-26 16:51:16 +05:30
committed by GitHub
parent 959507901a
commit 9b60be67af
6 changed files with 22 additions and 13 deletions

View File

@ -29,8 +29,7 @@ def linear_regression_prediction(
>>> abs(n - 5.0) < 1e-6 # Checking precision because of floating point errors
True
"""
x = [[1, item, train_mtch[i]] for i, item in enumerate(train_dt)]
x = np.array(x)
x = np.array([[1, item, train_mtch[i]] for i, item in enumerate(train_dt)])
y = np.array(train_usr)
beta = np.dot(np.dot(np.linalg.inv(np.dot(x.transpose(), x)), x.transpose()), y)
return abs(beta[0] + test_dt[0] * beta[1] + test_mtch[0] + beta[2])

View File

@ -200,7 +200,7 @@ if False: # change to true to run this test case.
def ReportGenerator(
df: pd.DataFrame, ClusteringVariables: np.array, FillMissingReport=None
df: pd.DataFrame, ClusteringVariables: np.ndarray, FillMissingReport=None
) -> pd.DataFrame:
"""
Function generates easy-erading clustering report. It takes 2 arguments as an input:

View File

@ -61,7 +61,7 @@ def term_frequency(term: str, document: str) -> int:
return len([word for word in tokenize_document if word.lower() == term.lower()])
def document_frequency(term: str, corpus: str) -> int:
def document_frequency(term: str, corpus: str) -> tuple[int, int]:
"""
Calculate the number of documents in a corpus that contain a
given term