Skip to content

Commit

Permalink
update readme when new accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-t committed Jan 13, 2024
1 parent 04bf25e commit 7b94453
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# What is CodeReviewer?
CodeReviewer is a tool that uses machine learning to help developers reviewing code. It is trained on a dataset of code from the [hlxsites](https://github.com/hlxsites) repositories and is able to predict how likely a given function is going to break in the future.

## Current Accuracy: 73.28%
## Current Accuracy: 73.29%

## How does it work?
We save each functions first version(When it was first merged) and how often it was changed in the future. We then use this data to create embeddings for each function. We then use these embeddings to create a database using Qdrant.
Expand Down
17 changes: 14 additions & 3 deletions evaluate_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ def evaluate_model_accuracy(test_data_path, merge_threshold=-0.6):

return accuracy, baseline_accuracy

def update_readme_with_accuracy(accuracy):
with open('README.md', 'r') as file:
lines = file.readlines()

for i, line in enumerate(lines):
if '## Current Accuracy:' in line:
lines[i] = f'## Current Accuracy: {accuracy:.2f}%\n'

with open('README.md', 'w') as file:
file.writelines(lines)

if __name__ == '__main__':
accuracy, baseline_accuracy = evaluate_model_accuracy('./dataForTesting/testing.json')
print(f"Model Accuracy: {accuracy * 100:.2f}%")
print(f"Baseline Accuracy: {baseline_accuracy * 100:.2f}%")
accuracy = evaluate_model_accuracy('./dataForTesting/testing.json')
print(f"Current Accuracy: {accuracy * 100:.2f}%")
update_readme_with_accuracy(accuracy * 100)
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def main(repos_info):
accuracy, baseline_accuracy = evaluate_performance.evaluate_model_accuracy('./dataForTesting/testing.json')
print(f"Model Accuracy: {accuracy * 100:.2f}%")
print(f"Baseline Accuracy: {baseline_accuracy * 100:.2f}%")
evaluate_performance.update_readme_with_accuracy(accuracy * 100)

if __name__ == '__main__':
start_time = time.time()
Expand Down

0 comments on commit 7b94453

Please sign in to comment.