Skip to content

Instantly share code, notes, and snippets.

View Alexander-Schiendorfer's full-sized avatar

Alexander Schiendorfer Alexander-Schiendorfer

View GitHub Profile
def compare_nearest_neighbors(self):
""" get nearest neighbor for every wrong labeled datapoint and compare feature values in one DataFrame """
results = []
for index, row in self.wrong_predictions.iterrows():
query_data_point = row[:-2]
query_data = row[:]
data_points = self.X_predictions.iloc[:, :-2]
predictions = model.predict(test_images)
predictions = np.argmax(predictions, axis=1)
conf_matrix = confusion_matrix(np.argmax(test_labels, axis=1), predictions)
# just for better presentation - but store original values
default_figsize = plt.rcParams['figure.figsize']
default_dpi = plt.rcParams['figure.dpi']
plt.rcParams['figure.figsize'] = [19, 12]
plt.rcParams['figure.dpi'] = 150