Skip to content

Commit

Permalink
Merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
ItayGabbay committed Apr 12, 2022
2 parents 6b5ec9c + b8898ef commit 85ad712
Show file tree
Hide file tree
Showing 154 changed files with 2,652 additions and 938 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/update_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# ----------------------------------------------------------------------------
#

git describe --tags > VERSION
git describe --tags > deepchecks/VERSION
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
branches: [ main ]

env:
DEEPCHECKS_DISABLE_LATEST: "true"
DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY: "true"

jobs:
tests:
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
with:
requirements: 'requirements-all.txt'
fail: 'Copyleft,Other,Error'
exclude: '(pyzmq.*22\.3\.0|debugpy.*1\.6\.0|certifi.*2021\.10\.8|tqdm.*4\.63\.1|webencodings.*0\.5\.1|torch.*1\.10\.2.*|torchaudio.*0\.10\.2.*|torchvision.*0\.11\.3.*)'
exclude: '(pyzmq.*22\.3\.0|debugpy.*1\.6\.0|certifi.*2021\.10\.8|tqdm.*4\.64\.0|webencodings.*0\.5\.1|torch.*1\.10\.2.*|torchaudio.*0\.10\.2.*|torchvision.*0\.11\.3.*)'
# pyzmq is Revised BSD https://github.com/zeromq/pyzmq/blob/main/examples/LICENSE
# debugpy is MIT https://github.com/microsoft/debugpy/blob/main/LICENSE
# certifi is MPL-2.0 https://github.com/certifi/python-certifi/blob/master/LICENSE
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
workflow_dispatch:

env:
DEEPCHECKS_DISABLE_LATEST: "true"
DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY: "true"
WANDB_MODE: "offline"

jobs:
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install pandoc dvisvgm texlive
sudo apt-get install pandoc dvisvgm texlive texlive-latex-extra
- name: Build documentation
run: make docs

Expand Down Expand Up @@ -78,4 +78,4 @@ jobs:
token: ${{ secrets.DEEPCHECKS_CI_TOKEN }}

- name: Push documentation
run: deepchecks/.github/scripts/push_docs.sh
run: deepchecks/.github/scripts/push_docs.sh
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ on:
pull_request:
branches: [ main ]

env:
DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY: "true"

jobs:
pylint:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ name: Pull Request
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]

env:
DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY: "true"

jobs:
labels:
name: Validate Label
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

env:
DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY: "true"

jobs:
# Security-Check:
# runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .licenserc_fix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ header:
- '**/*.ipynb'
- '.pylintrc'
- 'LICENSE'
- 'VERSION'
- 'deepchecks/VERSION'
- 'deepchecks.egg-info/PKG-INFO'
- 'makefile'
- 'examples/'
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include requirements/vision-requirements.txt
include requirements/nlp-requirements.txt
include requirements/dev-requirements.txt
include LICENSE
include VERSION
include deepchecks/VERSION
include README.rst
include DESCRIPTION.rst
recursive-include deepchecks/core/resources *
48 changes: 35 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.. raw:: html

<h1 align="center">
Test Suites for Validating ML Models & Data
Testing and Validating ML Models & Data
</h1>

.. raw:: html
Expand All @@ -59,16 +59,35 @@ machine learning models and data with minimal effort. This includes
checks related to various types of issues, such as model performance,
data integrity, distribution mismatches, and more.


🖼️ Computer Vision & 🔢 Tabular Support
==========================================
**This README refers to the Tabular version** of deepchecks.

Check out the `Deepchecks for Computer Vision & Images subpackage <deepchecks/vision>`__ for more details about deepchecks for CV, currently in *beta release*.


💻 Installation
=================


Using pip
----------

.. code:: bash
pip install deepchecks -U --user
.. note::

To install deepchecks together with the **Computer Vision Submodule** that is currently in *beta release*, replace ``deepchecks`` with ``"deepchecks[vision]"`` as follows.

.. code:: bash
pip install "deepchecks[vision]" -U --user
Using conda
------------

Expand All @@ -83,7 +102,7 @@ Using conda
Head over to the `Quickstart Notebook <https://docs.deepchecks.com/en/stable/
examples/guides/quickstart_in_5_minutes.html?
utm_source=github.com&utm_medium=referral&utm_campaign=readme&utm_content=try_it_out>`__
and choose the |binder badge image| or the |colab badge image| to have it up and running, and to then apply it on your own data and models.
and see deepchecks output on a built-in dataset, or run it yourself to apply it on your own data and models.


📊 Usage Examples
Expand All @@ -98,7 +117,7 @@ Example for running a suite on given `datasets`_ and with a `supported model`_:

.. code:: python
from deepchecks.suites import full_suite
from deepchecks.tabular.suites import full_suite
suite = full_suite()
suite.run(train_dataset=train_dataset, test_dataset=test_dataset, model=model)
Expand Down Expand Up @@ -150,13 +169,13 @@ can be found in our `API Reference`_.

.. code:: python
from deepchecks.checks import TrainTestFeatureDrift
from deepchecks.tabular.checks import TrainTestFeatureDrift
import pandas as pd
train_df = pd.read_csv('train_data.csv')
test_df = pd.read_csv('test_data.csv')
# Initialize and run desired check
TrainTestFeatureDrift().run(train_data, test_data)
TrainTestFeatureDrift().run(train_df, test_df)
Will produce output of the type:

Expand Down Expand Up @@ -210,7 +229,7 @@ return value. An example for adding a condition would be:

.. code:: python
from deepchecks.checks import BoostingOverfit
from deepchecks.tabular.checks import BoostingOverfit
BoostingOverfit().add_condition_test_score_percent_decline_not_greater_than(threshold=0.05)
which will return a check failure when running it if there is a difference of
Expand Down Expand Up @@ -245,17 +264,19 @@ of checks and optional conditions.


What Do You Need in Order to Start Validating?
----------------------------------------------
==============================================

Environment
~~~~~~~~~~~~
-----------

- The deepchecks package installed

- JupyterLab or Jupyter Notebook


Data / Model
~~~~~~~~~~~~
------------


Depending on your phase and what you wish to validate, you'll need a
subset of the following:
Expand All @@ -269,14 +290,15 @@ subset of the following:

- A `supported model`_ (e.g. scikit-learn models, XGBoost, any model implementing the `predict` method in the required format)


Supported Data Types
~~~~~~~~~~~~~~~~~~~~
--------------------

The package currently supports tabular data and is in *beta release* for the computer vision submodule.

Currently the package supports tabular data.
Stay tuned for the upcoming Computer Vision release.

When Should I Run Deepchecks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----------------------------

Deepchecks validation accompanies you from the initial phase when you
have only raw data, through the data splits, and to the final stage of
Expand Down
File renamed without changes.
20 changes: 4 additions & 16 deletions deepchecks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import types
import os
import pathlib
import http.client
import matplotlib
import plotly.io as pio
import warnings
Expand Down Expand Up @@ -45,6 +44,7 @@
ModelComparisonSuite,
)

from deepchecks.analytics.anonymous_telemetry import send_anonymous_import_event

__all__ = [
# core
Expand Down Expand Up @@ -88,28 +88,16 @@

# Set version info
try:
MODULE_DIR = pathlib.Path(__file__).absolute().parent.parent
MODULE_DIR = pathlib.Path(__file__).absolute().parent
with open(os.path.join(MODULE_DIR, 'VERSION'), 'r', encoding='utf-8') as f:
__version__ = f.read().strip()
except: # pylint: disable=bare-except # noqa
# If version file can't be found, leave version empty
__version__ = ''


# Check for latest version
try:
disable = os.environ.get('DEEPCHECKS_DISABLE_LATEST', 'false').lower() == 'true'
if not disable:
conn = http.client.HTTPSConnection('api.deepchecks.com', timeout=3)
conn.request('GET', f'/v2/latest?version={__version__}')
response = conn.getresponse()
result = response.read().decode('utf-8') == 'True'
if not result:
warnings.warn('Looks like you are using outdated version of deepchecks. consider upgrading using'
' pip install -U deepchecks')
except: # pylint: disable=bare-except # noqa
pass

# Send an import event if not disabled
send_anonymous_import_event()

# ================================================================

Expand Down
15 changes: 15 additions & 0 deletions deepchecks/analytics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ----------------------------------------------------------------------------
# Copyright (C) 2021-2022 Deepchecks (https://www.deepchecks.com)
#
# This file is part of Deepchecks.
# Deepchecks is distributed under the terms of the GNU Affero General
# Public License (version 3 or later).
# You should have received a copy of the GNU Affero General Public License
# along with Deepchecks. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
#
"""
Module for anonymous telemetry.
No credentials, data, personal information or anything private is collected (and will never be).
"""
42 changes: 42 additions & 0 deletions deepchecks/analytics/anonymous_telemetry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ----------------------------------------------------------------------------
# Copyright (C) 2021-2022 Deepchecks (https://www.deepchecks.com)
#
# This file is part of Deepchecks.
# Deepchecks is distributed under the terms of the GNU Affero General
# Public License (version 3 or later).
# You should have received a copy of the GNU Affero General Public License
# along with Deepchecks. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
#
"""
Module for anonymous telemetry.
No credentials, data, personal information or anything private is collected (and will never be).
"""
import http.client
import os
import pathlib
import uuid
import deepchecks

MODULE_DIR = pathlib.Path(__file__).absolute().parent.parent
ANALYTICS_DISABLED = os.environ.get('DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY', False)


def send_anonymous_import_event():
"""Send an anonymous import event to PostHog."""
if not ANALYTICS_DISABLED:
try:
if os.path.exists(os.path.join(MODULE_DIR, '.user_id')):
with open(os.path.join(MODULE_DIR, '.user_id'), 'r', encoding='utf8') as f:
user_id = f.read()
else:
user_id = str(uuid.uuid4())
with open(os.path.join(MODULE_DIR, '.user_id'), 'w', encoding='utf8') as f:
f.write(user_id)

conn = http.client.HTTPSConnection('api.deepchecks.com', timeout=3)
conn.request('GET', f'/metrics?version={deepchecks.__version__}&uuid={user_id}')
_ = conn.getresponse()
except Exception: # pylint: disable=broad-except
pass

0 comments on commit 85ad712

Please sign in to comment.