I have the following
(Pdb) training
array(<418326x223957 sparse matrix of type '<type 'numpy.float64'>'
with 165657096 stored elements in Compressed Sparse Row format>, dtype=object)
(Pdb) training.shape
()
Why is there no shape information?
EDIT: this was what I've done:
training, target, test, projectids = generate_features(outcomes, projects, resources)
target = np.array([1. if i == 't' else 0. for i in target])
projectids = np.array([i for i in projectids])
print 'vectorizing training features'
d = DictVectorizer(sparse=True)
training = d.fit_transform(training[:10].T.to_dict().values())
#test_data = d.fit_transform(training.T.to_dict().values())
test_data = d.transform(test[:10].T.to_dict().values())
print 'training shape: %s, %s' %(training.shape[0], training[1])
print 'test shape: %s, %s' %(test_data.shape[0], test_data[1])
print 'saving vectorized instances'
with open(filename, "wb") as f:
np.save(f, training)
np.save(f, test_data)
np.save(f, target)
np.save(f, projectids)
At this point of time, my training's shape was still (10, 121)
.
Later on, I just reinitialize the 4 variables by
with open("../data/f1/training.dat", "rb") as f:
training = np.load(f)
test_data = np.load(f)
target = np.load(f)
projectids = np.load(f)
but the shape was gone.