I am a Python newbie and I have to do some simple work with it.
I use sklearn.mixture
methods to process the data, though, it takes too much time.
I have read somewhere here and have decided to cythonize these functions.
I have done python setup.py build_ext --inplace
on all *.py files from sklearn.mixture
as tutorial described. However, the timings for calling these methods remained absolutely the same. I have even renamed *.py files to be sure that compiled native libraries are linked.
My test application is presented below:
import os
import datetime
from sklearn import mixture
import pickle
def process():
with open('test_in', 'rb') as f:
mfcc = pickle.load(f)
time_start = datetime.datetime.now()
print(time_start.strftime("%Y-%m-%d %H:%M:%S.%f"))
gmm = mixture.GaussianMixture(n_components=10, max_iter=150)
voice_model = gmm.fit(mfcc)
time_end = datetime.datetime.now()
print(time_end.strftime("%Y-%m-%d %H:%M:%S.%f"))
delta = time_end - time_start
print('Delta: ' + str(delta))
with open('test_out', 'wb') as f:
pickle.dump(voice_model, f)
return
process()
So, could someone show me what I am doing wrong?
Is there another way to improve performance?