Skip to content

Commit

Permalink
Merge pull request #32 from dpr1005/issue-31-Unify_ACC_&_MSE_graphs_o…
Browse files Browse the repository at this point in the history
…f_tests_with_labels_based_on_given_percentages

Issue 31 unify acc & mse graphs of tests with labels based on given percentages - DONE
  • Loading branch information
dpuenteramirez committed Dec 19, 2021
2 parents 68a04b6 + 56bb3d4 commit bfa04dd
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions Instance Selection Algorithms/plot_csv_percent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_unlabeled(dataset):
folder = './test_unlabeled/'

files = next(walk(folder), (None, None, []))[2]

for file in files:
if '.csv' in file and ('KNN' in file or 'Tree' in file):
name = folder + file
Expand Down Expand Up @@ -47,11 +47,11 @@ def test_unlabeled(dataset):
axs[0, 0].set_ylabel('KNN')
axs[1, 0].set_ylabel('Tree')

axs[1, 0].set_xlabel("Precision")
axs[1, 1].set_xlabel("Precision")
axs[1, 0].set_xlabel("So much per one labeled")
axs[1, 1].set_xlabel("So much per one labeled")

plt.tight_layout()
plt.savefig(folder+dataset)
plt.savefig(folder + dataset)
plt.show()


Expand All @@ -61,13 +61,45 @@ def plot_self_tarining(dataset):
print(datasets)


def plot_unlabeled_to_one():
df_knn_acc = pd.read_csv(
'./test_unlabeled/test_unlabeled_cross_validation_KNN_acc.csv')
df_knn_mse = pd.read_csv(
'./test_unlabeled/test_unlabeled_cross_validation_KNN_mse.csv')
df_tree_acc = pd.read_csv(
'./test_unlabeled/test_unlabeled_cross_validation_Tree_acc.csv')
df_tree_mse = pd.read_csv(
'./test_unlabeled/test_unlabeled_cross_validation_Tree_mse.csv')

knn_acc = df_knn_acc.to_numpy()
knn_mse = df_knn_mse.to_numpy()
tree_acc = df_tree_acc.to_numpy()
tree_mse = df_tree_mse.to_numpy()
datasets = [knn_acc, knn_mse, tree_acc, tree_mse]
str_datasets = ['KNN_acc', 'KNN_mse', 'Tree_acc', 'Tree_mse']

precision = np.array(df_knn_acc.keys()[1:])
precision = np.asfarray(precision)

for index, dataset in enumerate(datasets):

fig, ax = plt.subplots(figsize=(10, 10))
for d in dataset:
plt.plot(precision, d[1:])
ax.set_xlabel("So much per one labeled")
ax.set_ylabel('Correct prediction')
ax.set_title(str_datasets[index])

plt.tight_layout()
plt.savefig(f'./test_unlabeled/all_in_one_{str_datasets[index]}')


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--d', nargs=1)
args = parser.parse_args()

dataset = 'page-blocks' if args.d is None else str(args.d[0])
test_unlabeled(dataset)
#plot_self_tarining(dataset)


# test_unlabeled(dataset)
# plot_self_tarining(dataset)
plot_unlabeled_to_one()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/banana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/contraceptive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/page-blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/phoneme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/segment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/titanic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Instance Selection Algorithms/test_unlabeled/yeast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bfa04dd

Please sign in to comment.