This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Compile the PROPACK package | |
% Copyright LI, Wei(@kuantkid) | |
% detect gfortran | |
switch (lower(computer)) | |
case 'glnxa64' | |
fc = 'gfortran'; | |
suffix = 'mexa64'; | |
case 'glnxa32' | |
fc = 'gfortran'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _centers(X, labels, n_clusters, distances): | |
"""M step of the K-means EM algorithm | |
Computation of cluster centers / means. | |
Parameters | |
---------- | |
X: array, shape (n_samples, n_features) | |
labels: array of integers, shape (n_samples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.utils import validation | |
a = np.ones([10,10], dtype=np.uint) | |
b = np.ones([10,10], dtype=np.uint) | |
c = np.ones([10,10], dtype=np.int) | |
d = np.ones([10,10], dtype=np.bool) | |
validation.warn_if_not_float(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.sparse import csr_matrix | |
from sklearn.metrics.pairwise import manhattan_distances | |
A = csr_matrix(np.array([[1,2,3],[8,9,0]],dtype=np.float)) | |
B = csr_matrix(np.array([[1,2,4],[3,4,5]],dtype=np.float)) | |
C = manhattan_distances(A, B) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change the include line in Makefile | |
INCLUDES := -DCUDA_5 -I$(PYTHON_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I$(CUDA_SDK_PATH) -I./include -I./include/common -I./include/cudaconv2 -I./include/nvmatrix -I./dummyinclude/ |