From 5e2d0f93aa6c40257fd94d6e2e76ebac5d7f4284 Mon Sep 17 00:00:00 2001 From: benjas <909336740@qq.com> Date: Wed, 24 Feb 2021 14:40:38 +0800 Subject: [PATCH] Fix. Some rules of PE8 --- .../generate_polynomials.cpython-37.pyc | Bin 1324 -> 1324 bytes .../generate_sinusoids.cpython-37.pyc | Bin 636 -> 636 bytes .../__pycache__/normalize.cpython-37.pyc | Bin 627 -> 627 bytes .../util/features/generate_polynomials.py | 5 +++-- .../util/features/generate_sinusoids.py | 1 + .../util/features/normalize.py | 4 ++-- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/__pycache__/generate_polynomials.cpython-37.pyc b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/__pycache__/generate_polynomials.cpython-37.pyc index 56f6e4c1ce9de47ffd5bbfc1607736b82cdd4a82..c500306338cdea0d21f59893cc31ffe83f9ab84f 100644 GIT binary patch delta 29 jcmZ3(wT6qwiIHq)$ diff --git a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/__pycache__/normalize.cpython-37.pyc b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/__pycache__/normalize.cpython-37.pyc index 911b745cd5e55aaf669a512db3c48aa29ece76a1..9587ade8c08ff08b6f5f4c0319c9d87223ec629e 100644 GIT binary patch delta 40 rcmey&@|lI#iIyW&`qy1wdjrV8JPgF`3D66 diff --git a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_polynomials.py b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_polynomials.py index 5db34e2..bca23e4 100644 --- a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_polynomials.py +++ b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_polynomials.py @@ -3,7 +3,8 @@ import numpy as np from .normalize import normalize -def generate_polynomials(dataset, polynomial_degree, normalize_data = False): + +def generate_polynomials(dataset, polynomial_degree, normalize_data=False): """变换方法: x1, x2, x1^2, x2^2, x1*x2, x1*x2^2, etc. """ @@ -40,4 +41,4 @@ def generate_polynomials(dataset, polynomial_degree, normalize_data = False): if normalize_data: polynomials = normalize(polynomials)[0] - return polynomials \ No newline at end of file + return polynomials diff --git a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_sinusoids.py b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_sinusoids.py index d9b106e..3bbd203 100644 --- a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_sinusoids.py +++ b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/generate_sinusoids.py @@ -1,5 +1,6 @@ import numpy as np + def generate_sinusoids(dataset, sinusoid_degree): """ sin(x). diff --git a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/normalize.py b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/normalize.py index a04ede7..d4db28c 100644 --- a/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/normalize.py +++ b/机器学习算法理论及应用/第二章——手写线性回归算法/util/features/normalize.py @@ -3,8 +3,8 @@ import numpy as np -def normalize(features): +def normalize(features): features_normalized = np.copy(features).astype(float) # 计算均值 @@ -21,4 +21,4 @@ def normalize(features): features_deviation[features_deviation == 0] = 1 features_normalized /= features_deviation - return features_normalized, features_mean, features_deviation \ No newline at end of file + return features_normalized, features_mean, features_deviation