矩阵相乘法

example = [-1, -0.6, -0.2, 0.2, 0.6, 1]
xxx = [(a, b, c) for a in example for b in example for c in example][:3]
print(xxx)
import pandas as pd

aaa = pd.DataFrame.from_records(xxx, columns=['w1', 'w2', 'w3'])
bbb = pd.DataFrame.from_records(xxx, columns=['d1', 'd2', 'd3'])
# print(aaa.loc[:, ['w1', ]])
# print(bbb.loc[:, ['d1', ]])
# print(bbb)


# print((aaa['w1'].to_numpy()))
a = (aaa.loc[:, ['w3', ]].to_numpy())
b = (bbb.loc[:, ['d3', ]].T.to_numpy())
print(a)
print(b)
xx = a.dot(b)

print(xx)
# print((aaa['w1'].to_numpy()).dot(bbb['d1'].to_numpy()))
# print(bbb['d1'].T)

你可能感兴趣的:(numpy,python,机器学习)