7 for i in range(m):
8 idx = record[i:] != 0
----> 9 rating_mean[i] = np.mean(rating[i,idx])
10 rating_norm[i,idx] -= rating_mean[i]
11 return rating_norm,rating_mean
IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed
8 idx = record[i:] != 0
----> 9 rating_mean[i] = np.mean(rating[i,idx])
10 rating_norm[i,idx] -= rating_mean[i]
11 return rating_norm,rating_mean
IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed
2021-05-13
最新回答 / 不会写代码的小郭i
2.0以上版本把代码改为:optimizer = tf.compat.v1.train.AdamOptimizer(1e-4)train = optimizer.minimize(loss)
2020-10-10
最新回答 / 慕函数8562618
# 需要将TensorFlow版本设置为1.x%tensorflow_version 1.ximport tensorflow as tftf.__version__
2020-06-29