8GB RAM 및 Intel Core I5 프로세서가 장착 된 Lenovo IdeaPad 노트북이 있습니다. 나는 각각 100 차원 데이터 포인트가 60k이다. 나는 KNN을하고 싶다. 그리고 Maharanobis Metric을 찾기 위해 LMNN 알고리즘을 실행하고있다.
문제는 2 시간 정도 지나면 우분투에 빈 화면이 나타납니다. 나는 문제가 무엇인지 알지 못한다! 내 기억이 가득 차 있거나 다른 것이 있습니까?
내 코드를 최적화 할 수있는 방법이 있습니까?
내 데이터 세트 : data
내 LMNN 구현 :평범한 노트북에 중간 크기의 데이터 세트가있는 ML 알고리즘을 성공적으로 실행하는 방법은 무엇입니까?
import numpy as np
import sys
from modshogun import LMNN, RealFeatures, MulticlassLabels
from sklearn.datasets import load_svmlight_file
def main():
# Get training file name from the command line
traindatafile = sys.argv[1]
# The training file is in libSVM format
tr_data = load_svmlight_file(traindatafile);
Xtr = tr_data[0].toarray(); # Converts sparse matrices to dense
Ytr = tr_data[1]; # The trainig labels
# Cast data to Shogun format to work with LMNN
features = RealFeatures(Xtr.T)
labels = MulticlassLabels(Ytr.astype(np.float64))
# Number of target neighbours per example - tune this using validation
k = 18
# Initialize the LMNN package
lmnn = LMNN(features, labels, k)
init_transform = np.eye(Xtr.shape[1])
# Choose an appropriate timeout
lmnn.set_maxiter(200000)
lmnn.train(init_transform)
# Let LMNN do its magic and return a linear transformation
# corresponding to the Mahalanobis metric it has learnt
L = lmnn.get_linear_transform()
M = np.matrix(np.dot(L.T, L))
# Save the model for use in testing phase
# Warning: do not change this file name
np.save("model.npy", M)
if __name__ == '__main__':
main()
작은 세트로 결과를 얻으셨습니까? – Julien
예, 결과가 작아집니다. 즉 60K가 아닌 약 0.5K 데이터 포인트를 갖는다. – Fenil
분명히 코드로 문제가되지 않는 데이터를 처리하려면 더 많은 프로세서와 램이 필요합니다. –