1

I'm a novice in Python. I just applied an existing Positive-unlabeled learning package online to my data. However, although it ran well before, recently I got such errors for the first time. Does anybody know what might be wrong and how to fix this?

ArithmeticError                           Traceback (most recent call last)
File D:\anaconda\lib\site-packages\cvxopt\misc.py:1429, in kkt_chol2.<locals>.factor(W, H, Df)
   1428 if type(F['S']) is matrix: 
-> 1429     lapack.potrf(F['S']) 
   1430 else:

ArithmeticError: 1090

During handling of the above exception, another exception occurred:

ArithmeticError                           Traceback (most recent call last)
File D:\anaconda\lib\site-packages\cvxopt\coneprog.py:2065, in coneqp(P, q, G, h, dims, A, b, initvals, kktsolver, xnewcopy, xdot, xaxpy, xscal, ynewcopy, ydot, yaxpy, yscal, **kwargs)
   2064 for rti in W['rti']: rti[::rti.size[0]+1 ] = 1.0
-> 2065 try: f = kktsolver(W)
   2066 except ArithmeticError:

File D:\anaconda\lib\site-packages\cvxopt\coneprog.py:1981, in coneqp.<locals>.kktsolver(W)
   1980 def kktsolver(W):
-> 1981     return factor(W, P)

File D:\anaconda\lib\site-packages\cvxopt\misc.py:1444, in kkt_chol2.<locals>.factor(W, H, Df)
   1443 if type(F['S']) is matrix: 
-> 1444     lapack.potrf(F['S']) 
   1445 else:

ArithmeticError: 26

It says that During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
Input In [30], in <cell line: 1>()
----> 1 rolling_window_collection()

Input In [29], in rolling_window_collection()
     46     globals()[key.replace('df',method+'_labeling_model')] = globals()[key.replace('df',methods[0]+'_labeling_model')]
     47     print('Variable created: '+ key.replace('df',method+'_labeling_model'))
---> 48     train_and_val(method,dataframe_name=key)           
     50 print('  --------------------- detect training years ---------------------')
     52 print('\nDetection results on the whole training dataframe:')

Input In [23], in train_and_val(method, dataframe_name)
     71     x_train_ram = x_train
     72     s_train_ram = s_train
---> 73 (_, c_est) = wrapper_ramaswamy(x_train_ram, x_train_ram[s_train_ram == 1])
     74 f_model = pu_learn_scar_c(x_train, s_train, c_est, classification_model_type(), classification_attributes=classification_attributes)
     75 e_model = NoFeaturesModel(c_est)

File ~\OneDrive\桌面\km\Kernel_MPE_grad_threshold.py:152, in wrapper(X_mixture, X_component)
    150 best_width,kernel=compute_best_rbf_kernel_width(X_mixture,X_component)                 
    151 lambda_values=np.array([1.00,1.05])                                
--> 152 dists=get_distance_curve(kernel,lambda_values,N=N,M=M)
    153 begin_slope=(dists[1]-dists[0])/(lambda_values[1]-lambda_values[0])
    154 dist_diff = np.concatenate((np.ones((N, 1)) / N, -1 * np.ones((M,1)) / M))

File ~\OneDrive\桌面\km\Kernel_MPE_grad_threshold.py:66, in get_distance_curve(kernel, lambda_values, N, M)
     61 for lambda_value in lambda_values:
     62     u_lambda = lambda_value / N * np.concatenate((np.ones((N, 1)),
     63             np.zeros((M, 1)))) + (1 - lambda_value) / M \
     64         * np.concatenate((np.zeros((N, 1)), np.ones((M, 1))))
     65     (solution, distance_sqd) = \
---> 66         find_nearest_valid_distribution(u_lambda, kernel, initial=prev_soln)
     67     prev_soln = solution
     68     d_lambda.append(sqrt(max(0,distance_sqd)))

File ~\OneDrive\桌面\km\Kernel_MPE_grad_threshold.py:32, in find_nearest_valid_distribution(u_alpha, kernel, initial, reg)
     30 dims = {'l': n, 'q': [], 's': []}
     31 solvers.options['show_progress'] = False
---> 32 solution = solvers.coneqp(
     33     P,
     34     q,
     35     G,
     36     h,
     37     dims,
     38     A,
     39     b,
     40     initvals=initial
     41     )
     42 distance_sqd = solution['primal objective'] + np.dot(u_alpha.T,
     43         np.dot(kernel, u_alpha))[0, 0]
     44 return (solution, distance_sqd)

File D:\anaconda\lib\site-packages\cvxopt\coneprog.py:2067, in coneqp(P, q, G, h, dims, A, b, initvals, kktsolver, xnewcopy, xdot, xaxpy, xscal, ynewcopy, ydot, yaxpy, yscal, **kwargs)
   2065 try: f = kktsolver(W)
   2066 except ArithmeticError:
-> 2067     raise ValueError("Rank(A) < p or Rank([P; A; G]) < n")
   2070 # Solve
   2071 #
   2072 #     [ P   A'  G' ]   [ x ]   [ -q ]
   2073 #     [ A   0   0  ] * [ y ] = [  b ].
   2074 #     [ G   0  -I  ]   [ z ]   [  h ]
   2076 xcopy(q, x)

ValueError: Rank(A) < p or Rank([P; A; G]) < n

What confuses me is that the code ran well before but suddenly gets these errors. I would appreciate it if you can provide me with some clues. Thanks!

Lexi
  • 11
  • 1

0 Answers0