<commit_before># Scientist4J

A port of Github's refactoring tool [Scientist](https://github.com/github/scientist) in Java

# Installation

```java
<dependency>
    <groupId>com.github.rawls238</groupId>
    <artifactId>Scientist4J</artifactId>
    <version>0.1</version>
</dependency>
```
# Usage

This Java port supports most of the functionality of the original Scientist library in Ruby, however its interface is a bit different.

The core component of this library is the `Experiment<T>` class. It's recommended to use this class as a Singleton. The main usage is as follows:

```java
Experiment<Integer> e = new Experiment("foo");
e.run(this::controlFunction, this::candidateFunction);
```

This does a bunch of stuff behind the scenes:
* It decides whether or not to run the candidate function,
* Randomizes the order in which control and candidate functions are run,
* Measures the durations of all behaviors,
* Compares the result of the two,
* Swallows (but records) any exceptions raised by the candidate and
* Publishes all this information.

Out of the box this uses [Dropwizard metrics](https://dropwizard.github.io/metrics/3.1.0/) to report the following stats.
The following metrics are reported which have the form `scientist.[experiment name].*`:

* duration of default behavior in ms
* duration of candidate behavior in ms
* counter of total number of users going through the codepath
* counter of number of mismatches<commit_msg>Update Artifact Id<commit_after># Scientist4J

A port of Github's refactoring tool [Scientist](https://github.com/github/scientist) in Java

# Installation

```java
<dependency>
    <groupId>com.github.rawls238</groupId>
    <artifactId>Scientist4JCore</artifactId>
    <version>0.1</version>
</dependency>
```
# Usage

This Java port supports most of the functionality of the original Scientist library in Ruby, however its interface is a bit different.

The core component of this library is the `Experiment<T>` class. It's recommended to use this class as a Singleton. The main usage is as follows:

```java
Experiment<Integer> e = new Experiment("foo");
e.run(this::controlFunction, this::candidateFunction);
```

This does a bunch of stuff behind the scenes:
* It decides whether or not to run the candidate function,
* Randomizes the order in which control and candidate functions are run,
* Measures the durations of all behaviors,
* Compares the result of the two,
* Swallows (but records) any exceptions raised by the candidate and
* Publishes all this information.

Out of the box this uses [Dropwizard metrics](https://dropwizard.github.io/metrics/3.1.0/) to report the following stats.
The following metrics are reported which have the form `scientist.[experiment name].*`:

* duration of default behavior in ms
* duration of candidate behavior in ms
* counter of total number of users going through the codepath
* counter of number of mismatches
{'fraction_non_alphanumeric': 0.0825593395252838, 'fraction_numerical': 0.0068799449604403165, 'mean_word_length': 4.922606924643585, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1127868', 'n_tokens_mistral': 821, 'n_tokens_neox': 766, 'n_words': 361}