fiddler-client 2.3.0.dev2__py3-none-any.whl → 2.4.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fiddler/__init__.py +2 -0
- fiddler/_version.py +1 -1
- fiddler/api/alert_mixin.py +1 -1
- fiddler/api/api.py +2 -0
- fiddler/api/webhooks_mixin.py +9 -7
- fiddler/core_objects.py +98 -47
- fiddler/schemas/custom_features.py +25 -19
- fiddler3/constants/baseline.py +19 -0
- fiddler3/constants/common.py +12 -0
- fiddler3/constants/dataset.py +7 -0
- fiddler3/constants/model_deployment.py +15 -0
- fiddler3/constants/xai.py +11 -0
- fiddler3/entities/__init__.py +5 -1
- fiddler3/entities/base.py +22 -18
- fiddler3/entities/baseline.py +228 -0
- fiddler3/entities/dataset.py +149 -0
- fiddler3/entities/job.py +9 -8
- fiddler3/entities/model.py +160 -29
- fiddler3/entities/model_artifact.py +350 -0
- fiddler3/entities/model_deployment.py +112 -0
- fiddler3/entities/model_surrogate.py +92 -0
- fiddler3/entities/organization.py +38 -0
- fiddler3/entities/project.py +69 -8
- fiddler3/entities/user.py +45 -0
- fiddler3/entities/xai.py +309 -0
- fiddler3/libs/http_client.py +24 -13
- fiddler3/libs/json_encoder.py +12 -0
- fiddler3/schemas/__init__.py +4 -0
- fiddler3/schemas/baseline.py +37 -0
- fiddler3/schemas/custom_features.py +23 -18
- fiddler3/schemas/dataset.py +27 -0
- fiddler3/schemas/deployment_params.py +25 -0
- fiddler3/schemas/filter_query.py +54 -0
- fiddler3/schemas/job.py +2 -2
- fiddler3/schemas/model.py +9 -9
- fiddler3/schemas/model_artifact.py +6 -0
- fiddler3/schemas/model_deployment.py +26 -0
- fiddler3/schemas/organization.py +9 -1
- fiddler3/schemas/project.py +4 -4
- fiddler3/schemas/server_info.py +2 -2
- fiddler3/schemas/user.py +1 -1
- fiddler3/schemas/xai.py +32 -0
- fiddler3/tests/apis/test_baseline.py +292 -0
- fiddler3/tests/apis/test_dataset.py +173 -0
- fiddler3/tests/apis/test_mixin.py +77 -0
- fiddler3/tests/apis/test_model.py +102 -7
- fiddler3/tests/apis/test_model_artifact.py +175 -0
- fiddler3/tests/apis/test_model_deployment.py +98 -0
- fiddler3/tests/apis/test_model_surrogate.py +159 -0
- fiddler3/tests/apis/test_project.py +36 -20
- fiddler3/tests/apis/test_xai.py +690 -0
- fiddler3/tests/constants.py +10 -0
- fiddler3/tests/test_json_encoder.py +16 -0
- fiddler3/tests/test_logger.py +12 -0
- fiddler3/tests/test_utils.py +19 -0
- fiddler3/utils/__init__.py +1 -0
- fiddler3/utils/helpers.py +43 -0
- fiddler3/utils/logger.py +15 -0
- fiddler3/utils/validations.py +11 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/METADATA +7 -5
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/RECORD +65 -33
- tests/fiddler/test_segments.py +227 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/LICENSE.txt +0 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/WHEEL +0 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from uuid import UUID
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
import simplejson
|
|
5
|
+
|
|
6
|
+
from fiddler3.libs.json_encoder import RequestClientJSONEncoder
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_json_encoder_uuid():
|
|
10
|
+
data = {'uuid_field': UUID('ef3e24550e1846e0ae0e6672c3a0d5d9')}
|
|
11
|
+
with pytest.raises(TypeError):
|
|
12
|
+
simplejson.dumps(data)
|
|
13
|
+
|
|
14
|
+
assert simplejson.dumps(data, cls=RequestClientJSONEncoder) == simplejson.dumps(
|
|
15
|
+
{'uuid_field': 'ef3e24550e1846e0ae0e6672c3a0d5d9'}
|
|
16
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from fiddler3.constants.common import LOGGER_NAME
|
|
4
|
+
from fiddler3.utils.logger import set_logging
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_set_logging() -> None:
|
|
8
|
+
app_logger = logging.getLogger(LOGGER_NAME)
|
|
9
|
+
assert len(app_logger.handlers) == 0
|
|
10
|
+
|
|
11
|
+
set_logging(level=logging.ERROR)
|
|
12
|
+
assert len(app_logger.handlers) == 1
|
fiddler3/tests/test_utils.py
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
1
6
|
from fiddler3.schemas.server_info import Version
|
|
7
|
+
from fiddler3.utils.validations import validate_artifact_dir
|
|
2
8
|
from fiddler3.utils.version import match_semver
|
|
3
9
|
|
|
4
10
|
|
|
@@ -13,3 +19,16 @@ def test_match_semvar_version() -> None:
|
|
|
13
19
|
assert match_semver(Version.parse('22.10.0'), '<22.10.0') is False
|
|
14
20
|
assert match_semver(Version.parse('22.9.0'), '<22.10.0') is True
|
|
15
21
|
assert match_semver(Version.parse('22.11.0-RC1'), '>=22.11.0') is True
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_validate_artifact_dir(tmp_path) -> None:
|
|
25
|
+
artifact_dir = os.path.join(Path(__file__).resolve().parent, 'artifact_test_dir')
|
|
26
|
+
assert validate_artifact_dir(Path(artifact_dir)) is None
|
|
27
|
+
# Test for artifact_dir not valid directory
|
|
28
|
+
with pytest.raises(ValueError):
|
|
29
|
+
validate_artifact_dir(Path('test'))
|
|
30
|
+
# Test for package.py file not found
|
|
31
|
+
mock_dir = tmp_path / 'test'
|
|
32
|
+
mock_dir.mkdir()
|
|
33
|
+
with pytest.raises(ValueError):
|
|
34
|
+
validate_artifact_dir(Path(mock_dir))
|
fiddler3/utils/__init__.py
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from fiddler3.utils.logger import set_logging # noqa
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
from fiddler3.constants.common import TIMESTAMP_FORMAT
|
|
8
|
+
from fiddler3.constants.model import DataType
|
|
9
|
+
from fiddler3.utils.logger import get_logger
|
|
10
|
+
|
|
11
|
+
logger = get_logger(__name__)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def try_series_retype(series: pd.Series, new_type: str) -> pd.DataFrame | pd.Series:
|
|
15
|
+
"""Retype series."""
|
|
16
|
+
if new_type in ['unknown', 'str']:
|
|
17
|
+
# Do not retype data
|
|
18
|
+
return series
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
return series.astype(new_type)
|
|
22
|
+
except (TypeError, ValueError) as e:
|
|
23
|
+
if new_type == 'int':
|
|
24
|
+
logger.warning(
|
|
25
|
+
'"%s" cannot be loaded as int '
|
|
26
|
+
'(likely because it contains missing values, and '
|
|
27
|
+
'Pandas does not support NaN for ints). Loading '
|
|
28
|
+
'as float instead.',
|
|
29
|
+
series.name,
|
|
30
|
+
)
|
|
31
|
+
return series.astype('float')
|
|
32
|
+
if new_type.lower() == DataType.TIMESTAMP.value:
|
|
33
|
+
try:
|
|
34
|
+
return series.apply(lambda x: datetime.strptime(x, TIMESTAMP_FORMAT))
|
|
35
|
+
# if timestamp str doesn't contain millisec.
|
|
36
|
+
except ValueError:
|
|
37
|
+
# @TODO: Should such cases be
|
|
38
|
+
# 1. handled by client OR
|
|
39
|
+
# 2. should server apped 00 ms if not present during ingestion OR
|
|
40
|
+
# 3. should it break if timestamp format does not match while ingestion?
|
|
41
|
+
return series.apply(lambda x: datetime.strptime(x, '%Y-%m-%d %H:%M:%S'))
|
|
42
|
+
else:
|
|
43
|
+
raise e
|
fiddler3/utils/logger.py
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import sys
|
|
2
3
|
from logging import Logger
|
|
3
4
|
|
|
5
|
+
from fiddler3.constants.common import LOG_FORMAT, LOGGER_NAME
|
|
6
|
+
|
|
4
7
|
|
|
5
8
|
def get_logger(name: str) -> Logger:
|
|
9
|
+
"""Get logger instance"""
|
|
6
10
|
logger: Logger = logging.getLogger(name)
|
|
7
11
|
logger.addHandler(logging.NullHandler())
|
|
8
12
|
return logger
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def set_logging(level: int = logging.INFO) -> None:
|
|
16
|
+
"""Set app logger at given log level"""
|
|
17
|
+
app_logger = logging.getLogger(LOGGER_NAME)
|
|
18
|
+
handler = logging.StreamHandler(stream=sys.stdout)
|
|
19
|
+
formatter = logging.Formatter(LOG_FORMAT)
|
|
20
|
+
handler.setFormatter(formatter)
|
|
21
|
+
handler.setLevel(level)
|
|
22
|
+
app_logger.addHandler(handler)
|
|
23
|
+
app_logger.setLevel(level)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def validate_artifact_dir(artifact_dir: Path) -> None:
|
|
5
|
+
"""Check if artifact directory exists."""
|
|
6
|
+
if not artifact_dir.is_dir():
|
|
7
|
+
raise ValueError(f'{artifact_dir} is not a valid model directory')
|
|
8
|
+
|
|
9
|
+
package_file_path = artifact_dir / 'package.py'
|
|
10
|
+
if not package_file_path.is_file():
|
|
11
|
+
raise ValueError(f'package.py file not found at {package_file_path}')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fiddler-client
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0.dev1
|
|
4
4
|
Summary: Python client for Fiddler Service
|
|
5
5
|
Home-page: https://fiddler.ai
|
|
6
6
|
Author: Fiddler Labs
|
|
@@ -42,6 +42,10 @@ Documentation for the API can be found [here](https://docs.fiddler.ai/reference/
|
|
|
42
42
|
|
|
43
43
|
Version History
|
|
44
44
|
-------------
|
|
45
|
+
### 2.4.0
|
|
46
|
+
- #### **New Features**
|
|
47
|
+
- Support for enrichments
|
|
48
|
+
|
|
45
49
|
### 2.3.0
|
|
46
50
|
- #### **New Features**
|
|
47
51
|
- Added support for creating alerts on the `Frequency` metric.
|
|
@@ -53,10 +57,8 @@ Version History
|
|
|
53
57
|
- Relax pydantic version to allow any version between 1.9 and 2
|
|
54
58
|
|
|
55
59
|
### 2.2.0
|
|
56
|
-
- #### **
|
|
57
|
-
-
|
|
58
|
-
- `fql` is renamed to `definition` in add_custom_metric()
|
|
59
|
-
- A new get_custom_metric() function to get details about a single custom metric.
|
|
60
|
+
- #### **New Features**
|
|
61
|
+
- Support segments
|
|
60
62
|
|
|
61
63
|
### 2.1.2
|
|
62
64
|
- #### **Modifications**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fiddler/__init__.py,sha256=
|
|
2
|
-
fiddler/_version.py,sha256=
|
|
1
|
+
fiddler/__init__.py,sha256=D3soQu7i4pVdlmtuJDjlSwil0jSfusWl9DbpD33oo3k,2018
|
|
2
|
+
fiddler/_version.py,sha256=fVX_KNqblELev-oF0H2yXxy876aUST0Z4w2CHTgkaHk,27
|
|
3
3
|
fiddler/constants.py,sha256=kXJX771B9UoQKh-umPnPfDXGeCRdC8TmTAi40hSK0Cs,1886
|
|
4
|
-
fiddler/core_objects.py,sha256=
|
|
4
|
+
fiddler/core_objects.py,sha256=7xSBaYF0F24c0xBJ9e9kjgKEf2Qbv0xViG1Z1OSTg_g,116420
|
|
5
5
|
fiddler/exceptions.py,sha256=uC7EhNRmlndYxPvlyHOKQUNTRpe-J8HNulytU_NLmn0,2585
|
|
6
6
|
fiddler/api/__init__.py,sha256=Na9WlUxg8FmKHBzzVJ-CzlYNm7-LClVH5f313SqJx4A,108
|
|
7
|
-
fiddler/api/alert_mixin.py,sha256=
|
|
8
|
-
fiddler/api/api.py,sha256=
|
|
7
|
+
fiddler/api/alert_mixin.py,sha256=t5Ab3p6ByMPDl0RXcN4lKQN8Iti45TJgND4gW1zbm8E,20118
|
|
8
|
+
fiddler/api/api.py,sha256=cdIjG-VZeax-HOPEo8VV08plAkWD-35zxnu3vO_NWIg,3487
|
|
9
9
|
fiddler/api/baseline_mixin.py,sha256=juSezFwyXk8KJMoF-HXeE1WkhlUG7FVehaVS-t1zFC4,7452
|
|
10
10
|
fiddler/api/custom_metrics_mixin.py,sha256=7fpZx_4jSzhELbU1TYyvgDqP8NUMg62NWqlgRwKjkDQ,3459
|
|
11
11
|
fiddler/api/dataset_mixin.py,sha256=c21GDwMk1FiI-IanamCfIxWMABAI-KCZpBs8n7SLy8g,15335
|
|
@@ -18,7 +18,7 @@ fiddler/api/model_deployment_mixin.py,sha256=vzbckdEbEPWVssPA9xsLIS_iUF3a5sEbBCH
|
|
|
18
18
|
fiddler/api/model_mixin.py,sha256=VWf785tKaQHtpicpkoaVv8SZm-hD_nAC9Zb-d5uvUx4,17350
|
|
19
19
|
fiddler/api/project_mixin.py,sha256=14GN7EP53_8qBBnAx27PuHL-ZmCGofU__kjygl6bIMQ,3206
|
|
20
20
|
fiddler/api/segments_mixin.py,sha256=hwsn0cSlXZ4i9MG0Kg_BNlb4-SchqQZM0rDx0zcismw,3396
|
|
21
|
-
fiddler/api/webhooks_mixin.py,sha256=
|
|
21
|
+
fiddler/api/webhooks_mixin.py,sha256=riSbnBCi1A2qQZ-lmDbHBxvAPp1EPslR3oW5r3J-a9Y,3854
|
|
22
22
|
fiddler/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
fiddler/assets/pg_reserved_words.py,sha256=Z4iNATcECfA4qB5GRJppCIvW7XKtGCwZ6qvPC1AB7Gs,8201
|
|
24
24
|
fiddler/libs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -44,7 +44,7 @@ fiddler/schema/server_info.py,sha256=33tY0ohiSJJNpoeyanUCNZy-sexQwoLRdr2XQrUmNEE
|
|
|
44
44
|
fiddler/schema/user.py,sha256=8p4r2ZMqPEggggd10l62w_7A5KsRr6Se5QP-xfrEtks,109
|
|
45
45
|
fiddler/schema/webhook.py,sha256=zDYGEgsAYd8NYMDhVOpK74t7dC6VieAvHmSoeadS_Ks,219
|
|
46
46
|
fiddler/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
-
fiddler/schemas/custom_features.py,sha256=
|
|
47
|
+
fiddler/schemas/custom_features.py,sha256=OAGQMNxob0JxtvjV4vw5zoLnfU8r6IpxXg0_8l50jSs,3578
|
|
48
48
|
fiddler/utils/__init__.py,sha256=DEH6Z0Y4sawrzgpCHYuHfeGfYihxxjDC_z5ZhpICHjg,4622
|
|
49
49
|
fiddler/utils/decorators.py,sha256=jp7oGBgcWpcxfs5O36zHR-urJdtqjLo4hA-5XxR8fIs,3681
|
|
50
50
|
fiddler/utils/formatting.py,sha256=vXldw_Qtcvk22Yv4c2FkROHrkniWNog55dG1DoaIs4Q,1379
|
|
@@ -65,46 +65,77 @@ fiddler3/decorators.py,sha256=JH4LPeygR4sPUt-xbsM1ZQ3vPF53iYwREZCWQ6Bmjpo,1823
|
|
|
65
65
|
fiddler3/exceptions.py,sha256=7o0Xjx6McNMFxvysGMmp7NcXV2iGSM2VCt2h7OXDB0M,2172
|
|
66
66
|
fiddler3/version.py,sha256=WZxVB-2_454JxgdmIIsxG-DUc65ia-VgtyjcgvV4mro,22
|
|
67
67
|
fiddler3/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
-
fiddler3/constants/
|
|
68
|
+
fiddler3/constants/baseline.py,sha256=NhmiGf73gy2IHKKpbm64HCE4eJfbxkAPy3uk_Z-6qSo,321
|
|
69
|
+
fiddler3/constants/common.py,sha256=Ls5VSDNC0hYFqtsKf0RbzsRQ8bYXiSIUM14vm6g3KVU,611
|
|
70
|
+
fiddler3/constants/dataset.py,sha256=ZxPmzycSlrKpUYShpfTDqfmz8LAebzyBtIV_dBy-pRI,126
|
|
69
71
|
fiddler3/constants/job.py,sha256=tMT0vr3x3IiCTQcifP2s1-VWC5gskflKexfU_VfDIzA,233
|
|
70
72
|
fiddler3/constants/model.py,sha256=t8zINOAHVHAXQAE-i7Yg3vbpNi4Pu9uKZxnHNH3HGTA,1456
|
|
71
|
-
fiddler3/
|
|
72
|
-
fiddler3/
|
|
73
|
+
fiddler3/constants/model_deployment.py,sha256=SfagLKVD7tK1QmYQFJLDrA4-6FaSeNF6tikP8pH2RTk,278
|
|
74
|
+
fiddler3/constants/xai.py,sha256=GR8VguB6FTfMJZ291FIbfDsY4S9BGOft3VxNW5jMf90,214
|
|
75
|
+
fiddler3/entities/__init__.py,sha256=ncuKKvYmb6Er8lIBFmLZsjGZoRrYGTngUvW_XBUuayw,366
|
|
76
|
+
fiddler3/entities/base.py,sha256=QG6cxJNkiBlB86rbamoS6CcRiN1iB9QczGeaPsMgmaw,2522
|
|
77
|
+
fiddler3/entities/baseline.py,sha256=lVIea8G5Md61KLewKyrTO9oPZSRpywX_VRSwbfPrkJU,7247
|
|
78
|
+
fiddler3/entities/dataset.py,sha256=DKn6uo-6GxWhADas9iI3sLeBtDHM5yvyO7drAiQy-d0,4721
|
|
73
79
|
fiddler3/entities/helpers.py,sha256=4BlxOsHlCZIeZEqErPxS4NznEOuVgZwxisNdfgE9-zE,581
|
|
74
|
-
fiddler3/entities/job.py,sha256=
|
|
75
|
-
fiddler3/entities/model.py,sha256=
|
|
76
|
-
fiddler3/entities/
|
|
80
|
+
fiddler3/entities/job.py,sha256=vObT1vdjcc76gOTzFVj6rn-rn6g4e_BRVJNeHTWejg8,4564
|
|
81
|
+
fiddler3/entities/model.py,sha256=4SisJSNGopUS43uRDez9x2VcVv47_eLNMvp7yYIoWH8,10927
|
|
82
|
+
fiddler3/entities/model_artifact.py,sha256=7nWPm5b86E-h8cSNowr7gqopubvAzqwMc4rA4ijD4ig,11028
|
|
83
|
+
fiddler3/entities/model_deployment.py,sha256=g-xXbxdQ99HLpNCHoSuvqk5F4DmDMB7d8HhaW9svbTI,3432
|
|
84
|
+
fiddler3/entities/model_surrogate.py,sha256=IC_JVMMFX-_yGkcvupQg_VAgIoIBhvhO0doHcQg7MD4,2708
|
|
85
|
+
fiddler3/entities/organization.py,sha256=96C-L_GNh0RnwAhqVV2CQuxYK3r61j8OCEOPEE6U8dE,1076
|
|
86
|
+
fiddler3/entities/project.py,sha256=8JR10ghL0KGNBe50APrD24veqIStWp_PwgIARpPx8SY,4578
|
|
87
|
+
fiddler3/entities/user.py,sha256=ev_Xx9QHAdEHYzNDafzQihXOcD8ME5XkpKgc8MiqCnw,1243
|
|
88
|
+
fiddler3/entities/xai.py,sha256=I2tH8XwoblLZd60Ba-8qEMjZMVctYRVJzIrcbc1iWYM,10885
|
|
77
89
|
fiddler3/libs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
78
|
-
fiddler3/libs/http_client.py,sha256=
|
|
90
|
+
fiddler3/libs/http_client.py,sha256=vIJZqdRnGc4WC4PdAlT-gsiMagJWPbgTrGq5sG64eSA,7088
|
|
91
|
+
fiddler3/libs/json_encoder.py,sha256=_D-SKgkyo2DtgM8z8wCd9QSB7VwwFt0KDz-9og9pwSI,330
|
|
79
92
|
fiddler3/libs/semver.py,sha256=3HbXG1S-ABIxL3E0FHSm5OR_YrhYtCB2Q3XJ8-tywts,15995
|
|
80
|
-
fiddler3/schemas/__init__.py,sha256=
|
|
93
|
+
fiddler3/schemas/__init__.py,sha256=3X8Is87FXJb2SEeRM2WmeujoIXbo0iTYxGbU1Gi3gHw,502
|
|
81
94
|
fiddler3/schemas/base.py,sha256=upzAmneEz169h_w-UDH_tY0Abo7DeK68YOZ5qVwIMa8,189
|
|
82
|
-
fiddler3/schemas/
|
|
83
|
-
fiddler3/schemas/
|
|
84
|
-
fiddler3/schemas/
|
|
95
|
+
fiddler3/schemas/baseline.py,sha256=pBnt8J-PBZ4ejEoX5lQDGRLE1a3YQtxGBFwgTPxHkQs,928
|
|
96
|
+
fiddler3/schemas/custom_features.py,sha256=xH5t-Ozkley-bDX08xuMiA0zA0SWWtzGnpECeLM30XM,3542
|
|
97
|
+
fiddler3/schemas/dataset.py,sha256=AXN416sL2S-LlF6VXiJmlO7UXrGOn_X_XHArdErieGE,662
|
|
98
|
+
fiddler3/schemas/deployment_params.py,sha256=XrVCvMfj3Uwd0RFG8exBEvu7rvSI2ifAGBlfPIyjUCU,547
|
|
99
|
+
fiddler3/schemas/filter_query.py,sha256=yInG5FJ88NlPXy8GXQj_Bd7ta_C1n54pdHFdQedpTco,1326
|
|
100
|
+
fiddler3/schemas/job.py,sha256=plqly2vU8mzwwdDcLdcUd3LPBwldIw9VkgbSTcFNXRM,340
|
|
101
|
+
fiddler3/schemas/model.py,sha256=_ec6PDcl8Lonthq6d6e4CaUfxEm9kk-EwARA81ksrHI,1423
|
|
102
|
+
fiddler3/schemas/model_artifact.py,sha256=d2axtyOQq6x0rJGWeCgMn8wcAQ-e2tVw9nLQRdN9YD4,138
|
|
103
|
+
fiddler3/schemas/model_deployment.py,sha256=PnHSmuISLiIl1cNxTWsjOK3pWnIXexcu0dnsFZqs9w8,725
|
|
85
104
|
fiddler3/schemas/model_schema.py,sha256=QtZ5XwL4LC9g2Ia2gpJsimyP-Jq5yemvySym8D3-7yk,1128
|
|
86
105
|
fiddler3/schemas/model_spec.py,sha256=3F1VWVP1NV_i7Kz7Am7so1zLesWFwp9t4vWq_hCZOJw,643
|
|
87
106
|
fiddler3/schemas/model_task_params.py,sha256=zFkTVa2IOdWMgxePH1sWUYWV6uJFqLkR_JrSnoH8eJI,692
|
|
88
|
-
fiddler3/schemas/organization.py,sha256=
|
|
89
|
-
fiddler3/schemas/project.py,sha256=
|
|
107
|
+
fiddler3/schemas/organization.py,sha256=a7Byp1MWa5tldyyztVd4QFBW1Bx0oAXyENptDG0Haos,282
|
|
108
|
+
fiddler3/schemas/project.py,sha256=DJd2YRyolEBCrdKwAKWBJwtdPsQh3MOHppn5CG4wiNU,381
|
|
90
109
|
fiddler3/schemas/response.py,sha256=jWuUAJXm40UE3i_ZCmfVUXdKY5WLVkrL6G5XLS17KnU,1167
|
|
91
|
-
fiddler3/schemas/server_info.py,sha256=
|
|
92
|
-
fiddler3/schemas/user.py,sha256=
|
|
110
|
+
fiddler3/schemas/server_info.py,sha256=e_uoHVIPJ4tTBTVKNbm3wKoF3mXOfv2HF1MSF9zpgEw,503
|
|
111
|
+
fiddler3/schemas/user.py,sha256=XuUkmXYM2PNOnau5RdYXLb3AfQoI1e7fDorzT2dTLtw,137
|
|
112
|
+
fiddler3/schemas/xai.py,sha256=DnQkICrCJZM6YFTB6z0pa-Rb81VWLbzrYdqWhQ5cp5I,741
|
|
93
113
|
fiddler3/schemas/xai_params.py,sha256=7WbUCBojzZckjOA2NUxnk5y3M2WKKXclSzkt5HBfyUU,313
|
|
94
114
|
fiddler3/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
95
115
|
fiddler3/tests/conftest.py,sha256=8NI-g3flCXyEzMBoVthUpYu4aVC4g6UPb-Jm9w0Bdbo,837
|
|
96
|
-
fiddler3/tests/constants.py,sha256=
|
|
116
|
+
fiddler3/tests/constants.py,sha256=t-HFx7u_8uwdtf7mQShRHu1Ns4U1k8LzTZH4CagznP4,867
|
|
97
117
|
fiddler3/tests/test_connection.py,sha256=QQJ2SDtKKvdPd6du5XDXLwWSNgE9wZs1IR3IU60s7BY,1198
|
|
98
|
-
fiddler3/tests/
|
|
118
|
+
fiddler3/tests/test_json_encoder.py,sha256=DnuyDTBKTq-dYZhY9KWN1OHywCukpBHq1PDBo6koR8E,437
|
|
119
|
+
fiddler3/tests/test_logger.py,sha256=baSk0xtm8JNz0O83A714IR5uO36v_JoKPgDyknr_X4Q,314
|
|
120
|
+
fiddler3/tests/test_utils.py,sha256=Frzk5wftz_MWWhT9rvwOca1vvI4rllsjBA8E1jQ_gOE,1447
|
|
99
121
|
fiddler3/tests/utils.py,sha256=FEDbASW4pYZktdEK2FLnIDyZCwBzpb60m6EzkvOkwSc,335
|
|
100
122
|
fiddler3/tests/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
+
fiddler3/tests/apis/test_baseline.py,sha256=dWvcJ1TPvBjtb7RQwe3LXI72Cs1yb6Zx-PTMixl5l0g,7584
|
|
124
|
+
fiddler3/tests/apis/test_dataset.py,sha256=ub000_6wIOCVcofg7y125p1n4abaiPEO-iP7OvpeLyY,4768
|
|
101
125
|
fiddler3/tests/apis/test_generate_schema.py,sha256=51Xux_Txb2Ica1AKX9794K5LNJ1y569rggbgfWhZLDI,3720
|
|
102
126
|
fiddler3/tests/apis/test_job.py,sha256=4WsB6WoVL4bbK_RgP4e9Wc_DhSF4fCXoFK7wx6mOHQ0,1894
|
|
103
|
-
fiddler3/tests/apis/
|
|
104
|
-
fiddler3/tests/apis/
|
|
105
|
-
fiddler3/
|
|
106
|
-
fiddler3/
|
|
127
|
+
fiddler3/tests/apis/test_mixin.py,sha256=-uoeP2v0WMmOpsBoupNCw_BIFRWH1nkSzg4POKNB_J4,2465
|
|
128
|
+
fiddler3/tests/apis/test_model.py,sha256=4z9P951bmuZo8yuD7Vb0bRbOV-stXFyT43N3GX81Asc,12183
|
|
129
|
+
fiddler3/tests/apis/test_model_artifact.py,sha256=piBWhXyVRmN3aYGvUaxkN5jT4dlBwPRm5_LunTq94fc,4997
|
|
130
|
+
fiddler3/tests/apis/test_model_deployment.py,sha256=QLMuNiC9efujd67zQMuDHvF365Jx3NYaYediv4AXftA,2444
|
|
131
|
+
fiddler3/tests/apis/test_model_surrogate.py,sha256=ErFuILpnpQRytteWla4WcqzzOEwH9qrOANm_4-nrWts,4124
|
|
132
|
+
fiddler3/tests/apis/test_project.py,sha256=imhGUyi2hVvMJ4LaRpAoQS8R-fahgD3xboQjjYUvnA0,5987
|
|
133
|
+
fiddler3/tests/apis/test_xai.py,sha256=AxeEZ59opoZHy-4vxVqBoUN3rORIFL-zM-196j7nDUg,21647
|
|
134
|
+
fiddler3/utils/__init__.py,sha256=dq4jUfZTE-0G8P4uYVi2z8oSYG73utqikAy2hPXjBDk,54
|
|
135
|
+
fiddler3/utils/helpers.py,sha256=iFmEQfoebXkSA-mfqh8xlB7-TlBDTOPBPfmP1DhzGgQ,1548
|
|
136
|
+
fiddler3/utils/logger.py,sha256=yyhgUgEKcuyI8bJxyaJSrONxNE9kx6b7n36hya9SbnQ,670
|
|
107
137
|
fiddler3/utils/model_schema_generator.py,sha256=KMBYu24vxIdrrOeYgfu6Wz6awF2le2iUawE2LyGmxqs,8667
|
|
138
|
+
fiddler3/utils/validations.py,sha256=i8NtgrpCsitq6BPa5lygpKDh07oaOXu7PAlCIcMvqzY,408
|
|
108
139
|
fiddler3/utils/version.py,sha256=kCJN8PxmX0_NG2yGtQHyavAyhO6lCt5irCJxkIpLLBk,532
|
|
109
140
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
110
141
|
tests/test_object_inference.py,sha256=Mj9AOHuU7MCag1fXFj87_d-qFnE4gESx_l1QC7rS00A,5346
|
|
@@ -128,6 +159,7 @@ tests/fiddler/test_job.py,sha256=8YGGoJgYL9yJzlT5_YPsf-w_FBasS6EaKH7UY29wn8k,460
|
|
|
128
159
|
tests/fiddler/test_model.py,sha256=H70vytupFmKSXBjrf_I32VKDfWyLTbO_IhRVe_8O7Cw,7507
|
|
129
160
|
tests/fiddler/test_project.py,sha256=xn_5p85bGNOz6Dh9Y8yP9ZYElHGRcsCniMLVF8B-HGk,6603
|
|
130
161
|
tests/fiddler/test_response_handler.py,sha256=YWhd8QIJrW3nUag-nZ4jutAs1B9eOqQekgUN1vtsbU0,2958
|
|
162
|
+
tests/fiddler/test_segments.py,sha256=XJZJ96SiSdmMZTOKPeeKKTnOkuC_uQDMw2AmG6Or-jI,7984
|
|
131
163
|
tests/fiddler/test_upload_dataset.py,sha256=p7JzcGQkA0jT78S5gKUwtyjbpVDh7xYQg-74SVYp-6s,15299
|
|
132
164
|
tests/fiddler/test_validations.py,sha256=1FUlfXzf1L-DrSth12u4MUBHGGgGAXDCn-x2TS79Y10,581
|
|
133
165
|
tests/fiddler/test_webhook.py,sha256=RKManG4Q1DfsFPURIK_EcOFvF0L7LupXYBER8oX9ly4,4416
|
|
@@ -135,8 +167,8 @@ tests/fiddler/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
135
167
|
tests/fiddler/utils/test_general_checks.py,sha256=kxG8n4UdBWXBGchA0SvV7o4t28a7YAc8viorEBpzzcE,1451
|
|
136
168
|
tests/fiddler/utils/test_pandas.py,sha256=7VBh8yJZMVE1bSaUYH0T_qwXpcwXgJ5rI1nL3vGRwjY,8781
|
|
137
169
|
tests/fiddler/utils/tests_utils.py,sha256=kPmMoOlaSIWw6Gk7QnAnn8QJvEyqtd2Rz32kS6RGEc8,1800
|
|
138
|
-
fiddler_client-2.
|
|
139
|
-
fiddler_client-2.
|
|
140
|
-
fiddler_client-2.
|
|
141
|
-
fiddler_client-2.
|
|
142
|
-
fiddler_client-2.
|
|
170
|
+
fiddler_client-2.4.0.dev1.dist-info/LICENSE.txt,sha256=w8-LUAb_VLBWSsCNmih0pAqLIicJfGu8OJXpDjkIg_o,559
|
|
171
|
+
fiddler_client-2.4.0.dev1.dist-info/METADATA,sha256=xkmy9cto8DUv4rfiZGgTYfEZoIyu9crjdD2-uRvArgU,20071
|
|
172
|
+
fiddler_client-2.4.0.dev1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
173
|
+
fiddler_client-2.4.0.dev1.dist-info/top_level.txt,sha256=d227cAlPARL7zNFhltLEb5Q-04mfc1CJM5-TBDZShlQ,23
|
|
174
|
+
fiddler_client-2.4.0.dev1.dist-info/RECORD,,
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
from responses import matchers
|
|
2
|
+
from fiddler.schema.segment import Segment
|
|
3
|
+
from fiddler.exceptions import BadRequest
|
|
4
|
+
from tests.fiddler.base import BaseTestCase
|
|
5
|
+
from http import HTTPStatus
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestSegment(BaseTestCase):
|
|
9
|
+
|
|
10
|
+
def _get_url(self, uuid: str = None) -> str:
|
|
11
|
+
base_url = f'{self._url}/segments'
|
|
12
|
+
if uuid:
|
|
13
|
+
return f'{base_url}/{uuid}'
|
|
14
|
+
return base_url
|
|
15
|
+
|
|
16
|
+
def test_get_segments(self):
|
|
17
|
+
response = {
|
|
18
|
+
"data": {
|
|
19
|
+
"page_size": 50,
|
|
20
|
+
"total": 2,
|
|
21
|
+
"item_count": 2,
|
|
22
|
+
"page_count": 1,
|
|
23
|
+
"page_index": 1,
|
|
24
|
+
"offset": 0,
|
|
25
|
+
"items": [
|
|
26
|
+
{
|
|
27
|
+
"project_name": "bank_churn",
|
|
28
|
+
"name": "tp_0.8",
|
|
29
|
+
"model_name": "churn_classifier",
|
|
30
|
+
"definition": "age > 10",
|
|
31
|
+
"id": "fbba0596-1d49-4159-a5ea-e1c2f57c9c32",
|
|
32
|
+
"organization_name": "test_organization",
|
|
33
|
+
"description": "test description",
|
|
34
|
+
"extra_field_from_future": "should_not_break",
|
|
35
|
+
"created_at": "2021-03-03T18:30:00.000Z",
|
|
36
|
+
"created_by": {
|
|
37
|
+
"id": "1",
|
|
38
|
+
"full_name": "test user",
|
|
39
|
+
"email": "testuser@fiddler.ai"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"project_name": "bank_churn",
|
|
44
|
+
"name": "tp_0.6",
|
|
45
|
+
"model_name": "churn_classifier",
|
|
46
|
+
"definition": "credit_score > 600",
|
|
47
|
+
"id": "3a352397-a89a-495d-a095-440f1d21a58a",
|
|
48
|
+
"organization_name": "test_organization",
|
|
49
|
+
"description": "test description",
|
|
50
|
+
"created_at": "2021-03-03T18:30:00.000Z",
|
|
51
|
+
"created_by": {
|
|
52
|
+
"id": "2",
|
|
53
|
+
"full_name": "test user",
|
|
54
|
+
"email": "testuser@fiddler.ai"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"api_version": "2.0",
|
|
60
|
+
"kind": "PAGINATED"
|
|
61
|
+
}
|
|
62
|
+
url = self._get_url()
|
|
63
|
+
query_params = {
|
|
64
|
+
'limit': 300,
|
|
65
|
+
'offset': 0,
|
|
66
|
+
'organization_name': 'test_organization',
|
|
67
|
+
'project_name': 'bank_churn',
|
|
68
|
+
'model_name': 'churn_classifier',
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
self.requests_mock.get(
|
|
72
|
+
url, json=response, match=[matchers.query_param_matcher(query_params)]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
segments = self.client.get_segments(
|
|
76
|
+
project_id='bank_churn',
|
|
77
|
+
model_id='churn_classifier',
|
|
78
|
+
)
|
|
79
|
+
assert segments == [
|
|
80
|
+
Segment(
|
|
81
|
+
id='fbba0596-1d49-4159-a5ea-e1c2f57c9c32',
|
|
82
|
+
name='tp_0.8',
|
|
83
|
+
definition='age > 10',
|
|
84
|
+
organization_name='test_organization',
|
|
85
|
+
project_name='bank_churn',
|
|
86
|
+
model_name='churn_classifier',
|
|
87
|
+
description='test description',
|
|
88
|
+
created_at='2021-03-03T18:30:00.000Z',
|
|
89
|
+
created_by={
|
|
90
|
+
"id": "1",
|
|
91
|
+
"full_name": "test user",
|
|
92
|
+
"email": "testuser@fiddler.ai"
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
Segment(
|
|
96
|
+
id='3a352397-a89a-495d-a095-440f1d21a58a',
|
|
97
|
+
name='tp_0.6',
|
|
98
|
+
definition='credit_score > 600',
|
|
99
|
+
organization_name='test_organization',
|
|
100
|
+
project_name='bank_churn',
|
|
101
|
+
model_name='churn_classifier',
|
|
102
|
+
description='test description',
|
|
103
|
+
created_at='2021-03-03T18:30:00.000Z',
|
|
104
|
+
created_by={
|
|
105
|
+
"id": "2",
|
|
106
|
+
"full_name": "test user",
|
|
107
|
+
"email": "testuser@fiddler.ai"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
def test_add_segment(self):
|
|
113
|
+
response_body = {
|
|
114
|
+
'data': {
|
|
115
|
+
'id': 'fbba0596-1d49-4159-a5ea-e1c2f57c9c32',
|
|
116
|
+
},
|
|
117
|
+
'api_version': '2.0',
|
|
118
|
+
'kind': 'NORMAL',
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
url = self._get_url()
|
|
122
|
+
|
|
123
|
+
self.requests_mock.post(url, json=response_body)
|
|
124
|
+
|
|
125
|
+
segment = self.client.add_segment(
|
|
126
|
+
name='my segment',
|
|
127
|
+
definition='age > 10',
|
|
128
|
+
project_id='bank_churn',
|
|
129
|
+
model_id='churn_classifier',
|
|
130
|
+
description='test description',
|
|
131
|
+
)
|
|
132
|
+
assert segment == Segment(
|
|
133
|
+
id='fbba0596-1d49-4159-a5ea-e1c2f57c9c32',
|
|
134
|
+
name='my segment',
|
|
135
|
+
definition='age > 10',
|
|
136
|
+
organization_name='test_organization',
|
|
137
|
+
project_name='bank_churn',
|
|
138
|
+
model_name='churn_classifier',
|
|
139
|
+
description='test description',
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def test_add_segment_error(self):
|
|
143
|
+
response_body = {
|
|
144
|
+
'error': {
|
|
145
|
+
'code': 400,
|
|
146
|
+
'message': 'Column unknown not found in model churn_classifier',
|
|
147
|
+
'errors': [
|
|
148
|
+
{
|
|
149
|
+
'reason': 'CustomMetricInvalidColumn',
|
|
150
|
+
'message': 'Column unknown not found in model churn_classifier',
|
|
151
|
+
'help': ''}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
'api_version': '2.0',
|
|
155
|
+
'kind': 'ERROR'
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
url = self._get_url()
|
|
159
|
+
|
|
160
|
+
self.requests_mock.post(url, json=response_body, status=HTTPStatus.BAD_REQUEST)
|
|
161
|
+
|
|
162
|
+
with self.assertRaises(BadRequest) as context:
|
|
163
|
+
self.client.add_segment(
|
|
164
|
+
name='my segment',
|
|
165
|
+
definition='unknown > 10',
|
|
166
|
+
project_id='bank_churn',
|
|
167
|
+
model_id='churn_classifier',
|
|
168
|
+
)
|
|
169
|
+
self.assertEqual(
|
|
170
|
+
context.exception.message,
|
|
171
|
+
"Column unknown not found in model churn_classifier"
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
def test_get_segment(self):
|
|
175
|
+
uuid = 'fbba0596-1d49-4159-a5ea-e1c2f57c9c32'
|
|
176
|
+
response = {
|
|
177
|
+
"data": {
|
|
178
|
+
"project_name": "bank_churn",
|
|
179
|
+
"name": "tp_0.8",
|
|
180
|
+
"model_name": "churn_classifier",
|
|
181
|
+
"definition": "age > 10",
|
|
182
|
+
"id": "fbba0596-1d49-4159-a5ea-e1c2f57c9c32",
|
|
183
|
+
"organization_name": "test_organization",
|
|
184
|
+
"description": "test description",
|
|
185
|
+
"extra_field_from_future": "should_not_break",
|
|
186
|
+
"created_at": "2021-03-03T18:30:00.000Z",
|
|
187
|
+
"created_by": {
|
|
188
|
+
"id": "1",
|
|
189
|
+
"full_name": "test user",
|
|
190
|
+
"email": "testuser@fiddler.ai"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"api_version": "2.0",
|
|
194
|
+
"kind": "NORMAL"
|
|
195
|
+
}
|
|
196
|
+
url = self._get_url(uuid)
|
|
197
|
+
|
|
198
|
+
self.requests_mock.get(url, json=response)
|
|
199
|
+
cm = self.client.get_segment(
|
|
200
|
+
segment_id='fbba0596-1d49-4159-a5ea-e1c2f57c9c32'
|
|
201
|
+
)
|
|
202
|
+
assert cm == Segment(
|
|
203
|
+
id='fbba0596-1d49-4159-a5ea-e1c2f57c9c32',
|
|
204
|
+
name='tp_0.8',
|
|
205
|
+
definition='age > 10',
|
|
206
|
+
organization_name='test_organization',
|
|
207
|
+
project_name='bank_churn',
|
|
208
|
+
model_name='churn_classifier',
|
|
209
|
+
description='test description',
|
|
210
|
+
created_at='2021-03-03T18:30:00.000Z',
|
|
211
|
+
created_by={
|
|
212
|
+
"id": "1",
|
|
213
|
+
"full_name": "test user",
|
|
214
|
+
"email": "testuser@fiddler.ai"
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
def test_delete_segment(self):
|
|
219
|
+
uuid = 'fbba0596-1d49-4159-a5ea-e1c2f57c9c32'
|
|
220
|
+
url = self._get_url(uuid)
|
|
221
|
+
|
|
222
|
+
self.requests_mock.delete(url)
|
|
223
|
+
|
|
224
|
+
self.client.delete_segment(
|
|
225
|
+
segment_id='fbba0596-1d49-4159-a5ea-e1c2f57c9c32'
|
|
226
|
+
)
|
|
227
|
+
self.assertEqual(len(self.requests_mock.calls), 1)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|