'setting an array element with sequence. The reqsted array has an inhomogenous shape after 1 dimnsions.The detectd shap was (1812,) +inhomogeneous part
I'm using 2 datasets.
sstdataset, for which the code is working completely fine.- but, when I use the same code for the
booksdataset(taken from amazon), I'm getting the error.
def make_idx_data_cv(revs, word_idx_map, cv, max_l=51, k=300, filter_h=5):
"""
Transforms sentences into a 2-d matrix.
"""
train, test = [], []
for rev in revs:
sent = get_idx_from_sent(rev["text"], word_idx_map, max_l, k, filter_h)
sent.append(rev["y"])
if rev["split"]==cv:
test.append(sent)
else:
train.append(sent)
train = np.array(train,dtype="int")
test = np.array(test,dtype="int")
return [train, test]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
