bugbug 0.0.652__tar.gz → 0.0.653__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bugbug-0.0.652 → bugbug-0.0.653}/PKG-INFO +6 -4
- bugbug-0.0.653/VERSION +1 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/bug_features.py +100 -1
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/bug_snapshot.py +9 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/bugzilla.py +2 -2
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/model.py +32 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/model_calibration.py +24 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/accessibility.py +2 -2
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/backout.py +6 -4
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/component.py +167 -55
- bugbug-0.0.653/bugbug/models/component_specific.py +246 -0
- bugbug-0.0.653/bugbug/models/fenixcomponent.py +68 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/perf_regression_predictor.py +14 -1
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/regressor.py +9 -5
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/testselect.py +3 -7
- bugbug-0.0.653/bugbug/perf/calibration.py +291 -0
- bugbug-0.0.653/bugbug/perf/commit_risk.py +273 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/datasets.py +30 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/extraction.py +105 -1
- bugbug-0.0.653/bugbug/perf/simulation/__init__.py +136 -0
- bugbug-0.0.653/bugbug/perf/simulation/capacity.py +817 -0
- bugbug-0.0.653/bugbug/perf/simulation/detection.py +180 -0
- bugbug-0.0.653/bugbug/perf/simulation/metrics.py +220 -0
- bugbug-0.0.653/bugbug/perf/simulation/optimize.py +223 -0
- bugbug-0.0.653/bugbug/perf/simulation/splits.py +54 -0
- bugbug-0.0.653/bugbug/perf/simulation/stats.py +29 -0
- bugbug-0.0.653/bugbug/perf/simulation/strategies.py +500 -0
- bugbug-0.0.653/bugbug/perf/simulation/timeline.py +318 -0
- bugbug-0.0.653/bugbug/perf/sql/perf_capacity_background.sql +26 -0
- bugbug-0.0.653/bugbug/perf/sql/perf_capacity_builds.sql +42 -0
- bugbug-0.0.653/bugbug/perf/sql/perf_capacity_eligible.sql +35 -0
- bugbug-0.0.653/bugbug/perf/sql/perf_capacity_labels.sql +29 -0
- bugbug-0.0.653/bugbug/perf/sql/perf_capacity_pools.sql +34 -0
- bugbug-0.0.653/bugbug/perf/sql/perf_capacity_workers.sql +17 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/sql/perf_task_costs.sql +1 -8
- bugbug-0.0.653/bugbug/perf/sql/perf_task_filter.sql +14 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/phabricator.py +3 -3
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/repository.py +12 -4
- {bugbug-0.0.652 → bugbug-0.0.653}/pyproject.toml +11 -6
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/bug_retriever.py +3 -3
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/commit_classifier.py +2 -2
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/generate_landings_risk_report.py +36 -24
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/generate_sheet.py +3 -3
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/get_untriaged.py +2 -2
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/perf_alerts_retriever.py +155 -22
- bugbug-0.0.653/scripts/perf_commit_risk_scorer.py +185 -0
- bugbug-0.0.653/scripts/perf_scheduling_simulator.py +902 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/shadow_scheduler_stats.py +160 -28
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/test_scheduling_history_retriever.py +4 -3
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/testing_policy_stats.py +4 -3
- bugbug-0.0.652/VERSION +0 -1
- bugbug-0.0.652/bugbug/models/component_specific.py +0 -136
- bugbug-0.0.652/bugbug/models/fenixcomponent.py +0 -130
- bugbug-0.0.652/bugbug/perf/commit_risk.py +0 -52
- {bugbug-0.0.652 → bugbug-0.0.653}/.gitignore +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/LICENSE +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/build_platforms.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/function_search.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/mozilla.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/parser.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/searchfox_api.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/searchfox_data.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/code_search/searchfox_download.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/commit_features.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/db.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/feature_cleanup.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/github.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/issue_features.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/issue_snapshot.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/annotateignore.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/bug_nobug.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/defect_enhancement_task.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/defect_enhancement_task_e.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/defect_enhancement_task_h.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/defect_enhancement_task_p.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/defect_enhancement_task_s.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/regression_bug_nobug.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/regressionrange.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/str.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels/tracking.csv +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/labels.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/annotate_ignore.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/assignee.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/browsername.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/bugtype.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/defect.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/defect_enhancement_task.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/devdocneeded.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/fixtime.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/invalid_compatibility_report.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/needsdiagnosis.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/performancebug.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/qaneeded.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/rcatype.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/regression.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/regressionrange.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/severity.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/spambug.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/stepstoreproduce.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/testconfigdimensions.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/testconfigselect.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/testfailure.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/tracking.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/uplift.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/models/worksforme.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/nlp.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/label_policy.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/push_status.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/regression_commits.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/regression_labeling.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/selection_pairs.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/sql/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/sql/perf_alerts.sql +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/sql/perf_pushes.sql +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/task_costs.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/perf/task_labels.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/redash.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/rust_code_analysis_server.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/swarm.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/test_scheduling.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/test_scheduling_features.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/base.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/agent.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/data_types.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/database.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/langchain_tools.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/prompts.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/protocols.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/review_context.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/review_context_schema.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/scorer.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/code_review/utils.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/comment_matching/agent.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/comment_matching/prompts.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/comment_resolution/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/comment_resolution/agent.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/connection.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/data_types.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/exceptions.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/llms.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/platforms/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/platforms/base.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/platforms/bugzilla.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/platforms/patch_apply.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/platforms/phabricator.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/text.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/core/validators.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/patch_summarization/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/patch_summarization/agent.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/patch_summarization/prompts.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/suggestion_filtering/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/suggestion_filtering/agent.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/tools/suggestion_filtering/prompts.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/utils.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/bugbug/vectordb.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/__init__.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/analyze_training_metrics.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/backout_related_test_regressions.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/bug_classifier.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/check.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/check_all_metrics.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/ci_failures_matching.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/comment_classifier.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/comment_level_labeler.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/comment_resolver_runner.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/commit_retriever.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/compatibility_report_classifier.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/gcp_logs_retriever.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/get_type_labels.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/github_issue_classifier.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/github_issue_retriever.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/inline_comments_data_collection.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/integration_test.sh +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/maintenance_effectiveness_indicator.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/microannotate_generator.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/past_bugs_by_unit.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/perf_regression_predictor.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/redundant_failures.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/regressor_finder.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/retrieve_ci_failures.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/retrieve_training_metrics.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/retrieve_try_pushes.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/review_comments_retriever.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/revision_retriever.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/trainer.py +0 -0
- {bugbug-0.0.652 → bugbug-0.0.653}/scripts/trainer_extract_args.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bugbug
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.653
|
|
4
4
|
Summary: ML tools for Mozilla projects
|
|
5
5
|
Author-email: Marco Castelluccio <mcastelluccio@mozilla.com>
|
|
6
6
|
License-Expression: MPL-2.0
|
|
@@ -30,7 +30,7 @@ Requires-Dist: markdown2~=2.5.5
|
|
|
30
30
|
Requires-Dist: matplotlib<3.12.0,>=3.10.8
|
|
31
31
|
Requires-Dist: mercurial~=7.2
|
|
32
32
|
Requires-Dist: microannotate~=0.0.24
|
|
33
|
-
Requires-Dist: mozci~=2.
|
|
33
|
+
Requires-Dist: mozci~=2.5.0
|
|
34
34
|
Requires-Dist: numpy~=2.4.3
|
|
35
35
|
Requires-Dist: orjson<3.14.0,>=3.11.7
|
|
36
36
|
Requires-Dist: ortools~=9.15.6755
|
|
@@ -50,7 +50,7 @@ Requires-Dist: searchfox>=0.20.3
|
|
|
50
50
|
Requires-Dist: sendgrid~=6.12.5
|
|
51
51
|
Requires-Dist: shap[plots]<0.53,>=0.51
|
|
52
52
|
Requires-Dist: tabulate~=0.10.0
|
|
53
|
-
Requires-Dist: taskcluster~=
|
|
53
|
+
Requires-Dist: taskcluster~=116.0
|
|
54
54
|
Requires-Dist: tenacity~=9.1.4
|
|
55
55
|
Requires-Dist: tqdm<4.71.0,>=4.67.3
|
|
56
56
|
Requires-Dist: unidiff<1.1.0,>=0.7.5
|
|
@@ -59,8 +59,10 @@ Requires-Dist: whatthepatch~=1.0.7
|
|
|
59
59
|
Requires-Dist: xgboost<3.5,>=3.2
|
|
60
60
|
Requires-Dist: zstandard~=0.25.0
|
|
61
61
|
Provides-Extra: nlp
|
|
62
|
-
Requires-Dist: spacy==3.8.
|
|
62
|
+
Requires-Dist: spacy==3.8.18; extra == 'nlp'
|
|
63
63
|
Provides-Extra: nn
|
|
64
64
|
Provides-Extra: perf-regression-predictor
|
|
65
65
|
Requires-Dist: torch==2.14.1; extra == 'perf-regression-predictor'
|
|
66
66
|
Requires-Dist: transformers==5.20.1; extra == 'perf-regression-predictor'
|
|
67
|
+
Provides-Extra: perf-simulation
|
|
68
|
+
Requires-Dist: optuna>=5.0.0; extra == 'perf-simulation'
|
bugbug-0.0.653/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.653
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
4
4
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
5
|
|
|
6
|
+
import json
|
|
6
7
|
import re
|
|
7
8
|
import sys
|
|
8
|
-
from collections import defaultdict
|
|
9
|
+
from collections import Counter, defaultdict
|
|
9
10
|
from datetime import datetime, timezone
|
|
10
11
|
from functools import partial
|
|
11
12
|
from multiprocessing.pool import Pool
|
|
@@ -628,6 +629,99 @@ def get_author_ids():
|
|
|
628
629
|
return author_ids
|
|
629
630
|
|
|
630
631
|
|
|
632
|
+
class MentionedPathsComponents(SingleBugFeature):
|
|
633
|
+
"""Components of the files and directories mentioned in a bug.
|
|
634
|
+
|
|
635
|
+
The components are taken from the mapping defined by the moz.build files of
|
|
636
|
+
mozilla-central. The mapping is downloaded the first time the feature is used,
|
|
637
|
+
and then stored with the feature (so a trained model doesn't need it).
|
|
638
|
+
"""
|
|
639
|
+
|
|
640
|
+
name = "Component of mentioned paths"
|
|
641
|
+
|
|
642
|
+
URL_RE = re.compile(r"\w+://\S+")
|
|
643
|
+
PATH_RE = re.compile(r"(?:[\w.-]+/)+[\w.-]+\.[a-zA-Z0-9]+")
|
|
644
|
+
FILE_NAME_RE = re.compile(
|
|
645
|
+
r"\b[\w-]+\.(?:cpp|h|c|cc|mm|js|mjs|jsm|py|rs|html|xhtml|css|webidl|ftl|toml|"
|
|
646
|
+
r"yaml|yml|json|java|kt|idl|ipdl|xml|svg|properties)\b"
|
|
647
|
+
)
|
|
648
|
+
DIRECTORY_RE = re.compile(r"\b(?:[a-z0-9_-]+/)+[a-z0-9_-]+\b")
|
|
649
|
+
|
|
650
|
+
def __init__(self):
|
|
651
|
+
self.path_to_component = None
|
|
652
|
+
|
|
653
|
+
def load_mapping(self):
|
|
654
|
+
repository.download_component_mapping()
|
|
655
|
+
with open("data/component_mapping.json", "r") as f:
|
|
656
|
+
self.path_to_component = {
|
|
657
|
+
path: sys.intern("::".join(component))
|
|
658
|
+
for path, component in json.load(f).items()
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
file_names = defaultdict(Counter)
|
|
662
|
+
directories = defaultdict(Counter)
|
|
663
|
+
for path, component in self.path_to_component.items():
|
|
664
|
+
parts = path.split("/")
|
|
665
|
+
file_names[parts[-1]][component] += 1
|
|
666
|
+
for i in range(1, len(parts)):
|
|
667
|
+
directories["/".join(parts[:i])][component] += 1
|
|
668
|
+
|
|
669
|
+
def shares(counter, n=None):
|
|
670
|
+
total = counter.total()
|
|
671
|
+
return [(c, count / total) for c, count in counter.most_common(n)]
|
|
672
|
+
|
|
673
|
+
# Files with the same name can be in different components.
|
|
674
|
+
self.file_name_to_components = {
|
|
675
|
+
file_name: shares(counter) for file_name, counter in file_names.items()
|
|
676
|
+
}
|
|
677
|
+
self.directory_to_components = {
|
|
678
|
+
directory: shares(counter, 3) for directory, counter in directories.items()
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
def __call__(self, bug, **kwargs):
|
|
682
|
+
if self.path_to_component is None:
|
|
683
|
+
self.load_mapping()
|
|
684
|
+
|
|
685
|
+
text = self.URL_RE.sub(
|
|
686
|
+
" ", "\n".join([bug["summary"]] + [c["text"] for c in bug["comments"]])
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
weights = defaultdict(float)
|
|
690
|
+
|
|
691
|
+
# Full or partial paths (e.g. "dom/base/Element.cpp"). They might have extra
|
|
692
|
+
# leading directories (e.g. from a local checkout or a stack trace), so try
|
|
693
|
+
# progressively shorter suffixes. In stack traces the first paths are the most
|
|
694
|
+
# indicative, so weigh each path by the reciprocal of its position.
|
|
695
|
+
found_first = False
|
|
696
|
+
for i, match in enumerate(self.PATH_RE.finditer(text)):
|
|
697
|
+
parts = match.group().split("/")
|
|
698
|
+
for j in range(len(parts)):
|
|
699
|
+
component = self.path_to_component.get("/".join(parts[j:]))
|
|
700
|
+
if component is not None:
|
|
701
|
+
weights[f"{component} (path)"] += 1 / (i + 1)
|
|
702
|
+
if not found_first:
|
|
703
|
+
weights[f"{component} (first path)"] = 1
|
|
704
|
+
found_first = True
|
|
705
|
+
break
|
|
706
|
+
|
|
707
|
+
# File names without directories (e.g. "nsDocShell.cpp").
|
|
708
|
+
for file_name in set(self.FILE_NAME_RE.findall(text)):
|
|
709
|
+
for component, share in self.file_name_to_components.get(file_name, ()):
|
|
710
|
+
weights[f"{component} (file name)"] += share
|
|
711
|
+
|
|
712
|
+
# Directories (e.g. "dom/media").
|
|
713
|
+
for directory in set(self.DIRECTORY_RE.findall(text)):
|
|
714
|
+
parts = directory.split("/")
|
|
715
|
+
for i in range(len(parts), 0, -1):
|
|
716
|
+
components = self.directory_to_components.get("/".join(parts[:i]))
|
|
717
|
+
if components is not None:
|
|
718
|
+
for component, share in components:
|
|
719
|
+
weights[f"{component} (directory)"] += share
|
|
720
|
+
break
|
|
721
|
+
|
|
722
|
+
return dict(weights)
|
|
723
|
+
|
|
724
|
+
|
|
631
725
|
class BugExtractor(BaseEstimator, TransformerMixin):
|
|
632
726
|
def __init__(
|
|
633
727
|
self,
|
|
@@ -688,6 +782,11 @@ class BugExtractor(BaseEstimator, TransformerMixin):
|
|
|
688
782
|
data[sys.intern(f"{item} in {feature_extractor_name}")] = True
|
|
689
783
|
continue
|
|
690
784
|
|
|
785
|
+
if isinstance(res, dict):
|
|
786
|
+
for item, weight in res.items():
|
|
787
|
+
data[sys.intern(f"{item} in {feature_extractor_name}")] = weight
|
|
788
|
+
continue
|
|
789
|
+
|
|
691
790
|
data[feature_extractor_name] = res
|
|
692
791
|
|
|
693
792
|
reporter_experience_map[bug["creator"]] += 1
|
|
@@ -115,11 +115,20 @@ def null_str(val):
|
|
|
115
115
|
return val
|
|
116
116
|
|
|
117
117
|
|
|
118
|
+
def null_int(val):
|
|
119
|
+
if val == "":
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
return int(val)
|
|
123
|
+
|
|
124
|
+
|
|
118
125
|
FIELD_TYPES = {
|
|
119
126
|
"blocks": int,
|
|
120
127
|
"depends_on": int,
|
|
121
128
|
"regressed_by": int,
|
|
122
129
|
"regressions": int,
|
|
130
|
+
"duplicates": int,
|
|
131
|
+
"dupe_of": null_int,
|
|
123
132
|
"is_confirmed": bool_str,
|
|
124
133
|
"is_cc_accessible": bool_str,
|
|
125
134
|
"is_creator_accessible": bool_str,
|
|
@@ -8,7 +8,7 @@ import csv
|
|
|
8
8
|
import itertools
|
|
9
9
|
import math
|
|
10
10
|
import re
|
|
11
|
-
from datetime import datetime
|
|
11
|
+
from datetime import datetime, timezone
|
|
12
12
|
from logging import INFO, basicConfig, getLogger
|
|
13
13
|
from typing import Iterable, Iterator, NewType
|
|
14
14
|
from urllib.parse import urlencode
|
|
@@ -383,7 +383,7 @@ def get_product_component_count(months: int = 12) -> dict[str, int]:
|
|
|
383
383
|
`{product}::{component}`) and the value of the number of bugs for the
|
|
384
384
|
given full components. Full component with 0 bugs are returned.
|
|
385
385
|
"""
|
|
386
|
-
since = datetime.
|
|
386
|
+
since = datetime.now(timezone.utc) - relativedelta(months=months)
|
|
387
387
|
|
|
388
388
|
# Base params
|
|
389
389
|
params = {
|
|
@@ -208,6 +208,8 @@ class Model:
|
|
|
208
208
|
feature_name = f"Description contains '{feature_name}'"
|
|
209
209
|
elif type_ == "title":
|
|
210
210
|
feature_name = f"Title contains '{feature_name}'"
|
|
211
|
+
elif type_ == "title_char":
|
|
212
|
+
feature_name = f"Title contains characters '{feature_name}'"
|
|
211
213
|
elif type_ == "first_comment":
|
|
212
214
|
feature_name = f"First comment contains '{feature_name}'"
|
|
213
215
|
elif type_ == "comments":
|
|
@@ -364,6 +366,10 @@ class Model:
|
|
|
364
366
|
def evaluation(self):
|
|
365
367
|
"""Subclasses can implement their own additional evaluation."""
|
|
366
368
|
|
|
369
|
+
def get_test_subsets(self) -> dict[str, np.ndarray]:
|
|
370
|
+
"""Subclasses can return boolean masks over the test set, to also report metrics on those subsets."""
|
|
371
|
+
return {}
|
|
372
|
+
|
|
367
373
|
def get_sample_weights(self, y) -> np.ndarray | None:
|
|
368
374
|
"""Subclasses can return a weight for each training sample, passed to the estimator."""
|
|
369
375
|
return None
|
|
@@ -523,6 +529,14 @@ class Model:
|
|
|
523
529
|
|
|
524
530
|
tracking_metrics["report"] = report
|
|
525
531
|
|
|
532
|
+
for name, mask in self.get_test_subsets().items():
|
|
533
|
+
logger.info(
|
|
534
|
+
"%s: accuracy %.4f (%d items)",
|
|
535
|
+
name,
|
|
536
|
+
np.mean(y_pred[mask] == y_test[mask]),
|
|
537
|
+
mask.sum(),
|
|
538
|
+
)
|
|
539
|
+
|
|
526
540
|
print_labeled_confusion_matrix(
|
|
527
541
|
confusion_matrix, self.class_names, is_multilabel=is_multilabel
|
|
528
542
|
)
|
|
@@ -593,6 +607,24 @@ class Model:
|
|
|
593
607
|
labels=confidence_class_names,
|
|
594
608
|
)
|
|
595
609
|
)
|
|
610
|
+
|
|
611
|
+
# The averages in the report above count classes without any
|
|
612
|
+
# prediction above the threshold as having precision 0, which
|
|
613
|
+
# makes precision look lower as the threshold increases. Those
|
|
614
|
+
# classes only affect recall, so compute the actual values.
|
|
615
|
+
classified = y_pred_filter.astype(str) != "__NOT_CLASSIFIED__"
|
|
616
|
+
correct = (y_pred_filter.astype(str) == y_test.astype(str)) & classified
|
|
617
|
+
subsets = {
|
|
618
|
+
"All items": np.ones(len(y_test), dtype=bool),
|
|
619
|
+
**self.get_test_subsets(),
|
|
620
|
+
}
|
|
621
|
+
for name, mask in subsets.items():
|
|
622
|
+
logger.info(
|
|
623
|
+
"%s: precision of classified items: %.4f, recall: %.4f",
|
|
624
|
+
name,
|
|
625
|
+
correct[mask].sum() / max(classified[mask].sum(), 1),
|
|
626
|
+
correct[mask].sum() / max(mask.sum(), 1),
|
|
627
|
+
)
|
|
596
628
|
print_labeled_confusion_matrix(
|
|
597
629
|
confusion_matrix, confidence_class_names, is_multilabel=is_multilabel
|
|
598
630
|
)
|
|
@@ -3,11 +3,35 @@
|
|
|
3
3
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
4
4
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
5
|
|
|
6
|
+
"""Calibration of model outputs to observed rates."""
|
|
7
|
+
|
|
8
|
+
from typing import Sequence
|
|
9
|
+
|
|
6
10
|
from sklearn.base import BaseEstimator, ClassifierMixin
|
|
7
11
|
from sklearn.calibration import CalibratedClassifierCV
|
|
8
12
|
from sklearn.model_selection import train_test_split
|
|
9
13
|
|
|
10
14
|
|
|
15
|
+
def fit_isotonic_breakpoints(
|
|
16
|
+
x: Sequence[float], rates: Sequence[float], weights: Sequence[float]
|
|
17
|
+
) -> tuple[list[float], list[float]]:
|
|
18
|
+
"""Weighted isotonic regression of observed rates on a score, as breakpoints.
|
|
19
|
+
|
|
20
|
+
The regression is clipped to [0, 1] and pools adjacent violators; the
|
|
21
|
+
breakpoints scikit-learn keeps reproduce its predictions through
|
|
22
|
+
``numpy.interp`` without the fitted estimator, the nearest end holding
|
|
23
|
+
outside them.
|
|
24
|
+
"""
|
|
25
|
+
from sklearn.isotonic import IsotonicRegression
|
|
26
|
+
|
|
27
|
+
regression = IsotonicRegression(y_min=0.0, y_max=1.0, out_of_bounds="clip")
|
|
28
|
+
regression.fit(x, rates, sample_weight=weights)
|
|
29
|
+
return (
|
|
30
|
+
[float(value) for value in regression.X_thresholds_],
|
|
31
|
+
[float(value) for value in regression.y_thresholds_],
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
11
35
|
class IsotonicRegressionCalibrator(BaseEstimator, ClassifierMixin):
|
|
12
36
|
def __init__(self, base_clf):
|
|
13
37
|
self.base_clf = base_clf
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
|
-
from datetime import datetime
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
8
|
|
|
9
9
|
import xgboost
|
|
10
10
|
from dateutil.relativedelta import relativedelta
|
|
@@ -94,7 +94,7 @@ class AccessibilityModel(BugModel):
|
|
|
94
94
|
|
|
95
95
|
This function provides an option to extend the dataset used for model training by including older bugs.
|
|
96
96
|
"""
|
|
97
|
-
lookup_start_date = datetime.
|
|
97
|
+
lookup_start_date = datetime.now(timezone.utc) - relativedelta(months=months)
|
|
98
98
|
params = {
|
|
99
99
|
"f1": "creation_ts",
|
|
100
100
|
"o1": "greaterthan",
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
|
-
from datetime import datetime
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
8
|
|
|
9
|
-
import dateutil.parser
|
|
10
9
|
import xgboost
|
|
11
10
|
from dateutil.relativedelta import relativedelta
|
|
12
11
|
from imblearn.pipeline import Pipeline as ImblearnPipeline
|
|
@@ -116,12 +115,15 @@ class BackoutModel(CommitModel):
|
|
|
116
115
|
def get_labels(self):
|
|
117
116
|
classes = {}
|
|
118
117
|
|
|
119
|
-
two_years_and_six_months_ago = datetime.
|
|
118
|
+
two_years_and_six_months_ago = datetime.now(timezone.utc) - relativedelta(
|
|
120
119
|
years=2, months=6
|
|
121
120
|
)
|
|
122
121
|
|
|
123
122
|
for commit_data in repository.get_commits():
|
|
124
|
-
pushdate =
|
|
123
|
+
pushdate = datetime.fromisoformat(commit_data["pushdate"])
|
|
124
|
+
if pushdate.tzinfo is None:
|
|
125
|
+
pushdate = pushdate.replace(tzinfo=timezone.utc)
|
|
126
|
+
|
|
125
127
|
if pushdate < two_years_and_six_months_ago:
|
|
126
128
|
continue
|
|
127
129
|
|
|
@@ -8,71 +8,46 @@ from collections import Counter
|
|
|
8
8
|
from datetime import datetime, timezone
|
|
9
9
|
|
|
10
10
|
import dateutil.parser
|
|
11
|
-
import
|
|
11
|
+
import numpy as np
|
|
12
12
|
from dateutil.relativedelta import relativedelta
|
|
13
|
+
from sklearn.calibration import CalibratedClassifierCV
|
|
13
14
|
from sklearn.compose import ColumnTransformer
|
|
14
15
|
from sklearn.feature_extraction import DictVectorizer
|
|
16
|
+
from sklearn.feature_extraction.text import TfidfVectorizer
|
|
15
17
|
from sklearn.pipeline import Pipeline
|
|
18
|
+
from sklearn.svm import LinearSVC
|
|
16
19
|
|
|
17
|
-
from bugbug import bug_features, bugzilla, feature_cleanup
|
|
20
|
+
from bugbug import bug_features, bugzilla, feature_cleanup
|
|
18
21
|
from bugbug.bugzilla import get_product_component_count
|
|
19
22
|
from bugbug.model import BugModel
|
|
20
|
-
from bugbug.model_calibration import IsotonicRegressionCalibrator
|
|
21
23
|
|
|
22
24
|
logging.basicConfig(level=logging.INFO)
|
|
23
25
|
logger = logging.getLogger(__name__)
|
|
24
26
|
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
PRODUCTS = {
|
|
28
|
-
"Core",
|
|
29
|
-
"External Software Affecting Firefox",
|
|
30
|
-
"DevTools",
|
|
31
|
-
"Firefox for Android",
|
|
32
|
-
"Firefox",
|
|
33
|
-
"Toolkit",
|
|
34
|
-
"WebExtensions",
|
|
35
|
-
"Firefox Build System",
|
|
36
|
-
}
|
|
28
|
+
GENERIC_COMPONENTS = {"General", "Untriaged"}
|
|
37
29
|
|
|
38
|
-
PRODUCT_COMPONENTS = {
|
|
39
|
-
"Cloud Services": {"Server: Firefox Accounts"},
|
|
40
|
-
}
|
|
41
30
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"Core::JavaScript",
|
|
48
|
-
"Core::Layout",
|
|
49
|
-
"Core::Networking",
|
|
50
|
-
"Core::Print",
|
|
51
|
-
"Core::WebRTC",
|
|
52
|
-
"Toolkit::Password Manager",
|
|
53
|
-
"DevTools",
|
|
54
|
-
"External Software Affecting Firefox",
|
|
55
|
-
"WebExtensions",
|
|
56
|
-
"Firefox Build System",
|
|
57
|
-
"Firefox for Android",
|
|
58
|
-
]
|
|
31
|
+
def get_initial_component(bug):
|
|
32
|
+
for history in bug["history"]:
|
|
33
|
+
for change in history["changes"]:
|
|
34
|
+
if change["field_name"] == "component":
|
|
35
|
+
return change["removed"]
|
|
59
36
|
|
|
60
|
-
|
|
61
|
-
"Core::DOM": "Core::DOM: Core & HTML",
|
|
62
|
-
"Core::JavaScript": "Core::JavaScript Engine",
|
|
63
|
-
"Core::Print": "Core::Printing: Output",
|
|
64
|
-
"DevTools": "DevTools::General",
|
|
65
|
-
"External Software Affecting Firefox": "External Software Affecting Firefox::Other",
|
|
66
|
-
"WebExtensions": "WebExtensions::Untriaged",
|
|
67
|
-
"Firefox Build System": "Firefox Build System::General",
|
|
68
|
-
"Firefox for Android": "Firefox for Android::General",
|
|
69
|
-
}
|
|
37
|
+
return bug["component"]
|
|
70
38
|
|
|
71
|
-
|
|
39
|
+
|
|
40
|
+
class BaseComponentModel(BugModel):
|
|
41
|
+
"""Pipeline and evaluation shared by the models that classify bugs into components."""
|
|
42
|
+
|
|
43
|
+
def __init__(self, lemmatization=False):
|
|
72
44
|
BugModel.__init__(self, lemmatization)
|
|
73
45
|
|
|
74
46
|
self.cross_validation_enabled = False
|
|
75
47
|
self.calculate_importance = False
|
|
48
|
+
# The test set is made of the most recent bugs (see train_test_split), so
|
|
49
|
+
# retrain on all bugs after the evaluation.
|
|
50
|
+
self.entire_dataset_training = True
|
|
76
51
|
|
|
77
52
|
feature_extractors = [
|
|
78
53
|
bug_features.HasSTR(),
|
|
@@ -85,6 +60,13 @@ class ComponentModel(BugModel):
|
|
|
85
60
|
bug_features.Whiteboard(),
|
|
86
61
|
bug_features.Patches(),
|
|
87
62
|
bug_features.Landings(),
|
|
63
|
+
bug_features.BugReporter(),
|
|
64
|
+
# Bugs are rolled back to their creation, so this is the product the bug
|
|
65
|
+
# was filed in.
|
|
66
|
+
bug_features.Product(),
|
|
67
|
+
bug_features.OpSys(),
|
|
68
|
+
bug_features.Platform(),
|
|
69
|
+
bug_features.MentionedPathsComponents(),
|
|
88
70
|
]
|
|
89
71
|
|
|
90
72
|
cleanup_functions = [
|
|
@@ -104,11 +86,17 @@ class ComponentModel(BugModel):
|
|
|
104
86
|
]
|
|
105
87
|
)
|
|
106
88
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
89
|
+
# A linear model on sparse n-gram features is more accurate (and faster
|
|
90
|
+
# to train) than gradient boosted trees for this task. The L1 penalty
|
|
91
|
+
# keeps the weights sparse, so the model stays small despite the large
|
|
92
|
+
# vocabulary. Probabilities are calibrated on out-of-fold predictions.
|
|
93
|
+
estimator = CalibratedClassifierCV(
|
|
94
|
+
LinearSVC(penalty="l1", dual=False),
|
|
95
|
+
method="isotonic",
|
|
96
|
+
cv=3,
|
|
97
|
+
ensemble=False,
|
|
98
|
+
n_jobs=3,
|
|
99
|
+
)
|
|
112
100
|
|
|
113
101
|
self.clf = Pipeline(
|
|
114
102
|
[
|
|
@@ -117,10 +105,35 @@ class ComponentModel(BugModel):
|
|
|
117
105
|
ColumnTransformer(
|
|
118
106
|
[
|
|
119
107
|
("data", DictVectorizer(), "data"),
|
|
120
|
-
(
|
|
108
|
+
(
|
|
109
|
+
"title",
|
|
110
|
+
self.text_vectorizer(
|
|
111
|
+
min_df=2,
|
|
112
|
+
ngram_range=(1, 2),
|
|
113
|
+
sublinear_tf=True,
|
|
114
|
+
max_features=30000,
|
|
115
|
+
),
|
|
116
|
+
"title",
|
|
117
|
+
),
|
|
118
|
+
(
|
|
119
|
+
"title_char",
|
|
120
|
+
TfidfVectorizer(
|
|
121
|
+
min_df=3,
|
|
122
|
+
analyzer="char_wb",
|
|
123
|
+
ngram_range=(2, 5),
|
|
124
|
+
sublinear_tf=True,
|
|
125
|
+
max_features=30000,
|
|
126
|
+
),
|
|
127
|
+
"title",
|
|
128
|
+
),
|
|
121
129
|
(
|
|
122
130
|
"comments",
|
|
123
|
-
self.text_vectorizer(
|
|
131
|
+
self.text_vectorizer(
|
|
132
|
+
min_df=2,
|
|
133
|
+
ngram_range=(1, 2),
|
|
134
|
+
sublinear_tf=True,
|
|
135
|
+
max_features=80000,
|
|
136
|
+
),
|
|
124
137
|
"comments",
|
|
125
138
|
),
|
|
126
139
|
]
|
|
@@ -133,6 +146,108 @@ class ComponentModel(BugModel):
|
|
|
133
146
|
]
|
|
134
147
|
)
|
|
135
148
|
|
|
149
|
+
def items_gen(self, classes):
|
|
150
|
+
# Remember when each bug was filed and in which component, for the evaluation.
|
|
151
|
+
self.items_metadata = []
|
|
152
|
+
for bug, label in super().items_gen(classes):
|
|
153
|
+
self.items_metadata.append(
|
|
154
|
+
(bug["creation_time"], get_initial_component(bug) in GENERIC_COMPONENTS)
|
|
155
|
+
)
|
|
156
|
+
yield bug, label
|
|
157
|
+
|
|
158
|
+
def train_test_split(self, X, y):
|
|
159
|
+
# Test on the most recent bugs, as the model is used to classify new bugs.
|
|
160
|
+
# A random split overestimates the accuracy, e.g. it ignores the drift in the
|
|
161
|
+
# bugs that are filed and the creation of new components.
|
|
162
|
+
creation_times, filed_in_generic = zip(*self.items_metadata[: len(y)])
|
|
163
|
+
order = np.argsort(creation_times, kind="stable")
|
|
164
|
+
train_size = int(len(y) * 0.9)
|
|
165
|
+
|
|
166
|
+
# Make sure every component has at least 3 examples in the training set, by
|
|
167
|
+
# moving the oldest test bugs of recently created components to it.
|
|
168
|
+
train_idx = list(order[:train_size])
|
|
169
|
+
test_idx = []
|
|
170
|
+
counts = Counter(y[train_idx])
|
|
171
|
+
for i in order[train_size:]:
|
|
172
|
+
if counts[y[i]] < 3:
|
|
173
|
+
counts[y[i]] += 1
|
|
174
|
+
train_idx.append(i)
|
|
175
|
+
else:
|
|
176
|
+
test_idx.append(i)
|
|
177
|
+
|
|
178
|
+
# Bugs filed in a General/Untriaged component are the ones the model is mostly
|
|
179
|
+
# used for, i.e. the ones that need to be moved to the right component.
|
|
180
|
+
self.test_subsets = {
|
|
181
|
+
"Bugs filed in General/Untriaged": np.array(filed_in_generic)[test_idx]
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return X.iloc[train_idx], X.iloc[test_idx], y[train_idx], y[test_idx]
|
|
185
|
+
|
|
186
|
+
def get_test_subsets(self):
|
|
187
|
+
return self.test_subsets
|
|
188
|
+
|
|
189
|
+
def fit_classifier(self, X, y):
|
|
190
|
+
super().fit_classifier(X, y)
|
|
191
|
+
|
|
192
|
+
# Most weights are zero thanks to the L1 penalty, store them as a sparse
|
|
193
|
+
# matrix to reduce the model size.
|
|
194
|
+
for calibrated_classifier in self.clf.named_steps[
|
|
195
|
+
"estimator"
|
|
196
|
+
].calibrated_classifiers_:
|
|
197
|
+
calibrated_classifier.estimator.sparsify()
|
|
198
|
+
|
|
199
|
+
def get_feature_names(self):
|
|
200
|
+
return self.clf.named_steps["union"].get_feature_names_out()
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class ComponentModel(BaseComponentModel):
|
|
204
|
+
PRODUCTS = {
|
|
205
|
+
"Core",
|
|
206
|
+
"External Software Affecting Firefox",
|
|
207
|
+
"DevTools",
|
|
208
|
+
"Firefox for Android",
|
|
209
|
+
"Firefox",
|
|
210
|
+
"Toolkit",
|
|
211
|
+
"WebExtensions",
|
|
212
|
+
"Firefox Build System",
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
PRODUCT_COMPONENTS = {
|
|
216
|
+
"Cloud Services": {"Server: Firefox Accounts"},
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
CONFLATED_COMPONENTS = [
|
|
220
|
+
"Core::Audio/Video",
|
|
221
|
+
"Core::DOM",
|
|
222
|
+
"Core::Graphics",
|
|
223
|
+
"Core::IPC",
|
|
224
|
+
"Core::JavaScript",
|
|
225
|
+
"Core::Layout",
|
|
226
|
+
"Core::Networking",
|
|
227
|
+
"Core::Print",
|
|
228
|
+
"Core::WebRTC",
|
|
229
|
+
"Toolkit::Password Manager",
|
|
230
|
+
"DevTools",
|
|
231
|
+
"External Software Affecting Firefox",
|
|
232
|
+
"WebExtensions",
|
|
233
|
+
"Firefox Build System",
|
|
234
|
+
"Firefox for Android",
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
CONFLATED_COMPONENTS_MAPPING = {
|
|
238
|
+
"Core::DOM": "Core::DOM: Core & HTML",
|
|
239
|
+
"Core::JavaScript": "Core::JavaScript Engine",
|
|
240
|
+
"Core::Print": "Core::Printing: Output",
|
|
241
|
+
"DevTools": "DevTools::General",
|
|
242
|
+
"External Software Affecting Firefox": "External Software Affecting Firefox::Other",
|
|
243
|
+
"WebExtensions": "WebExtensions::Untriaged",
|
|
244
|
+
"Firefox Build System": "Firefox Build System::General",
|
|
245
|
+
"Firefox for Android": "Firefox for Android::General",
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
def __init__(self, lemmatization=False):
|
|
249
|
+
super().__init__(lemmatization)
|
|
250
|
+
|
|
136
251
|
self.CONFLATED_COMPONENTS_INVERSE_MAPPING = {
|
|
137
252
|
v: k for k, v in self.CONFLATED_COMPONENTS_MAPPING.items()
|
|
138
253
|
}
|
|
@@ -249,9 +364,6 @@ class ComponentModel(BugModel):
|
|
|
249
364
|
if count > threshold and product_component in active_product_components
|
|
250
365
|
)
|
|
251
366
|
|
|
252
|
-
def get_feature_names(self):
|
|
253
|
-
return self.clf.named_steps["union"].get_feature_names_out()
|
|
254
|
-
|
|
255
367
|
def check(self):
|
|
256
368
|
success = super().check()
|
|
257
369
|
|