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
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
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
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
b28a1b48f2
add license (#118)
3 years ago
594e68f114
partial update to readme
1 year ago
4ad6fd42a2
latest heuristics
2 years ago
2b5ede2fd5
Update 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
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
  1. BOHR (Big Old Heuristic Repository)
  2. ----------------------------------
  3. |GitHub license| |Maintainability| |GitHub make-a-pull-requests|
  4. BOHR is a **repository of heuristics** for preparation (filtering, labeling, grouping, filtering) of software engineering (SE) artifacts, e.g. commits, bug reports, code snippets, etc. SE artifact preparation is often required by researchers in the field of Software Engineering and Mining Software Repositories (MSR) to convert artifacts mined from software repositories into datasets that can be used to conduct empirical experiments and to train machine learning models.
  5. Preparing each artifact manually is expensive and does not scale well. Therefore BOHR offers an approach to define heuristics to do the job automatically. Even though heuristic outputs can be noisy by their definition, using a large number of them and "smartly" combining them compensates for the quality of outputs.
  6. TBD:
  7. Examples
  8. =====================
  9. 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.
  10. 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.
  11. BOHR is a wrapper around snorkel which:
  12. * **Simplifies** the process of **adding new heuristics** and **evaluating their effectiveness**;
  13. * **Labels the datasets** registered with BOHR and **automatically updates the labels** once heuristics are added;
  14. * 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>`_.
  15. .. contents:: **Contents**
  16. :backlinks: none
  17. How do heuristics look like?
  18. ===================================
  19. .. code-block:: python
  20. # ... other imports
  21. from bohrapi.core import Heuristic
  22. from bohrlabels.core import OneOrManyLabels
  23. from bohrapi.artifacts import Commit
  24. from bohrlabels.labels import CommitLabel
  25. @Heuristic(Commit)
  26. def bugless_if_many_files_changes(commit: Commit) -> OneOrManyLabels:
  27. if len(commit.commit_files) > 15:
  28. return CommitLabel.NonBugFix
  29. else:
  30. return None
  31. Important things to note:
  32. #. A heuristics is marked with the ``Heuristic`` decorator, and the artifact type to which it is applied is passed to it as a parameter;
  33. #. 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;
  34. #. 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.
  35. Main Concepts
  36. ====================================
  37. BOHR is a repository of *heuristics*, hence, a heuristic is a primary concept in BOHR. Sub-program (python function) that accepts an artifact or multiple artifacts of the same or different types.
  38. Artifact is BOHR's abstraction that represents a software engineering artifact - a product of SE activities, e,g. code, commit, software project, software repository, issue report. *Dataset* is a collection of artifacts of the same type.
  39. *Task* is an abstraction that describes the problem that a researcher is working on in terms of BOHR. The input and the output of the tasks are datasets. Task types are labeling, grouping, linking, filtering. The task is defined by specifying artifact type(s) heuristics are applied to, possible outputs of heuristics, strategy how heuristics aree combined, test datasets and metrics to use to evaluate the effectiveness of heuristics.
  40. *Experiment* is an attempt to solve a task using a specific set of heuristics (and training data if needed).
  41. BOHR workflow
  42. ===================================
  43. 1a. For the given task, pull existing heuristics developed by community
  44. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45. ``bohr clone https://github.com/giganticode/bohr-workdir-bugginess``
  46. This will clone the so called BOHR working directory that corresponds to the <task> to <path>
  47. 3 Check whether the existing labeled datasets are suitable for your purposes.
  48. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. Every task comes with a trained classifier and a default dataset labeled by this classifier. Check whether the default datasets suits your purposes.
  50. ``cd bugginess-work-dir && bohr pull default``
  51. The path where dataset is load will be displayed.
  52. 4. Label your own dataset with the default classifier.
  53. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  54. ``$ bohr dataset add ~/new_commit_dataset.csv``
  55. ``$ bohr task add-dataset bugginess new_commit_dataset --repro``
  56. 5. Develop a new heuristic
  57. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  58. ``$ vi heuristics/commit_files.py``
  59. 6. Debug and tune the heuristic by checking its coverage and accuracy on a stand-alone test-set
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. ``$ bohr repro``
  62. 7. Submit a pull request with the new heuristic to remote BOHR repository
  63. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. ``$ bohr upload``
  65. 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.
  66. 8. Add a new task
  67. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. ``$ bohr task add tangled-commits \``
  69. ``... -l TangledCommit.NonTangled,TangledCommit.Tangled \``
  70. ``... --repro``
  71. Installation
  72. ==============
  73. TODO: add links to other repos
  74. Pre-prints and publications
  75. =============================
  76. .. code-block::
  77. @inproceedings{babii2021mining,
  78. title={Mining Software Repositories with a Collaborative Heuristic Repository},
  79. author={Babii, Hlib and Prenner, Julian Aron and Stricker, Laurin and Karmakar, Anjan and Janes, Andrea and Robbes, Romain},
  80. booktitle={2021 IEEE/ACM 43rd International Conference on Software Engineering: New Ideas and Emerging Results (ICSE-NIER)},
  81. pages={106--110},
  82. year={2021},
  83. organization={IEEE}
  84. }
  85. .. |GitHub license| image:: https://img.shields.io/github/license/giganticode/bohr.svg
  86. :target: https://github.com/giganticode/bohr/blob/master/LICENSE
  87. .. |GitHub make-a-pull-requests| image:: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
  88. :target: http://makeapullrequest.com
  89. .. |Maintainability| image:: https://codeclimate.com/github/giganticode/bohr/badges/gpa.svg
  90. :target: https://codeclimate.com/github/giganticode/bohr
  91. :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...