Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 31 unify acc & mse graphs of tests with labels based on given percentages #32

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.