Process finished with exit code -1073740940 (0xc0000374) using Scikit-learn KernelPCA

0

First of all, I tried to perform dimensionality reduction on my n_samples x 53 data using scikit-learn's Kernel PCA with precomputed kernel. The code worked without any issues when I tried using 50 samples at first. However, when I increased the number of samples into 100, suddenly I got the following message.

Process finished with exit code -1073740940 (0xC0000374)

Here's the detail of what I want to do:

I want to obtain the optimum value of kernel function hyperparameter in my Kernel PCA function, defined as the following.

from sklearn.decomposition.kernel_pca import KernelPCA as drm
from somewhere import costfunction
from somewhere_else import customkernel

def kpcafun(w,X):
    # X is sample
    # w is hyperparam

    n_princomp = 2
    drmodel = drm(n_princomp,kernel='precomputed')
    k_matrix = customkernel (X,X,w)
    transformed_x = drmodel.fit_transform(k_matrix)
    cost = costfunction(transformed_x)

    return cost

Therefore, to optimize the hyperparams I used the following code.

from scipy.optimize import minimize

# assume that wstart and optimbound are already defined
res = minimize(kpcafun, wstart, method='L-BFGS-B', bounds=optimbound, args=(X))

The strange thing is when I tried to debug the first 10 iterations of the optimization process, nothing strange has happened all values of the variables seemed normal. But, when I turned off the breakpoints and let the program continue the message appeared without any error notification.

Does anyone know what might be wrong with my code? Or anyone has some tips to resolve a problem like this?

Thanks

python
python-3.x
scikit-learn
pca
dimensionality-reduction
asked on Stack Overflow Oct 16, 2019 by Ghifari Adam Faza • edited Oct 16, 2019 by Ghifari Adam Faza

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0