|
tfmatrix = numpy.array(numpy.transpose(tfmatrix.collect())) |
In the code:
idfvector = numpy.array(numpy.transpose(idfvector))
both np.transpose() and np.array() return a NumPy array, so wrapping the result of np.transpose() in np.array() is redundant and causes unnecessary memory copying.
Moreover, it's more efficient and idiomatic to use the .T shorthand for transposition:
idfvector = idfvector.T
This avoids redundant operations, improves readability, and performs better, especially in performance-sensitive code.
summarizer/lsa.py
Line 43 in 373aedf
In the code:
idfvector = numpy.array(numpy.transpose(idfvector))both np.transpose() and np.array() return a NumPy array, so wrapping the result of np.transpose() in np.array() is redundant and causes unnecessary memory copying.
Moreover, it's more efficient and idiomatic to use the .T shorthand for transposition:
idfvector = idfvector.TThis avoids redundant operations, improves readability, and performs better, especially in performance-sensitive code.