Matti Lyra

Brighton, United Kingdom

Age: 32

I am a PhD student at the University of Sussex studying Computational Linguistics. My research topic is text classification in imbalanced data streams.

Feb
20
comment Difference between np.int, np.int_, int, and np.int_t in cython?
@richizy you can't use np.int_ in a cdef type declaration because it is not a compile time datatype cdef np.int_ a = 1 throws an error. You have to use np.int_t. You can take np.int_ in as a variable (without declaring the type) and use it, but it'll have to go through some Python code to figure out the runtime datatype. Compile a file with cython -a and check the html output, all the yellow lines have Python on them and will suffer in terms of speed, inside loops you don't want to have any yellow lines.
Feb
18
comment How does gmail extract time and date from text
@AnubhavAgarwal do you mind accepting the answer then?
Feb
18
revised Code optimization: while or for (or anything else)?
added 10 characters in body
Feb
18
comment Code optimization: while or for (or anything else)?
@MatteoNNZ I realised that the [0] * offset is costing you the most, so replacing that with itertools.repeat makes things go even faster, see prefix5
Feb
18
revised Code optimization: while or for (or anything else)?
added a better solution
Feb
18
comment Code optimization: while or for (or anything else)?
@MatteoNNZ see update above
Feb
18
revised Code optimization: while or for (or anything else)?
added 1287 characters in body
Feb
18
comment Code optimization: while or for (or anything else)?
@MatteoNNZ how do you mean my opinion about the problem?
Feb
18
answered Code optimization: while or for (or anything else)?
Feb
18
comment Difference between np.int, np.int_, int, and np.int_t in cython?
You can't use when instantiating numpy arrays np.zeros(5, 5, dtype=np.int_t) will throw an error where as np.zeros(5, 5, dtype=np.int_) won't. You can use it to declare the type of the array though np.ndarray[np.int_t] a = ... and since it's a compile time thing you'll get early warnings anyway.
Feb
18
comment Difference between np.int, np.int_, int, and np.int_t in cython?
@larsmans well that's what it says in the numpy docs
Feb
18
comment How does gmail extract time and date from text
@AnubhavAgarwal let's meet this friday or 6 PM tonight would certainly need dependency parsing to get right because relating the or is basically impossible otherwise. The parse tree would mark the or to be separating the two noun phrases around it, allowing you to tell the difference.
Feb
18
revised Difference between np.int, np.int_, int, and np.int_t in cython?
added 87 characters in body
Feb
18
answered Difference between np.int, np.int_, int, and np.int_t in cython?
Feb
18
revised Why Huffman Coding is good?
added 238 characters in body
Feb
18
answered Why Huffman Coding is good?
Feb
18
revised How does gmail extract time and date from text
added examples
Feb
18
answered How does gmail extract time and date from text
Feb
18
awarded Caucus
Feb
13
revised Which Python memory profiler is recommended?
added a not about cherrypy 3.x
1 2 3 4 5