Ejemplo n.º 1
0
if len(sys.argv) != 2:
    print(
        'Usage: \n"python3 KRR_script.py method"\nwhere method is one of linear polynomial gaussian laplacian'
    )
    sys.exit(1)

method = sys.argv[1]

path = "Saved matrices/04-01-2019 21.56/sorted_Cutoff25_noSingleElementKrystals/"
#%% Load training data
featureMatrixFile = "train_featureMatrix.npy"
atomicSymbolsListFile = "train_pickledAtomicSymbolsList.txt"
energiesFile = "train_pickledEnergies.txt"

largeFeatureMatrix, mappedAtomicNumber = simpleLargeMatrix(
    path, featureMatrixFile, atomicSymbolsListFile)

with open(path + energiesFile, "rb") as pickleFile:
    energies = pickle.load(pickleFile)

largeFeatureMatrix.shape = (largeFeatureMatrix.shape[0], -1)

X = largeFeatureMatrix
Y = np.array(energies)

#%% Load validation data
"""
featureMatrixFileValidate = "validate_featureMatrix.npy"
atomicSymbolsListFileValidate = "validate_pickledAtomicSymbolsList.txt"
energiesFileValidate = "validate_pickledEnergies.txt"
if prdf == "default":
    path = "Saved matrices/03-01-2019 11.04/sorted_Cutoff25_noSingleElementKrystals/"
elif prdf == "faulty":
    path = "Saved matrices/11-10-2018 11.36/sorted_Cutoff25_noSingleElementKrystals/"
elif prdf == "newest":
    path = "Saved matrices/04-01-2019 21.56/sorted_Cutoff25_noSingleElementKrystals/"
elif prdf == "deep":
    path = "Saved matrices/09-01-2019 16.03/sorted_Cutoff25_noSingleElementKrystals/"
#%% Load training data
featureMatrixFile = "train_featureMatrix.npy"
atomicSymbolsListFile = "train_pickledAtomicSymbolsList.txt"
energiesFile = "train_pickledEnergies.txt"

if Feature == "SimpleLarge":
    largeFeatureMatrix = simpleLargeMatrix(path, featureMatrixFile,
                                           atomicSymbolsListFile)
    folder = folder + "SimpleLarge/"
elif Feature == "GP":
    largeFeatureMatrix = advanced_large_matrix(path, featureMatrixFile,
                                               atomicSymbolsListFile)
    folder = folder + "GP/"

with open(path + energiesFile, "rb") as pickleFile:
    energies = pickle.load(pickleFile)

largeFeatureMatrix.shape = (largeFeatureMatrix.shape[0], -1)

X = largeFeatureMatrix
Y = np.array(energies)

#%% Load  Validation data