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

update readme when new accuracy #61

Closed
wants to merge 1 commit into from
Closed
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
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
Loading