0

8 GB RAM と Intel Core I5 プロセッサを搭載した Lenovo IdeaPad ラップトップを持っています。100次元ごとに60kのデータポイントがあります。KNN を実行したいので、LMNN アルゴリズムを実行してマハラノビス メトリックを見つけます。
問題は、ubuntu で 2 時間実行した後に空白の画面が表示されることです。何が問題なのかわかりません!私のメモリがいっぱいになっていますか、それとも何か他のものですか?
この私のコードを最適化する方法はありますか?

私のデータセット: data
私の LMNN 実装:

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()
4

1 に答える 1