Skip to content

Commit

Permalink
Adapt for publication.
Browse files Browse the repository at this point in the history
  • Loading branch information
kklein committed Jun 9, 2024
1 parent 0b99eb1 commit fcb2048
Show file tree
Hide file tree
Showing 35 changed files with 84 additions and 87 deletions.
3 changes: 0 additions & 3 deletions .github/assets/.condarc
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
repodata_use_zst: true
channels:
- qc-internal
- conda-forge
custom_channels:
qc-internal: https://conda.prod.quantco.cloud/t/${QUETZ_API_KEY}/get/
conda_build:
pkg_format: 2
3 changes: 0 additions & 3 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ defaults:
run:
shell: bash -el {0}

env:
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}

jobs:
run_benchmarks:
name: Run benchmarks
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ defaults:
run:
shell: bash -el {0}

env:
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}

jobs:
pre-commit-checks:
name: Pre-commit Checks
Expand Down Expand Up @@ -79,8 +76,3 @@ jobs:
with:
report-title: Unit Tests - ${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Windows' }} - Python ${{ matrix.python-version }}
custom-arguments: --cov=metalearners --cov-report=xml --cov-report term-missing --color=yes
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: Quantco/metalearners
6 changes: 1 addition & 5 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@ jobs:
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Build conda package
uses: quantco/[email protected]
with:
quetz-api-key: ${{ secrets.QUETZ_API_KEY }}
upload-quetz: ${{ startsWith(github.ref, 'refs/tags/') }}
# TODO: Build and upload to PyPI.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ repos:
- id: insert-license
types: [python]
args:
- --license-base64
- IyBDb3B5cmlnaHQgKGMpIFF1YW50Q28gMjAyNC0yMDI0CiMgU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEJTRC0zLUNsYXVzZQo=
- --dynamic-years
- --comment-style
- "#"
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# metalearners

MetaLearners for CATE estimation

## Installation

You can install the package in development mode using:

```bash
git clone https://github.com/quantco/metalearners
cd metalearners

# create and activate a fresh environment named metalearners
# see environment.yml for details
micromamba create -f environment.yml
micromamba activate metalearners

pre-commit install
pip install --no-build-isolation -e .
```

## Credits

Original implementation by @FrancescMartiEscofetQC and @kklein.
4 changes: 2 additions & 2 deletions benchmarks/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import json
from pathlib import Path
Expand Down
4 changes: 3 additions & 1 deletion conda.recipe/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ tests:

about:
homepage: https://github.com/quantco/metalearners
license: LicenseRef-QuantCo
license: BSD-3-Clause
license_family: BSD
license_file: LICENSE
summary: "MetaLearners for CATE estimation"
4 changes: 2 additions & 2 deletions data/download_twins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import pandas as pd
from git_root import git_root
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2022-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

# Configuration file for the Sphinx documentation builder.
#
Expand Down
4 changes: 2 additions & 2 deletions metalearners/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2022-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import importlib.metadata
import warnings
Expand Down
4 changes: 2 additions & 2 deletions metalearners/_typing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from collections.abc import Collection
from typing import Literal, Protocol, Union
Expand Down
4 changes: 2 additions & 2 deletions metalearners/_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import operator
from collections.abc import Callable
Expand Down
4 changes: 2 additions & 2 deletions metalearners/cross_fit_estimator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import warnings
from dataclasses import dataclass, field
Expand Down
4 changes: 2 additions & 2 deletions metalearners/data_generation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from typing import Literal

Expand Down
4 changes: 2 additions & 2 deletions metalearners/drlearner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
from typing_extensions import Self
Expand Down
4 changes: 2 additions & 2 deletions metalearners/explainer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from collections.abc import Collection

Expand Down
4 changes: 2 additions & 2 deletions metalearners/metalearner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from abc import ABC, abstractmethod
from collections.abc import Callable, Collection
Expand Down
4 changes: 2 additions & 2 deletions metalearners/outcome_functions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from collections.abc import Callable

Expand Down
5 changes: 2 additions & 3 deletions metalearners/rlearner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo

# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
from sklearn.metrics import log_loss, root_mean_squared_error
Expand Down
5 changes: 2 additions & 3 deletions metalearners/slearner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo

# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import warnings

Expand Down
4 changes: 2 additions & 2 deletions metalearners/tlearner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause


import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions metalearners/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np

Expand Down
5 changes: 2 additions & 3 deletions metalearners/xlearner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo

# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
from typing_extensions import Self
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause


import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions tests/test__utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from contextlib import nullcontext as does_not_raise

Expand Down
10 changes: 0 additions & 10 deletions tests/test_core.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_cross_fit_estimator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from functools import partial

Expand Down
4 changes: 2 additions & 2 deletions tests/test_data_generation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from contextlib import nullcontext as does_not_raise

Expand Down
4 changes: 2 additions & 2 deletions tests/test_learner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause


import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions tests/test_metalearner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

from itertools import chain

Expand Down
4 changes: 2 additions & 2 deletions tests/test_outcome_functions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
import pytest
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rlearner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
import pandas as pd
Expand Down
4 changes: 2 additions & 2 deletions tests/test_slearner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
import pandas as pd
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) QuantCo 2024-2024
# SPDX-License-Identifier: LicenseRef-QuantCo
# # Copyright (c) QuantCo 2024-2024
# # SPDX-License-Identifier: BSD-3-Clause

import numpy as np
import pytest
Expand Down

0 comments on commit fcb2048

Please sign in to comment.