Skip to content

Commit

Permalink
Update Artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrafiqulrabin committed Aug 2, 2021
1 parent a56f902 commit 2947346
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ For MethodName task as an example,

- Clone `SIVAND` from "https://github.com/mdrafiqulrabin/SIVAND". Here, we need DD.py, helper.py, and MyDD.py files.
- In `helper.py`, update `<g_test_file>` (path to a file that contains all selected inputs) and `<g_deltas_type>` (select token or char type delta for DD).
- Then, have to modify "load_model_M()" to load a target model (i.e., code2seq) from `<model_path>`, and "prediction_with_M()" to get the predicted name, score, and loss value with `<model>` for an input `<file_path>`.
- Also, need to check whether `<code>` is parsable into "is_parsable()" and load method by language (i.e. Java) from "load_method()".
- Then, modify "load_model_M()" to load a target model (i.e., code2seq) from `<model_path>`, and "prediction_with_M()" to get the predicted name, score, and loss value with `<model>` for an input `<file_path>`.
- Also, check whether `<code>` is parsable into "is_parsable()" and load method according to language (i.e. Java) from "load_method()".
- Finally, run `MyDD.py` that will simplify programs one by one and save all simplified traces in the `dd_data/` folder.


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This repository contains the code of prediction-preserving simplification, and t
|<img src="./save/sivand.png" alt="Workflow in SIVAND"/>|
:-------------------------:

[Delta Debugging (DD)](https://www.st.cs.uni-saarland.de/dd/) was implemented with Python 2. We have modified the core modules ([DD.py](https://www.st.cs.uni-saarland.de/dd/DD.py), [MyDD.py](https://www.st.cs.uni-saarland.de/dd/MyDD.py)) to run in [Python 3 (we use Python 3.7.3)](https://github.com/mdrafiqulrabin/dd-py3), and then adopted the DD modules for prediction-preserving program simplification using different models. The approach, SIVAND, is model-agnostic and can be applied to any model by loading a model and making a prediction with the model for a task.
[Delta Debugging (DD)](https://www.st.cs.uni-saarland.de/dd/) was implemented with Python 2. We have modified the core modules ([DD.py](https://www.st.cs.uni-saarland.de/dd/DD.py), [MyDD.py](https://www.st.cs.uni-saarland.de/dd/MyDD.py)) to run in [Python 3](https://github.com/mdrafiqulrabin/dd-py3) (i.e., Python 3.7.3), and then adopted the DD modules for prediction-preserving program simplification using different models. The approach, SIVAND, is model-agnostic and can be applied to any model by loading a model and making a prediction with the model for a task.

**How to Start**:
To apply SIVAND (for MethodName task as an example), first update `<g_test_file>` (path to a file that contains all selected inputs) and `<g_deltas_type>` (select token or char type delta for DD) in `helper.py`.
Expand Down
7 changes: 0 additions & 7 deletions STATUS

This file was deleted.

10 changes: 4 additions & 6 deletions helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def deltas_to_code(d):

def is_parsable(code):
try:
# TODO: check whether <code> is parsable
# [this one is for JAVA program]
# Example: check whether <code> (JAVA program) is parsable
tree = javalang.parse.parse("class Test { " + code + " }")
assert tree is not None
except Exception:
Expand All @@ -84,15 +83,15 @@ def get_json_data(time, score, loss, code, tokens=None, n_pass=None):
def load_model_M(model_path=""):
model = None
# TODO: load target model from <model_path>
# Example: check <others/DD-Models/dd-M/dd_M.py>
# Example: check <models/dd-M/dd_M.py>
return model


def prediction_with_M(model, file_path):
pred, score, loss = None, None, None
# TODO: preprocess <file_path> and evaluate with <model>
# and get predicted name, score, and loss
# Example: check <others/DD-Models/dd-M/sm_helper.py>
# Example: check <models/dd-M/sm_helper.py>
return pred, score, loss


Expand All @@ -101,8 +100,7 @@ def prediction_with_M(model, file_path):

def load_method(file_path):
try:
# TODO: extract name and body from method
# [this one is for JAVA program]
# Example: extract name and body from method of JAVA program.
cmd = ['java', '-jar', JAR_LOAD_JAVA_METHOD, file_path]
contents = subprocess.check_output(cmd, encoding="utf-8", close_fds=True)
contents = contents.split()
Expand Down
Binary file removed paper.pdf
Binary file not shown.

0 comments on commit 2947346

Please sign in to comment.