Skip to content

Commit

Permalink
finish experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineBarbez committed Jun 15, 2019
1 parent 153cc07 commit db4f572
Show file tree
Hide file tree
Showing 701 changed files with 45,837 additions and 3,335 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion experiments/study_results/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
import neural_networks.jdeodorant.detect_feature_envy as jdeodorant_fe

import neural_networks.vote.detect as vote
import neural_networks.asci.predict as asci
import neural_networks.asci.predict as asci
import neural_networks.smad.predict as smad
20 changes: 19 additions & 1 deletion experiments/study_results/perfs_feature_envy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import nnUtils, incode, hist_fe, jdeodorant_fe, vote
from context import nnUtils, incode, hist_fe, jdeodorant_fe, vote, asci, smad

import numpy as np

Expand All @@ -17,6 +17,8 @@
overall_prediction_hist = np.empty(shape=[0, 1])
overall_prediction_jd = np.empty(shape=[0, 1])
overall_prediction_vote = np.empty(shape=[0, 1])
overall_prediction_asci = np.empty(shape=[0, 1])
overall_prediction_smad = np.empty(shape=[0, 1])

overall_labels = np.empty(shape=[0, 1])
for system in systems:
Expand All @@ -40,6 +42,14 @@
prediction_vote = nnUtils.predictFromDetect('feature_envy', system, vote.detect('feature_envy', system))
overall_prediction_vote = np.concatenate((overall_prediction_vote, prediction_vote), axis=0)

# Compute performances for ASCI
prediction_asci = asci.predict('feature_envy', system)
overall_prediction_asci = np.concatenate((overall_prediction_asci, prediction_asci), axis=0)

# Compute performances for SMAD
prediction_smad = smad.predict('feature_envy', system)
overall_prediction_smad = np.concatenate((overall_prediction_smad, prediction_smad), axis=0)

# Print performances for the considered system
print(system)
print(' |precision |recall |f_measure')
Expand All @@ -52,6 +62,10 @@
print('-------------------------------------------')
print('Vote |' + "{0:.3f}".format(nnUtils.precision(prediction_vote, labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(prediction_vote, labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(prediction_vote, labels)))
print('-------------------------------------------')
print('ASCI |' + "{0:.3f}".format(nnUtils.precision(prediction_asci, labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(prediction_asci, labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(prediction_asci, labels)))
print('-------------------------------------------')
print('SMAD |' + "{0:.3f}".format(nnUtils.precision(prediction_smad, labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(prediction_smad, labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(prediction_smad, labels)))
print('-------------------------------------------')

print('\n')

Expand All @@ -67,3 +81,7 @@
print('-------------------------------------------')
print('Vote |' + "{0:.3f}".format(nnUtils.precision(overall_prediction_vote, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(overall_prediction_vote, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(overall_prediction_vote, overall_labels)))
print('-------------------------------------------')
print('ASCI |' + "{0:.3f}".format(nnUtils.precision(overall_prediction_asci, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(overall_prediction_asci, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(overall_prediction_asci, overall_labels)))
print('-------------------------------------------')
print('SMAD |' + "{0:.3f}".format(nnUtils.precision(overall_prediction_smad, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(overall_prediction_smad, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(overall_prediction_smad, overall_labels)))
print('-------------------------------------------')
11 changes: 10 additions & 1 deletion experiments/study_results/perfs_god_class.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from context import nnUtils, decor, hist_gc, jdeodorant_gc, vote, asci
from context import nnUtils, decor, hist_gc, jdeodorant_gc, vote, asci, smad

import numpy as np

Expand All @@ -18,6 +18,7 @@
overall_prediction_jd = np.empty(shape=[0, 1])
overall_prediction_vote = np.empty(shape=[0, 1])
overall_prediction_asci = np.empty(shape=[0, 1])
overall_prediction_smad = np.empty(shape=[0, 1])

overall_labels = np.empty(shape=[0, 1])
for system in systems:
Expand Down Expand Up @@ -45,6 +46,10 @@
prediction_asci = asci.predict('god_class', system)
overall_prediction_asci = np.concatenate((overall_prediction_asci, prediction_asci), axis=0)

# Compute performances for SMAD
prediction_smad = smad.predict('god_class', system)
overall_prediction_smad = np.concatenate((overall_prediction_smad, prediction_smad), axis=0)

# Print performances for the considered system
print(system)
print(' |precision |recall |f_measure')
Expand All @@ -59,6 +64,8 @@
print('-------------------------------------------')
print('ASCI |' + "{0:.3f}".format(nnUtils.precision(prediction_asci, labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(prediction_asci, labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(prediction_asci, labels)))
print('-------------------------------------------')
print('SMAD |' + "{0:.3f}".format(nnUtils.precision(prediction_smad, labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(prediction_smad, labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(prediction_smad, labels)))
print('-------------------------------------------')

print('\n')

Expand All @@ -76,3 +83,5 @@
print('-------------------------------------------')
print('ASCI |' + "{0:.3f}".format(nnUtils.precision(overall_prediction_asci, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(overall_prediction_asci, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(overall_prediction_asci, overall_labels)))
print('-------------------------------------------')
print('SMAD |' + "{0:.3f}".format(nnUtils.precision(overall_prediction_smad, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.recall(overall_prediction_smad, overall_labels)) + ' |' + "{0:.3f}".format(nnUtils.f_measure(overall_prediction_smad, overall_labels)))
print('-------------------------------------------')
2 changes: 1 addition & 1 deletion experiments/training/train_smad.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def parse_args():
parser.add_argument("-beta", type=float, help="The L2 regularization scale to be used for training.")
parser.add_argument('-dense_sizes', nargs='+', type=int, help="The sizes of each (dense) hidden layer in the network.")
parser.add_argument("-n_net", type=int, default=10, help="The number of distinct networks to be trained and saved.")
parser.add_argument("-n_step", type=int, default=300, help="The number of training steps.")
parser.add_argument("-n_step", type=int, default=200, help="The number of training steps.")
parser.add_argument("-decay_step", type=int, default=100, help="The number of training steps after which the learning rate is decayed")
parser.add_argument("-lr_decay", type=float, default=0.5, help="The factor by which the learning rate is multiplied every 'decay_step' steps")
return parser.parse_args()
Expand Down
Binary file modified experiments/tuning/results/asci/.DS_Store
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit db4f572

Please sign in to comment.