Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Integration:  git github
hlib 74ddbae8a1
another heuristic set for demo (add 1 heuristic)
1 year ago
5e101b0d8d
upgrade to new api: make heuristics return OneOrMoreLabels type; rename the files so that they are the same as heuristic names
1 year ago
74ddbae8a1
another heuristic set for demo (add 1 heuristic)
1 year ago
70a5408903
chore: upgrade bohr-framework to 0.4.10 (#197)
2 years ago
4cc932160e
add dvc pre-commit hooks
3 years ago
8dd7c80d2e
Pylint - black compatibility (#80)
3 years ago
7f11f72192
use setup-bohr script for travis build
3 years ago
b28a1b48f2
add license (#118)
3 years ago
1beac68f7c
Update README.rst
2 years ago
4ad6fd42a2
latest heuristics
2 years ago
a5994a5690
Create docs.md
1 year ago
b32c3c3f8d
bohr-0.5
2 years ago
b32c3c3f8d
bohr-0.5
2 years ago
d3317bae62
chore: update renovate.json to group non-major deps
2 years ago
8441acba43
tasks.json: fix repo name
2 years ago
Storage Buckets

README.rst

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
  1. BOHR (Big Old Heuristic Repository)
  2. ----------------------------------
  3. |GitHub license| |Maintainability| |GitHub make-a-pull-requests|
  4. BOHR is a **repository of heuristics** for categorization of software engineering artifacts, e.g. commits, bug reports, etc.
  5. Categorization of artifacts is often required to create ground-truth datasets to train machine learning models on. For example, to train a model that classifies commits as "feature", "bugfix", or "refactoring", one needs to have a dataset of commits with these labels assigned.
  6. Since creating a large dataset manually is expensive, the alternative is to come up with "heuristics", short programs that can assign noisy labels to artifacts automatically. Implementing **a large number of such heuristics** and **combining their outputs** "smartly" is the idea behind `snorkel <https://www.snorkel.org/>`_, the state-of-the-art `weak supervision <http://ai.stanford.edu/blog/weak-supervision/>`_ tool.
  7. BOHR is a wrapper around snorkel which:
  8. * **Simplifies** the process of **adding new heuristics** and **evaluating their effectiveness**;
  9. * **Labels the datasets** registered with BOHR and **automatically updates the labels** once heuristics are added;
  10. * Keeps track of heursitics used for each version of generated datasets and models, and, in general, makes sure they are **reproducible** and **easily accessable** by using `DVC <https://dvc.org>`_.
  11. .. contents:: **Contents**
  12. :backlinks: none
  13. How do heuristics look like?
  14. ===================================
  15. .. code-block:: python
  16. # ... other imports
  17. from bohrapi.core import Heuristic
  18. from bohrlabels.core import Labels
  19. from bohrapi.artifacts import Commit
  20. from bohrlabels.labels import CommitLabel
  21. @Heuristic(Commit)
  22. def bugless_if_many_files_changes(commit: Commit) -> Optional[Labels]:
  23. if len(commit.commit_files) > 15:
  24. return CommitLabel.NonBugFix
  25. else:
  26. return None
  27. Important things to note:
  28. #. A heuristics is marked with the ``Heuristic`` decorator, and the artifact type to which it is applied is passed to it as a parameter;
  29. #. The artifact instance is exposed to the heuristic as a function parameter; the properties of the artifact object can be used to implement the logic;
  30. #. The label assigned to the artifact by the heuristic is the result of the execution on the passed artifact object; the heuristic must assign one of the labels defined in the BOHR label hierarchy or ``None`` if it abstains on the data point.
  31. Main Concepts
  32. ====================================
  33. Apart from heuristics, main concepts of BOHR are **artifacts**, **datasets**, **labels**, **label assigners**, and **tasks**.
  34. **Artifact** is a central concept. It is a result of software engineering activity, e.g., code, commit, software project, software repository, issue report.
  35. A collection of artifacts of the same type forms a **dataset**, which is often produced by MSR activities. The central use-case of BOHR is to assign labels to a dataset according to the given **task**. The purpose of assigning labels is to prepare datasets to be used in empirical studies or for training machine learning models.
  36. **Labels** can be attached to artifacts and generally speaking can contain arbitrary information. Based on labels artifacts can be filtered or categorized.
  37. Labels to artifacts are assigned by **assigners**. There are **single-artifact** and **bulk** assigners. Single-artifact assigners assign labels directly to specific artifacts. These are normally human assigners that assign label to artifacts one by one (possibly as part of actively learning approach to be implement as part of BOHR). Bulk assigners are programs that infer the label to be assigned from the given input artifact. Examples of bulk assigners are heuristics themselves, their combinations (majority vote and label models), and deep learning models.
  38. W.r.t. the presence of labels for the given task, datasets can be classified as **labeled** or **unlabeled**. Labeled datasets can be labeled with single-artifact assigners or with bulk-assigners. Even though, we consider datasets labeled by single-artifact assigners to be ground truth datasets, the border between ground-truth labels and not are blurry, see agree-to-disagree section.
  39. By working on a **task**, researchers aim to assign labels to datasets according to the rules defined by the task. E.g. there can be a task according to which an artifact can be assigned "bug-fixing" xor "non-bug-fixing" labels. The approach of assigning labels (mostly by using a trained bulk-assinger) is evaluated on a stand-alone test set(s), which has labels assigned according to strictly-defined rules.
  40. BOHR workflow
  41. ===================================
  42. 1. Get the list of pre-defined tasks
  43. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44. ``bohr tasks``
  45. 2. For the given task, pull existing heuristics developed by community
  46. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. ``bohr clone bugginess ~/bugginess-work-dir``
  48. This will clone the so called BOHR working directory that corresponds to the <task> to <path>
  49. 3 Check whether the existing labeled datasets are suitable for your purposes.
  50. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. Every task comes with a trained classifier and a default dataset labeled by this classifier. Check whether the default datasets suits your purposes.
  52. ``cd bugginess-work-dir && bohr pull default``
  53. The path where dataset is load will be displayed.
  54. 4. Label your own dataset with the default classifier.
  55. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56. ``$ bohr dataset add ~/new_commit_dataset.csv``
  57. ``$ bohr task add-dataset bugginess new_commit_dataset --repro``
  58. 5. Develop a new heuristic
  59. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. ``$ vi heuristics/commit_files.py``
  61. 6. Debug and tune the heuristic by checking its coverage and accuracy on a stand-alone test-set
  62. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63. ``$ bohr repro``
  64. 7. Submit a pull request with the new heuristic to remote BOHR repository
  65. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  66. ``$ bohr upload``
  67. Label model is trained and metrics are calculated on stand-alone test set as a part of a CI-pipeline. If metrics has been improved, the new heuristic is added to BOHR, and is available for other researchers.
  68. 8. Add a new task
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. ``$ bohr task add tangled-commits \``
  71. ``... -l TangledCommit.NonTangled,TangledCommit.Tangled \``
  72. ``... --repro``
  73. Installation
  74. ==============
  75. Python >= 3.8 is required, use of virtual environment is strongly recommended.
  76. #. Run ``git clone https://github.com/giganticode/bohr && cd bohr``
  77. #. Install BOHR framework library: ``bin/setup-bohr.sh``. This will install `bohr-framework <https://github.com/giganticode/bohr-framework>`_, dependencies and tools to run heursistics.
  78. Contribute to the framework
  79. =============================
  80. To contribute to the BOHR-framework, which is used to manage the BOHR repo, please refer to the `bohr-framework repo <https://github.com/giganticode/bohr-framework>`_.
  81. Pre-prints and publications
  82. =============================
  83. .. code-block::
  84. @inproceedings{babii2021mining,
  85. title={Mining Software Repositories with a Collaborative Heuristic Repository},
  86. author={Babii, Hlib and Prenner, Julian Aron and Stricker, Laurin and Karmakar, Anjan and Janes, Andrea and Robbes, Romain},
  87. booktitle={2021 IEEE/ACM 43rd International Conference on Software Engineering: New Ideas and Emerging Results (ICSE-NIER)},
  88. pages={106--110},
  89. year={2021},
  90. organization={IEEE}
  91. }
  92. .. |GitHub license| image:: https://img.shields.io/github/license/giganticode/bohr.svg
  93. :target: https://github.com/giganticode/bohr/blob/master/LICENSE
  94. .. |GitHub make-a-pull-requests| image:: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
  95. :target: http://makeapullrequest.com
  96. .. |Maintainability| image:: https://codeclimate.com/github/giganticode/bohr/badges/gpa.svg
  97. :target: https://codeclimate.com/github/giganticode/bohr
  98. :alt: Code Climate
Tip!

Press p or to see the previous file or, n or to see the next file

About

Big Old Heuristic Repository

Collaborators 1

Comments

Loading...