Skip to content

Commit

Permalink
BUILD: release Facet 1.2.0rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
j-ittner authored Jun 1, 2021
2 parents c7d87e7 + dbce0d5 commit 472daf9
Show file tree
Hide file tree
Showing 9 changed files with 333 additions and 111 deletions.
22 changes: 22 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Release Notes
=============

FACET 1.2
---------

FACET 1.2 introduces the ability to run simulations on a subsample of the data used to
fit the underlying crossfit.
One example where this can be useful is to use only a recent period of a time series as
the baseline of a simulation.

1.2.0
~~~~~

- API: new optional parameter `subsample` in method
:meth:`.BaseUnivariateSimulator.simulate_feature` can be used to specify a subsample
to be used in the simulation (but simulating using a crossfit based on the full
sample)


FACET 1.1
---------

Expand Down Expand Up @@ -29,6 +46,11 @@ by the :class:`.LearnerInspector`.
FACET 1.0
---------

1.0.3
~~~~~

- FIX: restrict package requirements to *gamma-pytools* 1.0.* and *sklearndf* 1.0.x, since FACET 1.0 is not compatible with *gamma-pytools* 1.1.*

1.0.2
~~~~~

Expand Down
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
trigger:
- 1.1.x
- 1.2.x
- dev/*
- release/*

pr:
- 1.1.x
- 1.2.x
- dev/*
- release/*

Expand All @@ -17,20 +17,20 @@ schedules:
displayName: Nightly full build
branches:
include:
- 1.1.x
- 1.2.x

resources:
repositories:
- repository: sklearndf
type: github
endpoint: BCG-Gamma
name: BCG-Gamma/sklearndf
ref: 1.1.x # todo - update to stable release
ref: 1.1.x
- repository: pytools
type: github
endpoint: BCG-Gamma
name: BCG-Gamma/pytools
ref: 1.1.x # todo - update to stable release
ref: 1.2.x

variables:
${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')) }}:
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- lightgbm >= 3.0
- m2r = 0.2.*
- matplotlib >= 3.3
- nbsphinx = 0.7.*
- nbsphinx ~= 0.8.5
- numpy >= 1.16
- pandas >= 1.0
- pip >= 20
Expand Down
26 changes: 13 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ license = "Apache Software License v2.0"

requires = [
# direct requirements of gamma-facet
"gamma-pytools >=1.1,<2",
"gamma-pytools ~=1.1.2",
"matplotlib >=3.0,<3.4",
"numpy >=1.16,<1.21",
"packaging >=20",
"pandas >=0.24,<1.3",
"scipy >=1.2,<1.6",
"shap >=0.34,<0.40",
"sklearndf >=1.1,<2",
"sklearndf ~=1.1.0",
# additional requirements of sklearndf
"boruta >=0.3",
"lightgbm >=3.0",
Expand Down Expand Up @@ -65,7 +65,7 @@ docs = [
"sphinx == 3.4.*",
"sphinx-autodoc-typehints == 1.11.*",
"pydata-sphinx-theme == 0.4.*",
"nbsphinx == 0.7.*",
"nbsphinx ~= 0.8.5",
"jupyter >= 1.0",
"docutils",
"xlrd == 1.2.*",
Expand Down Expand Up @@ -93,25 +93,25 @@ lightgbm = "=3.0.*"
scikit-learn = "=0.21.*"
# additional requirements of gamma-pytools
joblib = "=0.14.*"
typing_inspect = "=0.4"
typing_inspect = "=0.4.*"

[build.matrix.max]
gamma-pytools = ">=1.1,<2"
matplotlib = "<3.4"
numpy = "<1.21"
gamma-pytools = "=1.1.*"
matplotlib = "=3.3.*"
numpy = "=1.20.*"
packaging = ">=20"
pandas = "<1.3"
pandas = "=1.2.*"
python = "=3.8.*"
scipy = "<1.6"
shap = ">=0.37,<0.40"
sklearndf = ">=1.1,<2"
scipy = "=1.5.*"
shap = "=0.39.*"
sklearndf = "=1.1.*"
# additional requirements of sklearndf
boruta = ">=0.3"
lightgbm = ">=3.0"
scikit-learn = "=0.23.*"
# additional requirements of gamma-pytools
joblib = "<1.1"
typing_inspect = "<0.7"
joblib = "=1.0.*"
typing_inspect = "=0.6.*"

[tool.black]
# quiet = "True"
Expand Down
2 changes: 1 addition & 1 deletion src/facet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""


__version__ = "1.1.0"
__version__ = "1.2.0rc0"

__logo__ = (
r"""
Expand Down
23 changes: 13 additions & 10 deletions src/facet/data/partition/_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
import math
import operator as op
from abc import ABCMeta, abstractmethod
from typing import Any, Generic, Iterable, Optional, Sequence, Tuple, TypeVar

Expand Down Expand Up @@ -141,10 +142,10 @@ def __init__(
if (
lower_bound is not None
and upper_bound is not None
and lower_bound >= upper_bound
and lower_bound > upper_bound
):
raise ValueError(
f"arg lower_bound >= arg upper_bound: [{lower_bound}, {upper_bound})"
f"arg lower_bound > arg upper_bound: [{lower_bound}, {upper_bound})"
)

self._lower_bound = lower_bound
Expand Down Expand Up @@ -239,15 +240,17 @@ def fit(
lower_bound = self._lower_bound
upper_bound = self._upper_bound

if lower_bound is None:
lower_bound = np.nanquantile(values, q=0.025)
if lower_bound is None or upper_bound is None:
q3q1 = np.nanquantile(values, q=[0.75, 0.25])
inlier_range = op.sub(*q3q1) * 1.5 # iqr * 1.5

if upper_bound is None:
upper_bound = np.nanquantile(values, q=0.975)
if upper_bound < lower_bound:
upper_bound = lower_bound
elif upper_bound < lower_bound:
lower_bound = upper_bound
if lower_bound is None:
lower_bound = values[values >= q3q1[1] - inlier_range].min()

if upper_bound is None:
upper_bound = values[values <= q3q1[0] + inlier_range].max()

assert upper_bound >= lower_bound

# calculate the step count based on the maximum number of partitions,
# rounded to the next-largest rounded value ending in 1, 2, or 5
Expand Down
Loading

0 comments on commit 472daf9

Please sign in to comment.