以下是我的多類感知器算法代碼。在這里,我試圖更新列表列表給出的權重向量 - 權重。邏輯是正確的,它在 1 次迭代中正確執行。列表的權重列表初始化為全部 0。在第一個迭代中,權重列表會更新,但在后續迭代中,該列表不會更新。我不明白我做錯了什么?請幫忙。謝謝代碼: **import numpy as npdata = open("mnist_data_training.csv",'r')weights = [[0 for _ in range(784)] for _ in range(10)]for _ in range(0,3): for row in data: lst_row = (row.rstrip('\n').split(',')) list_row = lst_row[:-1] if (max_weight_index != (lst_row[784])): weights[lst_row[784]] = np.add(weights[lst_row[784]],list_row) **# Updating weight vector here** weights[max_weight_index] = numpy.subtract(weights[max_weight_index],list_row) **#Updating weight vector here**GitHub 鏈接 - https://github.com/sudhakosuri/Multi-Class-Perceptron.git
添加回答
舉報
0/150
提交
取消