Code: Alles auswählen
fail=[]
y = []
y.append(first[0][0])
z = []
for i in range(len(first)):
if first[i][0] == y[0]:
z.append(first[i][1])
else:
fail.append(z)
for r in range(15-len(z)):
z.append('0')
z = []
y[0]=first[i][0]
z.append(first[i][1])
defe=[]
y = []
y.append(second[0][0])
s = []
for i in range(len(second)):
if second[i][0] == y[0]:
s.append(second[i][1])
else:
defe.append(s)
for t in range(6-len(s)):
s.append('0')
s = []
y[0]=second[i][0]
s.append(second[i][1])
#print(defe)
X = np.array(fail,dtype=object)
y = np.array(defe,dtype=object)
print(X)
print(y)
print(X.shape, y.shape)
# summarize first few examples
for i in range(10):
print(X[i], y[i])
print(X.shape[1])
Für x wird ausgegeben:
[list([41, 88, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'])
list([3, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'])
list([3, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'])
...
list([425, 433, 446, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'])
list([139, 426, 433, 446, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'])
list([120, 208, 204, 250, 244, 426, 430, 433, 446, 473, '0', '0', '0', '0', '0'])]
und für y:
[[364 '0' '0' '0' '0' '0']
[144 '0' '0' '0' '0' '0']
[144 '0' '0' '0' '0' '0']
...
[460 498 '0' '0' '0' '0']
[510 '0' '0' '0' '0' '0']
[510 '0' '0' '0' '0' '0']]
Wisst Ihr woran das liegt, denn für das Modell müssen beide listen den selben shape haben.
Danke für eure Antworten,
Lukas