davidhallac/TICC

example.py iteration problem

Closed this issue · 3 comments

Hello,
Could you please help me with this.

Here are some situations about my computer: Anaconda3,Python 2.7.13,sklearn 0.19,
Win10(64bit), RAM 8G.

First of all, I ran your code example.py, but the following error occurred, and python process hanged, so I suspect that the problem is the amount of data, but when I reduce the amount of data to 402 lines, the problem still exists.

UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
warnings.warn(_use_error_msg)
lam_sparse 0.11
switch_penalty 600
num_cluster 8
num stacked 1
completed getting the data
ITERATION ### 0

During this period, my computer's memory usage rate was about 66%, and the CPU usage rate was about 26%. Next I started debug and found that the problem may appear in the 139-line loop in TICC_solver.py, but I can not solve it.

for cluster in xrange(num_clusters):
if optRes[cluster] == None:
continue
val = optRes[cluster].get()
print "OPTIMIZATION for Cluster #", cluster,"DONE!!!"

Then I started using @mohataher ‘s improved code and it worked (402 rows of data). However, when looping to 42 passes, the following error occurred.

ITERATION ### 42
OPTIMIZATION for Cluster # 0 DONE!!!
D:/Workplace/tool_wear_pred/TICC/TICC_solver.py:337: RuntimeWarning: Degrees of freedom <= 0 for slice
S = np.cov(np.transpose(D_train))
D:\Anaconda\envs\TICC\lib\site-packages\numpy\lib\function_base.py:3088: RuntimeWarning: divide by zero encountered in double_scalars
c *= 1. / np.float64(fact)
D:\Anaconda\envs\TICC\lib\site-packages\numpy\lib\function_base.py:3088: RuntimeWarning: invalid value encountered in multiply
c *= 1. / np.float64(fact)

Traceback (most recent call last):

File "", line 1, in
runfile('D:/Workplace/tool_wear_pred/TICC/TICC_solver.py', wdir='D:/Workplace/tool_wear_pred/TICC')
File "D:\Anaconda\envs\TICC\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "D:\Anaconda\envs\TICC\lib\site-packages\spyder\utils\site\sitecustomize.py", line 86, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "D:/Workplace/tool_wear_pred/TICC/TICC_solver.py", line 383, in
(cluster_assignment, cluster_MRFs) = ticc.fit(input_file=fname)
File "D:/Workplace/tool_wear_pred/TICC/TICC_solver.py", line 125, in fit
train_cluster_inverse)
File "D:/Workplace/tool_wear_pred/TICC/TICC_solver.py", line 301, in optimize_clusters
val = optRes[cluster].get()
File "D:\Anaconda\envs\TICC\lib\multiprocessing\pool.py", line 567, in get
raise self._value

LinAlgError: Eigenvalues did not converge

So I hope you can give me some help or advice so that it can be solved. I keenly appreciate your time!

I think the issue (on the original TICC solver) is the same as this one: #17. It has to do with the fact that Windows doesn't play nicely with Python's multiprocessing package. Do you by chance have a Linux/Mac machine that you can run it on instead? If so, that would be the easiest way to get it up and running ASAP!

For @mohataher ‘s solver, we are still in the process of writing some unit tests to validate his changes before merging them into the main branch, but we hope to have it fully integrated soon.

Thank you for your reply! I have read #17 that discussion, and I will try to run on other systems.
Thank you again for your efforts!!!

Sounds great, please let us know if you have any other questions!