Skip to content

Commit

Permalink
ci: run pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
hollandjg committed Apr 28, 2023
1 parent 147d61a commit f36bfa3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repos:
args:
- "--max-line-length=100"
- "--extend-ignore=E203"
- "--per-file-ignores=__init__.py:F401"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.991"
hooks:
Expand Down
2 changes: 1 addition & 1 deletion src/autora/synthetic/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
""" Models bundled with AutoRA. """
from . import expected_value, prospect_theory, weber_fechner, template_experiment
from . import expected_value, prospect_theory, template_experiment, weber_fechner
10 changes: 4 additions & 6 deletions src/autora/synthetic/data/template_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@
from functools import partial

import numpy as np
from numpy.typing import ArrayLike

from autora.variable import DV, IV, VariableCollection
from numpy.typing import ArrayLike

from ..inventory import SyntheticExperimentCollection, register


def template_experiment(
# Add any configurable parameters with their defaults here:
name: str ="Template Experiment",
name: str = "Template Experiment",
added_noise: float = 0.1,
random_state: int = 42,
):
Expand Down Expand Up @@ -94,14 +95,12 @@ def template_experiment(
# Define experiment runner
rng = np.random.default_rng(random_state)


def experiment_runner(x: ArrayLike, added_noise_=added_noise):
"""A function which simulates noisy observations."""
x_ = np.array(x)
y = x_ + 1. + rng.normal(0, added_noise_, size=x_.shape)
y = x_ + 1.0 + rng.normal(0, added_noise_, size=x_.shape)
return y


ground_truth = partial(experiment_runner, added_noise_=0.0)
"""A function which simulates perfect observations"""

Expand All @@ -121,7 +120,6 @@ def plotter(model=None):
if model is not None:
plt.plot(x, model.predict(x), label="Fitted Model")


plt.xlabel(variables.independent_variables[0].name)
plt.ylabel(variables.dependent_variables[0].name)
plt.legend()
Expand Down
4 changes: 3 additions & 1 deletion src/autora/synthetic/data/weber_fechner.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,7 @@ def plotter(
return collection


register("weber-fechner", weber_fechner_law) # todo: make a better interface for multiple aliases
register(
"weber-fechner", weber_fechner_law
) # todo: make a better interface for multiple aliases
register("weber_fechner", weber_fechner_law)

0 comments on commit f36bfa3

Please sign in to comment.