Skip to content

Commit

Permalink
tabmat as tm, from_csc, renamed bench_glum.py (#448)
Browse files Browse the repository at this point in the history
* tabmat as tm, from_csc, renamed bench_glum.py

* changelog

* linting (mostly isort because of the new names)

* make mypy ignore tests and fix a benchmark mypy issue

* Remove remnant GCP stuff. Update documentation links.

* Remove deployment and docs actions and workflow steps.

* Required tabmat>=3.0.1

* Remove documentation build from CI.

* Remove old phrase mentioning conda channel.

Co-authored-by: Ben Thompson <t.ben.thompson@gmail.com>
  • Loading branch information
MarcAntoineSchmidtQC and tbenthompson committed Oct 8, 2021
1 parent 02e858d commit 9e1157d
Show file tree
Hide file tree
Showing 30 changed files with 90 additions and 298 deletions.
14 changes: 0 additions & 14 deletions .github/actions/deployment/action.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/actions/docs/action.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,10 @@ jobs:
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.head_ref }}
- uses: google-github-actions/setup-gcloud@v0.2.1
with:
version: '349.0.0'
project_id: ${{ secrets.GCP_UPLOAD_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_UPLOAD_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_UPLOAD_SA_KEY }}
export_default_credentials: true
- name: Run CI inside of container
uses: ./.github/actions/unittests
with:
python_version: ${{ matrix.PYTHON_VERSION }}
docs:
name: "Documentation"
runs-on: ubuntu-latest
env:
CI: True
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.9']
steps:
- name: Pull image
run: docker pull condaforge/mambaforge:latest
- name: Checkout branch
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.head_ref }}
- uses: google-github-actions/setup-gcloud@v0.2.1
with:
version: '349.0.0'
export_default_credentials: true
- name: Run CI inside of container
uses: ./.github/actions/docs
with:
python_version: ${{ matrix.PYTHON_VERSION }}
linux-conda-build:
name: "Linux - conda-build - Python ${{ matrix.CONDA_BUILD_YML }}"
runs-on: ubuntu-latest
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/docs.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/macos-tag.sh

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/tag.sh

This file was deleted.

101 changes: 0 additions & 101 deletions .github/workflows/tag.yml

This file was deleted.

1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ repos:
- --check-untyped-defs
- --ignore-missing-imports
- --namespace-packages
exclude: ^tests/
- repo: https://github.com/Quantco/pre-commit-mirrors-pyupgrade
rev: 2.7.2
hooks:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Unreleased
**Bug fix:**

- The :meth:`score` method of :class:`~glum.GeneralizedLinearRegressor` and :class:`~glum.GeneralizedLinearRegressorCV` now accepts data frames.
- Upgrading the code to use tabmat 3.0.0.

**Other:**

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributing

See the [contributing and development information in our documentation](https://docs.dev.***REMOVED***/***REMOVED***/Quantco/glum/latest/contributing.html).
See the [contributing and development information in our documentation](https://glum.readthedocs.io/en/latest/contributing.html).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![CI](https://github.com/Quantco/glm_benchmarks/workflows/CI/badge.svg)

[Documentation](https://docs.dev.***REMOVED***/***REMOVED***/Quantco/glum/latest/index.html)
[Documentation](https://glum.readthedocs.io/en/latest/)

Generalized linear models (GLM) are a core statistical tool that include many common methods like least-squares regression, Poisson regression and logistic regression as special cases. At QuantCo, we have used GLMs in e-commerce pricing, insurance claims prediction and more. We have developed `glum`, a fast Python-first GLM library. The development was based on [a fork of scikit-learn](https://github.com/scikit-learn/scikit-learn/pull/9405), so it has a scikit-learn-like API. We are thankful for the starting point provided by Christian Lorentzen in that PR!

Expand All @@ -19,7 +19,7 @@ This repo also includes tools for benchmarking GLM implementations in the `glum_

![](docs/_static/headline_benchmark.png)

For more information on `glum`, including tutorials and API reference, please see [the documentation](https://docs.dev.***REMOVED***/***REMOVED***/Quantco/glum/latest/index.html).
For more information on `glum`, including tutorials and API reference, please see [the documentation](https://glum.readthedocs.io/en/latest/).

# An example: predicting car insurance claim frequency using Poisson regression.

Expand Down
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ requirements:
- pandas
- scikit-learn >=0.23
- scipy
- tabmat >=1.0.0
- tabmat >=3.0.1

test:
requires:
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Pull request process
Releases
--------------------------------------------------

- We make package releases infrequently, but usually any time a new non-trivial feature is contributed or a bug is fixed. To make a release, just open a PR that updates the change log with the current date. Once that PR is approved and merged, you can create a new release on [GitHub](https://github.com/Quantco/glum/releases/new). Use the version from the change log as tag and copy the change log entry into the release description. New releases on GitHub are automatically deployed to the QuantCo conda channel.
- We make package releases infrequently, but usually any time a new non-trivial feature is contributed or a bug is fixed. To make a release, just open a PR that updates the change log with the current date. Once that PR is approved and merged, you can create a new release on [GitHub](https://github.com/Quantco/glum/releases/new). Use the version from the change log as tag and copy the change log entry into the release description.

Install for development
--------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ You can install the package through conda:

conda install glum -c conda-forge

Head onwards to :doc:`Getting Started<getting_started/getting_started>` to try it out!
Head onwards to :doc:`Getting Started<getting_started/getting_started>` to try it out!
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
"- `alpha_search=True`: tells the GLM to search along the regularization path for the best alpha\r\n",
"- `l1_ratio = 1` tells the GLM to only use l1 penalty (not l2). `l1_ratio` is the elastic net mixing parameter. For ``l1_ratio = 0``, the penalty is an L2 penalty. ``For l1_ratio = 1``, it is an L1 penalty. For ``0 < l1_ratio < 1``, the penalty is a combination of L1 and L2.\r\n",
"\r\n",
"See the `GeneralizedLinearRegressor` class [API documentation](https://docs.dev.***REMOVED***/***REMOVED***/Quantco/glum/latest/api/modules.html) for more details.\r\n",
"See the `GeneralizedLinearRegressor` class [API documentation](https://glum.readthedocs.io/en/latest/api/modules.html) for more details.\r\n",
"\r\n",
"*Note*: `glum` also supported a cross validation model GeneralizedLinearRegressorCV. However, because cross validation requires fitting many models, it is much slower and we don’t demonstrate it in this tutorial."
],
Expand Down Expand Up @@ -1305,4 +1305,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Now, we define our GLM using the `GeneralizedLinearRegressor` class from `glum`.
- `alpha_search=True`: tells the GLM to search along the regularization path for the best alpha
- `l1_ratio = 1` tells the GLM to only use l1 penalty (not l2). `l1_ratio` is the elastic net mixing parameter. For ``l1_ratio = 0``, the penalty is an L2 penalty. ``For l1_ratio = 1``, it is an L1 penalty. For ``0 < l1_ratio < 1``, the penalty is a combination of L1 and L2.

See the `GeneralizedLinearRegressor` class [API documentation](https://docs.dev.***REMOVED***/***REMOVED***/Quantco/glum/latest/api/modules.html) for more details.
See the `GeneralizedLinearRegressor` class [API documentation](https://glum.readthedocs.io/en/latest/api/modules.html) for more details.

*Note*: `glum` also supported a cross validation model GeneralizedLinearRegressorCV. However, because cross validation requires fitting many models, it is much slower and we don’t demonstrate it in this tutorial.

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- libblas>=0=*mkl
- numexpr
- pandas
- tabmat>=3.0.0
- tabmat>=3.0.1
- scikit-learn >= 0.23
- scipy
- tqdm
Expand Down
2 changes: 1 addition & 1 deletion src/glum/_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import numexpr
import numpy as np
from tabmat import MatrixBase, StandardizedMatrix
from scipy import sparse, special
from tabmat import MatrixBase, StandardizedMatrix

from ._functions import (
binomial_logit_eta_mu_deviance,
Expand Down

0 comments on commit 9e1157d

Please sign in to comment.