tinyshift 0.0.1__tar.gz
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.
- tinyshift-0.0.1/LICENSE +21 -0
- tinyshift-0.0.1/PKG-INFO +120 -0
- tinyshift-0.0.1/README.md +99 -0
- tinyshift-0.0.1/pyproject.toml +24 -0
- tinyshift-0.0.1/setup.cfg +4 -0
- tinyshift-0.0.1/setup.py +17 -0
- tinyshift-0.0.1/tinyshift.egg-info/PKG-INFO +120 -0
- tinyshift-0.0.1/tinyshift.egg-info/SOURCES.txt +9 -0
- tinyshift-0.0.1/tinyshift.egg-info/dependency_links.txt +1 -0
- tinyshift-0.0.1/tinyshift.egg-info/requires.txt +5 -0
- tinyshift-0.0.1/tinyshift.egg-info/top_level.txt +1 -0
tinyshift-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Lucas Leão
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tinyshift-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tinyshift
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A small toolbox for mlops
|
|
5
|
+
Author: Lucas Leão
|
|
6
|
+
Author-email: Lucas Leão <heylucasleao@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
Project-URL: Homepage, https://github.com/HeyLucasLeao/tinyshift
|
|
9
|
+
Project-URL: Issues, https://github.com/HeyLucasLeao/tinyshift/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.1
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pandas
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: plotly
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
|
|
22
|
+
# TinyShift
|
|
23
|
+
|
|
24
|
+
**TinyShift** is a small experimental Python library designed to detect **data drifts** and **performance drops** in machine learning models over time. The main goal of the project is to provide quick and tiny monitoring tools to help identify when data or model performance unexpectedly change.
|
|
25
|
+
For more robust solutions, I highly recommend [Nannyml.](https://github.com/NannyML/nannyml)
|
|
26
|
+
|
|
27
|
+
## Technologies Used
|
|
28
|
+
|
|
29
|
+
- **Python 3.x**
|
|
30
|
+
- **Scikit-learn**
|
|
31
|
+
- **Pandas**
|
|
32
|
+
- **NumPy**
|
|
33
|
+
- **Plotly**
|
|
34
|
+
- **Scipy**
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
To install **TinyShift** in your development environment, use **pip**:
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install tinyshift
|
|
43
|
+
```
|
|
44
|
+
If you prefer to clone the repository and install manually:
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/HeyLucasLeao/tinyshift.git
|
|
47
|
+
cd tinyshift
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
Below are basic examples of how to use TinyShift's features.
|
|
53
|
+
### 1. Data Drift Detection
|
|
54
|
+
To detect data drift, simply score in a new dataset to compare with the reference data. The DataDriftDetector will calculate metrics to identify significant differences.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from tinyshift.detector import CategoricalDriftDetector
|
|
58
|
+
|
|
59
|
+
df = pd.DataFrame("examples.csv")
|
|
60
|
+
df_reference = df[(df["datetime"] < '2024-07-01')].copy()
|
|
61
|
+
df_analysis = df[(df["datetime"] >= '2024-07-01')].copy()
|
|
62
|
+
|
|
63
|
+
detector = CategoricalDriftDetector(df_reference, 'discrete_1', "datetime", "W", drift_limit='mad')
|
|
64
|
+
|
|
65
|
+
analysis_score = detector.score(df_analysis, "discrete_1", "datetime")
|
|
66
|
+
|
|
67
|
+
print(analysis_score)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Performance Tracker
|
|
71
|
+
To track model performance over time, use the PerformanceMonitor, which will compare model accuracy on both old and new data.
|
|
72
|
+
```python
|
|
73
|
+
from tinyshift.tracker import PerformanceTracker
|
|
74
|
+
|
|
75
|
+
df_reference = pd.read_csv('refence.csv')
|
|
76
|
+
df_analysis = pd.read_csv('analysis.csv')
|
|
77
|
+
model = load_model('model.pkl')
|
|
78
|
+
df_analysis['prediction'] = model.predict(df_analysis["feature_0"])
|
|
79
|
+
|
|
80
|
+
tracker = PerformanceTracker(df_reference, 'target', 'prediction', 'datetime', "W")
|
|
81
|
+
|
|
82
|
+
analysis_score = tracker.score(df_analysis, 'target', 'prediction', 'datetime')
|
|
83
|
+
|
|
84
|
+
print(analysis_score)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Visualization
|
|
88
|
+
TinyShift also provides graphs to visualize the magnitude of drift and performance changes over time.
|
|
89
|
+
```python
|
|
90
|
+
tracker.plot.scatterplot_over_time(analysis_score, fig_type="png")
|
|
91
|
+
|
|
92
|
+
tracker.plot.diverging_bar_over_time(analysis_score, fig_type="png")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Project Structure
|
|
96
|
+
The basic structure of the project is as follows:
|
|
97
|
+
```
|
|
98
|
+
tinyshift
|
|
99
|
+
├── LICENSE
|
|
100
|
+
├── README.md
|
|
101
|
+
├── example.ipynb
|
|
102
|
+
├── pyproject.toml
|
|
103
|
+
└── tinyshift
|
|
104
|
+
├── base
|
|
105
|
+
│ ├── __init__.py
|
|
106
|
+
│ └── model.py
|
|
107
|
+
├── detector
|
|
108
|
+
│ ├── __init__.py
|
|
109
|
+
│ ├── categorical.py
|
|
110
|
+
│ └── continuous.py
|
|
111
|
+
├── plot
|
|
112
|
+
│ ├── __init__.py
|
|
113
|
+
│ └── plot.py
|
|
114
|
+
└── tracker
|
|
115
|
+
├── __init__.py
|
|
116
|
+
└── performance.py
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### License
|
|
120
|
+
This project is licensed under the MIT License - see the LICENSE file for more details.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# TinyShift
|
|
2
|
+
|
|
3
|
+
**TinyShift** is a small experimental Python library designed to detect **data drifts** and **performance drops** in machine learning models over time. The main goal of the project is to provide quick and tiny monitoring tools to help identify when data or model performance unexpectedly change.
|
|
4
|
+
For more robust solutions, I highly recommend [Nannyml.](https://github.com/NannyML/nannyml)
|
|
5
|
+
|
|
6
|
+
## Technologies Used
|
|
7
|
+
|
|
8
|
+
- **Python 3.x**
|
|
9
|
+
- **Scikit-learn**
|
|
10
|
+
- **Pandas**
|
|
11
|
+
- **NumPy**
|
|
12
|
+
- **Plotly**
|
|
13
|
+
- **Scipy**
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
To install **TinyShift** in your development environment, use **pip**:
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install tinyshift
|
|
22
|
+
```
|
|
23
|
+
If you prefer to clone the repository and install manually:
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/HeyLucasLeao/tinyshift.git
|
|
26
|
+
cd tinyshift
|
|
27
|
+
pip install .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
Below are basic examples of how to use TinyShift's features.
|
|
32
|
+
### 1. Data Drift Detection
|
|
33
|
+
To detect data drift, simply score in a new dataset to compare with the reference data. The DataDriftDetector will calculate metrics to identify significant differences.
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from tinyshift.detector import CategoricalDriftDetector
|
|
37
|
+
|
|
38
|
+
df = pd.DataFrame("examples.csv")
|
|
39
|
+
df_reference = df[(df["datetime"] < '2024-07-01')].copy()
|
|
40
|
+
df_analysis = df[(df["datetime"] >= '2024-07-01')].copy()
|
|
41
|
+
|
|
42
|
+
detector = CategoricalDriftDetector(df_reference, 'discrete_1', "datetime", "W", drift_limit='mad')
|
|
43
|
+
|
|
44
|
+
analysis_score = detector.score(df_analysis, "discrete_1", "datetime")
|
|
45
|
+
|
|
46
|
+
print(analysis_score)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Performance Tracker
|
|
50
|
+
To track model performance over time, use the PerformanceMonitor, which will compare model accuracy on both old and new data.
|
|
51
|
+
```python
|
|
52
|
+
from tinyshift.tracker import PerformanceTracker
|
|
53
|
+
|
|
54
|
+
df_reference = pd.read_csv('refence.csv')
|
|
55
|
+
df_analysis = pd.read_csv('analysis.csv')
|
|
56
|
+
model = load_model('model.pkl')
|
|
57
|
+
df_analysis['prediction'] = model.predict(df_analysis["feature_0"])
|
|
58
|
+
|
|
59
|
+
tracker = PerformanceTracker(df_reference, 'target', 'prediction', 'datetime', "W")
|
|
60
|
+
|
|
61
|
+
analysis_score = tracker.score(df_analysis, 'target', 'prediction', 'datetime')
|
|
62
|
+
|
|
63
|
+
print(analysis_score)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 3. Visualization
|
|
67
|
+
TinyShift also provides graphs to visualize the magnitude of drift and performance changes over time.
|
|
68
|
+
```python
|
|
69
|
+
tracker.plot.scatterplot_over_time(analysis_score, fig_type="png")
|
|
70
|
+
|
|
71
|
+
tracker.plot.diverging_bar_over_time(analysis_score, fig_type="png")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Project Structure
|
|
75
|
+
The basic structure of the project is as follows:
|
|
76
|
+
```
|
|
77
|
+
tinyshift
|
|
78
|
+
├── LICENSE
|
|
79
|
+
├── README.md
|
|
80
|
+
├── example.ipynb
|
|
81
|
+
├── pyproject.toml
|
|
82
|
+
└── tinyshift
|
|
83
|
+
├── base
|
|
84
|
+
│ ├── __init__.py
|
|
85
|
+
│ └── model.py
|
|
86
|
+
├── detector
|
|
87
|
+
│ ├── __init__.py
|
|
88
|
+
│ ├── categorical.py
|
|
89
|
+
│ └── continuous.py
|
|
90
|
+
├── plot
|
|
91
|
+
│ ├── __init__.py
|
|
92
|
+
│ └── plot.py
|
|
93
|
+
└── tracker
|
|
94
|
+
├── __init__.py
|
|
95
|
+
└── performance.py
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### License
|
|
99
|
+
This project is licensed under the MIT License - see the LICENSE file for more details.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[tool.poetry.dependencies]
|
|
2
|
+
python = "^3.1"
|
|
3
|
+
pandas = "^1.3.0"
|
|
4
|
+
scikit-learn = "^0.24.2"
|
|
5
|
+
plotly = "^5.3.0"
|
|
6
|
+
scipy = "^1.7.0"
|
|
7
|
+
[project]
|
|
8
|
+
name = "tinyshift"
|
|
9
|
+
version = "0.0.1"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name="Lucas Leão", email="heylucasleao@gmail.com" },
|
|
12
|
+
]
|
|
13
|
+
description = "A small toolbox for mlops"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.1"
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/HeyLucasLeao/tinyshift"
|
|
24
|
+
Issues = "https://github.com/HeyLucasLeao/tinyshift/issues"
|
tinyshift-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r") as arq:
|
|
4
|
+
readme = arq.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="tinyshift",
|
|
8
|
+
version="0.0.1",
|
|
9
|
+
license="MIT License",
|
|
10
|
+
author="Lucas Leão",
|
|
11
|
+
long_description=readme,
|
|
12
|
+
long_description_content_type="text/markdown",
|
|
13
|
+
author_email="heylucasleao@gmail.com",
|
|
14
|
+
description="A small toolbox for mlops",
|
|
15
|
+
packages=["tinyshift"],
|
|
16
|
+
install_requires=["pandas", "scipy", "plotly", "scikit-learn", "numpy"],
|
|
17
|
+
)
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tinyshift
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A small toolbox for mlops
|
|
5
|
+
Author: Lucas Leão
|
|
6
|
+
Author-email: Lucas Leão <heylucasleao@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
Project-URL: Homepage, https://github.com/HeyLucasLeao/tinyshift
|
|
9
|
+
Project-URL: Issues, https://github.com/HeyLucasLeao/tinyshift/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.1
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pandas
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: plotly
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
|
|
22
|
+
# TinyShift
|
|
23
|
+
|
|
24
|
+
**TinyShift** is a small experimental Python library designed to detect **data drifts** and **performance drops** in machine learning models over time. The main goal of the project is to provide quick and tiny monitoring tools to help identify when data or model performance unexpectedly change.
|
|
25
|
+
For more robust solutions, I highly recommend [Nannyml.](https://github.com/NannyML/nannyml)
|
|
26
|
+
|
|
27
|
+
## Technologies Used
|
|
28
|
+
|
|
29
|
+
- **Python 3.x**
|
|
30
|
+
- **Scikit-learn**
|
|
31
|
+
- **Pandas**
|
|
32
|
+
- **NumPy**
|
|
33
|
+
- **Plotly**
|
|
34
|
+
- **Scipy**
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
To install **TinyShift** in your development environment, use **pip**:
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install tinyshift
|
|
43
|
+
```
|
|
44
|
+
If you prefer to clone the repository and install manually:
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/HeyLucasLeao/tinyshift.git
|
|
47
|
+
cd tinyshift
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
Below are basic examples of how to use TinyShift's features.
|
|
53
|
+
### 1. Data Drift Detection
|
|
54
|
+
To detect data drift, simply score in a new dataset to compare with the reference data. The DataDriftDetector will calculate metrics to identify significant differences.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from tinyshift.detector import CategoricalDriftDetector
|
|
58
|
+
|
|
59
|
+
df = pd.DataFrame("examples.csv")
|
|
60
|
+
df_reference = df[(df["datetime"] < '2024-07-01')].copy()
|
|
61
|
+
df_analysis = df[(df["datetime"] >= '2024-07-01')].copy()
|
|
62
|
+
|
|
63
|
+
detector = CategoricalDriftDetector(df_reference, 'discrete_1', "datetime", "W", drift_limit='mad')
|
|
64
|
+
|
|
65
|
+
analysis_score = detector.score(df_analysis, "discrete_1", "datetime")
|
|
66
|
+
|
|
67
|
+
print(analysis_score)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Performance Tracker
|
|
71
|
+
To track model performance over time, use the PerformanceMonitor, which will compare model accuracy on both old and new data.
|
|
72
|
+
```python
|
|
73
|
+
from tinyshift.tracker import PerformanceTracker
|
|
74
|
+
|
|
75
|
+
df_reference = pd.read_csv('refence.csv')
|
|
76
|
+
df_analysis = pd.read_csv('analysis.csv')
|
|
77
|
+
model = load_model('model.pkl')
|
|
78
|
+
df_analysis['prediction'] = model.predict(df_analysis["feature_0"])
|
|
79
|
+
|
|
80
|
+
tracker = PerformanceTracker(df_reference, 'target', 'prediction', 'datetime', "W")
|
|
81
|
+
|
|
82
|
+
analysis_score = tracker.score(df_analysis, 'target', 'prediction', 'datetime')
|
|
83
|
+
|
|
84
|
+
print(analysis_score)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Visualization
|
|
88
|
+
TinyShift also provides graphs to visualize the magnitude of drift and performance changes over time.
|
|
89
|
+
```python
|
|
90
|
+
tracker.plot.scatterplot_over_time(analysis_score, fig_type="png")
|
|
91
|
+
|
|
92
|
+
tracker.plot.diverging_bar_over_time(analysis_score, fig_type="png")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Project Structure
|
|
96
|
+
The basic structure of the project is as follows:
|
|
97
|
+
```
|
|
98
|
+
tinyshift
|
|
99
|
+
├── LICENSE
|
|
100
|
+
├── README.md
|
|
101
|
+
├── example.ipynb
|
|
102
|
+
├── pyproject.toml
|
|
103
|
+
└── tinyshift
|
|
104
|
+
├── base
|
|
105
|
+
│ ├── __init__.py
|
|
106
|
+
│ └── model.py
|
|
107
|
+
├── detector
|
|
108
|
+
│ ├── __init__.py
|
|
109
|
+
│ ├── categorical.py
|
|
110
|
+
│ └── continuous.py
|
|
111
|
+
├── plot
|
|
112
|
+
│ ├── __init__.py
|
|
113
|
+
│ └── plot.py
|
|
114
|
+
└── tracker
|
|
115
|
+
├── __init__.py
|
|
116
|
+
└── performance.py
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### License
|
|
120
|
+
This project is licensed under the MIT License - see the LICENSE file for more details.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tinyshift
|