Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flake8](http://flake8.pycqa.org) testing of https://github.com/apachecn/AiLearning on Python 3.7.1 $ __flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics__ ``` ./src/py2.x/dl/perceptron.py:62:68: E999 SyntaxError: invalid syntax return self.activator(reduce(lambda a, b: a + b,map(lambda (x, w): x * w, zip(input_vec, self.weights)), 0.0) + self.bias) ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:9:30: F821 undefined name 'load_data_set' data_mat, class_labels = load_data_set('../../../input/7.AdaBoost/horseColicTraining2.txt') ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:11:37: F821 undefined name 'ada_boost_train_ds' weak_class_arr, agg_class_est = ada_boost_train_ds(data_mat, class_labels, 40) ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:16:5: F821 undefined name 'plot_roc' plot_roc(agg_class_est.T, class_labels) ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:17:37: F821 undefined name 'load_data_set' data_arr_test, label_arr_test = load_data_set("../../../input/7.AdaBoost/horseColicTest2.txt") ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:18:9: F821 undefined name 'np' m = np.shape(data_arr_test)[0] ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:19:20: F821 undefined name 'ada_classify' predicting10 = ada_classify(data_arr_test, weak_class_arr) ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:20:15: F821 undefined name 'np' err_arr = np.mat(np.ones((m, 1))) ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:20:22: F821 undefined name 'np' err_arr = np.mat(np.ones((m, 1))) ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:23:35: F821 undefined name 'np' err_arr[predicting10 != np.mat(label_arr_test).T].sum(), ^ ./src/py3.x/ml/7.AdaBoost/roc_test.py:24:35: F821 undefined name 'np' err_arr[predicting10 != np.mat(label_arr_test).T].sum() / m ^ ./src/py3.x/16.RecommenderSystems/test_基于用户.py:74:28: F821 undefined name 'u' for v, wuv in sorted(W[u].items, key=itemgetter(1), reverse=True)[0:K]: ^ ./src/py3.x/16.RecommenderSystems/test_基于用户.py:74:73: F821 undefined name 'K' for v, wuv in sorted(W[u].items, key=itemgetter(1), reverse=True)[0:K]: ^ ./src/py3.x/16.RecommenderSystems/test_evaluation_model.py:22:16: F821 undefined name 'GetRecommendation' rank = GetRecommendation(user, N) ^ ./src/py3.x/16.RecommenderSystems/test_evaluation_model.py:36:16: F821 undefined name 'GetRecommendation' rank = GetRecommendation(user, N) ^ ./src/py3.x/16.RecommenderSystems/test_evaluation_model.py:51:16: F821 undefined name 'GetRecommendation' rank = GetRecommendation(user, N) ^ ./src/py3.x/16.RecommenderSystems/test_evaluation_model.py:68:16: F821 undefined name 'GetRecommendation' rank = GetRecommendation(user, N) ^ ./src/py3.x/16.RecommenderSystems/test_lfm.py:12:16: F821 undefined name 'items_pool' item = items_pool[random.randint(0, len(items_pool) - 1)] ^ ./src/py3.x/16.RecommenderSystems/test_lfm.py:12:49: F821 undefined name 'items_pool' item = items_pool[random.randint(0, len(items_pool) - 1)] ^ ./src/py3.x/16.RecommenderSystems/test_lfm.py:23:14: F821 undefined name 'InitModel' [P, Q] = InitModel(user_items, F) ^ ./src/py3.x/16.RecommenderSystems/test_lfm.py:26:23: F821 undefined name 'RandSelectNegativeSamples' samples = RandSelectNegativeSamples(items) ^ ./src/py3.x/16.RecommenderSystems/test_lfm.py:28:29: F821 undefined name 'Predict' eui = rui - Predict(user, item) ^ ./src/py3.x/16.RecommenderSystems/test_基于物品.py:10:18: F821 undefined name 'users' for i in users: ^ ./src/py3.x/16.RecommenderSystems/test_基于物品.py:12:22: F821 undefined name 'users' for j in users: ^ ./src/py3.x/16.RecommenderSystems/test_基于物品.py:21:18: F821 undefined name 'v' W[u][v] = cij / math.sqrt(N[i] * N[j]) ^ ./src/py3.x/16.RecommenderSystems/test_基于物品.py:30:18: F821 undefined name 'users' for i in users: ^ ./src/py3.x/16.RecommenderSystems/test_基于物品.py:32:22: F821 undefined name 'users' for j in users: ^ ./src/py3.x/16.RecommenderSystems/test_基于物品.py:41:18: F821 undefined name 'v' W[u][v] = cij / math.sqrt(N[i] * N[j]) ^ ./src/py3.x/dl/perceptron.py:192:22: F821 undefined name 'train_and_perceptron' and_perceptron = train_and_perceptron() ^ 1 E999 SyntaxError: invalid syntax 28 F821 undefined name 'GetRecommendation' 29 ``` __E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety. * F821: undefined name `name` * F822: undefined name `name` in `__all__` * F823: local variable name referenced before assignment * E901: SyntaxError or IndentationError * E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
- Loading branch information