0

I would like to use DictVectorize from Scikit-learn, but initialize it with numpy.float32 instead of the default numpy.float64. I tried to do it like this:

from sklearn.feature_extraction import DictVectorizer
vec = DictVectorizer(dtype=<type 'np.float32'>,sparse=False)

but this is not working. Is there any other way to do it?

1 Answer 1

4

That's not valid Python syntax. It's

import numpy as np
DictVectorizer(dtype=np.float32, sparse=False)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.