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
# For searching the file which name contains specific string in folder and sub folder | |
def search(s,t,mainpath): | |
rootdir = mainpath | |
searchpath = np.zeros(0) | |
for parent, dirnames, filenames in os.walk(rootdir): | |
for filename in filenames: | |
if filename.find(s) != -1 and filename.find(t) != -1: | |
searchpath = np.append(searchpath, | |
os.path.abspath(os.path.join(parent,filename))) | |
return searchpath |
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 matplotlib.pyplot as plt | |
import matplotlib as mpl | |
import matplotlib.cm as cm | |
import numpy as np | |
from scipy.spatial import ConvexHull | |
from sklearn.mixture import GaussianMixture | |
from scipy import linalg | |
from sklearn.neighbors import NearestNeighbors | |
from sklearn.manifold import TSNE |
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 keras.models import model_from_yaml | |
def saveModel(model, savename): | |
# serialize model to YAML | |
model_yaml = model.to_yaml() | |
with open(savename+".yaml", "w") as yaml_file: | |
yaml_file.write(model_yaml) | |
print("Yaml Model ",savename,".yaml saved to disk") | |
# serialize weights to HDF5 | |
model.save_weights(savename+".h5") |