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

Extract the logic to identify bug types into individual feature classes #3907

Merged
merged 16 commits into from
Jan 3, 2024

Conversation

PromiseFru
Copy link
Collaborator

@PromiseFru PromiseFru commented Dec 7, 2023

Resolves: #3900

…e` into a new function, `is_performance_related`
Copy link
Member

@suhaibmujahid suhaibmujahid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @PromiseFru! Could you please modify the PR description to mention "Address part of:" instead of "Fixes:"? The scope of the issue is not limited to the performance part. Anyway, we can limit this PR to do the performance part for now.

bugbug/utils.py Outdated Show resolved Hide resolved
bugbug/utils.py Outdated Show resolved Hide resolved
bugbug/utils.py Outdated Show resolved Hide resolved
bugbug/utils.py Outdated Show resolved Hide resolved
@PromiseFru PromiseFru changed the title Extracted performance bug detection logic from the bugtype model file into a new function, is_performance_related Extracted performance bug detection logic from the bugtype model file into a new function, is_performance_bug Dec 8, 2023
@PromiseFru PromiseFru changed the title Extracted performance bug detection logic from the bugtype model file into a new function, is_performance_bug Extract bug type logics into individual functions, rename bug_to_types to infer_bug_types Dec 8, 2023
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
scripts/generate_landings_risk_report.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
@PromiseFru

This comment was marked as off-topic.

bugbug/bug_features.py Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/bug_features.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
tests/test_bug_features.py Outdated Show resolved Hide resolved
tests/test_bug_features.py Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
Copy link
Member

@suhaibmujahid suhaibmujahid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @PromiseFru! It look good, I just have some variable name suggestions to improve the readability.

bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
bugbug/models/bugtype.py Outdated Show resolved Hide resolved
suhaibmujahid
suhaibmujahid previously approved these changes Dec 15, 2023
Copy link
Member

@suhaibmujahid suhaibmujahid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM!

Could you please check the model accuracy metrics before and after the refactoring? They should be in the same range.

bugbug/bug_features.py Outdated Show resolved Hide resolved
@suhaibmujahid suhaibmujahid changed the title Extract bug type logics into individual functions, rename bug_to_types to infer_bug_types Extract the logic to identify bug types into individual feature classes Dec 15, 2023
@PromiseFru
Copy link
Collaborator Author

Thank you! LGTM!

Could you please check the model accuracy metrics before and after the refactoring? They should be in the same range.

I cannot obtain the performance metrics similar to the situation encountered here.

Training before refactoring
2023-12-16 10:58:18,674:INFO:__main__:Training *bugtype* model
2023-12-16 10:58:41,565:INFO:bugbug.models.bugtype:7544 crash bugs
2023-12-16 10:58:41,629:INFO:bugbug.models.bugtype:560 memory bugs
2023-12-16 10:58:41,696:INFO:bugbug.models.bugtype:4730 performance bugs
2023-12-16 10:58:41,766:INFO:bugbug.models.bugtype:124 power bugs
2023-12-16 10:58:41,839:INFO:bugbug.models.bugtype:2575 security bugs
Traceback (most recent call last):
File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
File "/home/promisefru/mozilla/bugbug/scripts/trainer.py", line 145, in <module>
    main()
File "/home/promisefru/mozilla/bugbug/scripts/trainer.py", line 141, in main
    retriever.go(args)
File "/home/promisefru/mozilla/bugbug/scripts/trainer.py", line 41, in go
    metrics = model_obj.train(limit=args.limit)
File "/home/promisefru/mozilla/bugbug/bugbug/model.py", line 377, in train
    self.le.fit(y)
File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/site-packages/sklearn/preprocessing/_label.py", line 98, in fit
    y = column_or_1d(y, warn=True)
File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/site-packages/sklearn/utils/validation.py", line 1156, in column_or_1d
    raise ValueError(
ValueError: y should be a 1d array, got an array of shape (198578, 5) instead.
Training after refactoring
2023-12-16 11:24:24,063:INFO:__main__:Training *bugtype* model
2023-12-16 11:24:47,247:INFO:bugbug.models.bugtype:7521 crash bugs
2023-12-16 11:24:47,293:INFO:bugbug.models.bugtype:559 memory bugs
2023-12-16 11:24:47,339:INFO:bugbug.models.bugtype:4612 performance bugs
2023-12-16 11:24:47,385:INFO:bugbug.models.bugtype:124 power bugs
2023-12-16 11:24:47,432:INFO:bugbug.models.bugtype:2575 security bugs
Traceback (most recent call last):
  File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/promisefru/mozilla/bugbug/scripts/trainer.py", line 145, in <module>
    main()
  File "/home/promisefru/mozilla/bugbug/scripts/trainer.py", line 141, in main
    retriever.go(args)
  File "/home/promisefru/mozilla/bugbug/scripts/trainer.py", line 41, in go
    metrics = model_obj.train(limit=args.limit)
  File "/home/promisefru/mozilla/bugbug/bugbug/model.py", line 377, in train
    self.le.fit(y)
  File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/site-packages/sklearn/preprocessing/_label.py", line 98, in fit
    y = column_or_1d(y, warn=True)
  File "/home/promisefru/anaconda3/envs/bugbug/lib/python3.10/site-packages/sklearn/utils/validation.py", line 1156, in column_or_1d
    raise ValueError(
ValueError: y should be a 1d array, got an array of shape (198578, 5) instead.

@suhaibmujahid suhaibmujahid merged commit ca1beba into mozilla:master Jan 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor the logic in the bug_to_types function and extract it from the bugtype model file
2 participants