utilsds-models 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.
- utilsds_models-0.0.1/PKG-INFO +106 -0
- utilsds_models-0.0.1/README.md +18 -0
- utilsds_models-0.0.1/docs/ALTERNATIVE_README.md +88 -0
- utilsds_models-0.0.1/pyproject.toml +35 -0
- utilsds_models-0.0.1/setup.cfg +4 -0
- utilsds_models-0.0.1/utilsds-models/__init__.py +0 -0
- utilsds_models-0.0.1/utilsds-models/custom_metrics.py +626 -0
- utilsds_models-0.0.1/utilsds-models/data_processing.py +396 -0
- utilsds_models-0.0.1/utilsds-models/evip_dynamic.py +124 -0
- utilsds_models-0.0.1/utilsds-models/metrics.py +179 -0
- utilsds_models-0.0.1/utilsds-models/visualization.py +179 -0
- utilsds_models-0.0.1/utilsds_models.egg-info/PKG-INFO +106 -0
- utilsds_models-0.0.1/utilsds_models.egg-info/SOURCES.txt +14 -0
- utilsds_models-0.0.1/utilsds_models.egg-info/dependency_links.txt +1 -0
- utilsds_models-0.0.1/utilsds_models.egg-info/requires.txt +7 -0
- utilsds_models-0.0.1/utilsds_models.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: utilsds-models
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Solution for specific models
|
|
5
|
+
Author-email: DS Team <ds@sts.pl>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: pandas>=2.2.2
|
|
13
|
+
Requires-Dist: numpy>=1.26.0
|
|
14
|
+
Requires-Dist: scikit-learn>=1.5.0
|
|
15
|
+
Requires-Dist: matplotlib>=3.9.0
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
|
|
18
|
+
|
|
19
|
+
# utilsds
|
|
20
|
+
|
|
21
|
+
Utilsds is a library that includes classes and functions used in data science projects such as:
|
|
22
|
+
|
|
23
|
+
- **algorithm**:
|
|
24
|
+
- `Algorithm`: Base class for fitting, training, and getting hyperparameters of machine learning models.
|
|
25
|
+
|
|
26
|
+
- **data_ops**:
|
|
27
|
+
- `DataOperations`: Handle data operations locally and with Google Cloud services (BigQuery and Cloud Storage).
|
|
28
|
+
- BigQuery operations:
|
|
29
|
+
- `load_bq_data`: Load data from tables, views, and SQL files.
|
|
30
|
+
- `save_bq_view`, `save_bq_table`: Save views and tables.
|
|
31
|
+
- `load_bq_procedure`: Execute stored procedures.
|
|
32
|
+
- `load_bq_details`: Get table/view details and schema.
|
|
33
|
+
- `delete_bq_data`: Delete data with safety confirmations.
|
|
34
|
+
- `dry_run`: Perform dry runs to estimate query costs.
|
|
35
|
+
- Cloud Storage operations:
|
|
36
|
+
- `save_gcs_bucket`: Create buckets.
|
|
37
|
+
- `save_gcs_file`, `load_gcs_file`: Save and load files (.pkl, .json, .csv, .html, .sql).
|
|
38
|
+
- Local file operations:
|
|
39
|
+
- `save_local_file`, `load_local_file`: Save and load files (.pkl, .json, .csv, .html, .sql).
|
|
40
|
+
|
|
41
|
+
- **data_processing**:
|
|
42
|
+
- `SkewnessTransformer`: Transform skewed data using various methods (IHS, neglog, Yeo-Johnson, quantile).
|
|
43
|
+
- `NullReplacer`: Replace null values in specified columns with configurable strategies.
|
|
44
|
+
- `ColumnDropper`: Drop specified columns from a DataFrame.
|
|
45
|
+
- `OutliersCleaner`: Clean outliers by clipping values outside specified percentile ranges.
|
|
46
|
+
- `CategoricalMapper`: Map values in categorical columns according to a specified mapping scheme.
|
|
47
|
+
- `NumericalMapper`: Convert numerical columns to categorical by binning.
|
|
48
|
+
- `Encoder`: One-hot encode categorical columns in the data.
|
|
49
|
+
- `Normalizer`: Normalize numerical columns using a provided scaler.
|
|
50
|
+
|
|
51
|
+
- **data_split**:
|
|
52
|
+
- `train_test_validation_split`: Split data into training, testing, and validation sets.
|
|
53
|
+
- `resample_X_y`: resample train data and target column.
|
|
54
|
+
|
|
55
|
+
- **ds_statistics**:
|
|
56
|
+
- `test_kruskal_wallis`: Perform the Kruskal-Wallis statistical test.
|
|
57
|
+
- `test_agosto_pearsona`: Test for normality using D'Agostino-Pearson test.
|
|
58
|
+
|
|
59
|
+
- **evaluate**:
|
|
60
|
+
- `ModelEvaluator`: Evaluate models and generate plots for diagnostics.
|
|
61
|
+
- `ShapExplainer`: Explain model predictions using SHAP values.
|
|
62
|
+
|
|
63
|
+
- **experiments**:
|
|
64
|
+
- `VertexExperiment`: Manage experiments with Vertex AI.
|
|
65
|
+
|
|
66
|
+
- **optuna**:
|
|
67
|
+
- `Optuna`: Optimize hyperparameters using Optuna.
|
|
68
|
+
|
|
69
|
+
- **metrics**:
|
|
70
|
+
- `Metrics`: Calculate metrics for both classification and regression models.
|
|
71
|
+
|
|
72
|
+
- **modeling**:
|
|
73
|
+
- `Modeling`: Manage modeling, metrics, and logging with Vertex AI.
|
|
74
|
+
|
|
75
|
+
- **Supervised**:
|
|
76
|
+
- `LazyClassifier`: A classifier that automatically trains and evaluates multiple models.
|
|
77
|
+
- `LazyRegressor`: A regressor that automatically trains and evaluates multiple models.
|
|
78
|
+
- `get_card_split`: Function to split data into card-like groups.
|
|
79
|
+
- `adjusted_rsquared`: Calculate adjusted R-squared for regression models.
|
|
80
|
+
|
|
81
|
+
- **visualization**:
|
|
82
|
+
- `MetricsPlot`: Compare metrics for different parameter values.
|
|
83
|
+
- `Radar`: Create radar plots for visualizing data.
|
|
84
|
+
- `cluster_characteristics`: Analyze cluster characteristics.
|
|
85
|
+
- `comparison_density`: Compare density distributions.
|
|
86
|
+
- `elbow_visualisation`: Visualize the elbow method for clustering.
|
|
87
|
+
- `describe_clusters_metrics`: Describe metrics for clusters.
|
|
88
|
+
- `category_null_variables`: Visualize null variables in categorical data.
|
|
89
|
+
- `normal_distr_plots`: Visualize normal distribution plots.
|
|
90
|
+
- `distplot_limitations`: Visualize limitations of distplot.
|
|
91
|
+
- `boxplot_limitations`: Visualize limitations of boxplot.
|
|
92
|
+
- `violinplot_limitations`: Visualize limitations of violinplot.
|
|
93
|
+
- `countplot_limitations`: Visualize limitations of countplot.
|
|
94
|
+
- `categorical_variable_perc`: Visualize percentage of categorical variables.
|
|
95
|
+
- `spearman_correlation`: Visualize spearman correlation.
|
|
96
|
+
- `calculate_crammers_v`: Calculate Crammer's V.
|
|
97
|
+
|
|
98
|
+
- **what_if_streamlit**:
|
|
99
|
+
- `ShapSaver`: Save SHAP explainer components for lazy loading in what-if analysis.
|
|
100
|
+
- `ColumnMetadataGenerator`: Generate column metadata from a DataFrame or CSV file.
|
|
101
|
+
|
|
102
|
+
- **monitoring**:
|
|
103
|
+
- `mapping`: Create column mapping from configuration file for Evidently.
|
|
104
|
+
- `test_data`: Test data for issues using Evidently test suites.
|
|
105
|
+
- `check_data_drift`: Check data for drift using Evidently metrics.
|
|
106
|
+
- `send_email_with_table`: Send email notifications with HTML tables for monitoring alerts.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# utils
|
|
2
|
+
|
|
3
|
+
Rozwiązanie zawierające klasy i funkcje wykorzystywane podczas projektów.
|
|
4
|
+
Struktura repozytorium stworzono tak, aby udostępnić ją jako [utilsds](https://pypi.org/project/utilsds/).
|
|
5
|
+
|
|
6
|
+
Biblioteka została stworzona na podstawie [tej instrukcji](https://www.turing.com/kb/how-to-create-pypi-packages).
|
|
7
|
+
|
|
8
|
+
Aby zaktualizować klasy/funkcje pierwsze na stronie https://pypi.org/ należy:
|
|
9
|
+
- stworzyć konto
|
|
10
|
+
- dodać 2FA z wykorzystaniem aplikacji Google Authenticator
|
|
11
|
+
- stworzyć plik home/.pypirc (najlepiej zarządzać tym plikiem z poziomu konsoli, ponieważ pozostaje on ukryty)
|
|
12
|
+
- wygenerować w ustawieniach `API tokens` a następnie wkleić wygenerowany kod do wcześniej stworzonego pliku .pypirc (zgodnie z instrukacjami podanymi w ustawieniach).
|
|
13
|
+
- wprowadzić aktualizacje
|
|
14
|
+
- dokonać modyfikacji w pliku `pyproject.toml` (szczególnie zwrócić uwagę na inkrementację numeracji wersji w sekcji `[project]`)
|
|
15
|
+
- jeżeli jest potrzebne, zainstalować narzędzia build: `pip install --upgrade build twine`
|
|
16
|
+
- wykonać komendę `python -m build`
|
|
17
|
+
- wykonać komendę `twine upload --skip-existing dist/*`
|
|
18
|
+
- spushować zmiany na gitlaba
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# utilsds
|
|
2
|
+
|
|
3
|
+
Utilsds is a library that includes classes and functions used in data science projects such as:
|
|
4
|
+
|
|
5
|
+
- **algorithm**:
|
|
6
|
+
- `Algorithm`: Base class for fitting, training, and getting hyperparameters of machine learning models.
|
|
7
|
+
|
|
8
|
+
- **data_ops**:
|
|
9
|
+
- `DataOperations`: Handle data operations locally and with Google Cloud services (BigQuery and Cloud Storage).
|
|
10
|
+
- BigQuery operations:
|
|
11
|
+
- `load_bq_data`: Load data from tables, views, and SQL files.
|
|
12
|
+
- `save_bq_view`, `save_bq_table`: Save views and tables.
|
|
13
|
+
- `load_bq_procedure`: Execute stored procedures.
|
|
14
|
+
- `load_bq_details`: Get table/view details and schema.
|
|
15
|
+
- `delete_bq_data`: Delete data with safety confirmations.
|
|
16
|
+
- `dry_run`: Perform dry runs to estimate query costs.
|
|
17
|
+
- Cloud Storage operations:
|
|
18
|
+
- `save_gcs_bucket`: Create buckets.
|
|
19
|
+
- `save_gcs_file`, `load_gcs_file`: Save and load files (.pkl, .json, .csv, .html, .sql).
|
|
20
|
+
- Local file operations:
|
|
21
|
+
- `save_local_file`, `load_local_file`: Save and load files (.pkl, .json, .csv, .html, .sql).
|
|
22
|
+
|
|
23
|
+
- **data_processing**:
|
|
24
|
+
- `SkewnessTransformer`: Transform skewed data using various methods (IHS, neglog, Yeo-Johnson, quantile).
|
|
25
|
+
- `NullReplacer`: Replace null values in specified columns with configurable strategies.
|
|
26
|
+
- `ColumnDropper`: Drop specified columns from a DataFrame.
|
|
27
|
+
- `OutliersCleaner`: Clean outliers by clipping values outside specified percentile ranges.
|
|
28
|
+
- `CategoricalMapper`: Map values in categorical columns according to a specified mapping scheme.
|
|
29
|
+
- `NumericalMapper`: Convert numerical columns to categorical by binning.
|
|
30
|
+
- `Encoder`: One-hot encode categorical columns in the data.
|
|
31
|
+
- `Normalizer`: Normalize numerical columns using a provided scaler.
|
|
32
|
+
|
|
33
|
+
- **data_split**:
|
|
34
|
+
- `train_test_validation_split`: Split data into training, testing, and validation sets.
|
|
35
|
+
- `resample_X_y`: resample train data and target column.
|
|
36
|
+
|
|
37
|
+
- **ds_statistics**:
|
|
38
|
+
- `test_kruskal_wallis`: Perform the Kruskal-Wallis statistical test.
|
|
39
|
+
- `test_agosto_pearsona`: Test for normality using D'Agostino-Pearson test.
|
|
40
|
+
|
|
41
|
+
- **evaluate**:
|
|
42
|
+
- `ModelEvaluator`: Evaluate models and generate plots for diagnostics.
|
|
43
|
+
- `ShapExplainer`: Explain model predictions using SHAP values.
|
|
44
|
+
|
|
45
|
+
- **experiments**:
|
|
46
|
+
- `VertexExperiment`: Manage experiments with Vertex AI.
|
|
47
|
+
|
|
48
|
+
- **optuna**:
|
|
49
|
+
- `Optuna`: Optimize hyperparameters using Optuna.
|
|
50
|
+
|
|
51
|
+
- **metrics**:
|
|
52
|
+
- `Metrics`: Calculate metrics for both classification and regression models.
|
|
53
|
+
|
|
54
|
+
- **modeling**:
|
|
55
|
+
- `Modeling`: Manage modeling, metrics, and logging with Vertex AI.
|
|
56
|
+
|
|
57
|
+
- **Supervised**:
|
|
58
|
+
- `LazyClassifier`: A classifier that automatically trains and evaluates multiple models.
|
|
59
|
+
- `LazyRegressor`: A regressor that automatically trains and evaluates multiple models.
|
|
60
|
+
- `get_card_split`: Function to split data into card-like groups.
|
|
61
|
+
- `adjusted_rsquared`: Calculate adjusted R-squared for regression models.
|
|
62
|
+
|
|
63
|
+
- **visualization**:
|
|
64
|
+
- `MetricsPlot`: Compare metrics for different parameter values.
|
|
65
|
+
- `Radar`: Create radar plots for visualizing data.
|
|
66
|
+
- `cluster_characteristics`: Analyze cluster characteristics.
|
|
67
|
+
- `comparison_density`: Compare density distributions.
|
|
68
|
+
- `elbow_visualisation`: Visualize the elbow method for clustering.
|
|
69
|
+
- `describe_clusters_metrics`: Describe metrics for clusters.
|
|
70
|
+
- `category_null_variables`: Visualize null variables in categorical data.
|
|
71
|
+
- `normal_distr_plots`: Visualize normal distribution plots.
|
|
72
|
+
- `distplot_limitations`: Visualize limitations of distplot.
|
|
73
|
+
- `boxplot_limitations`: Visualize limitations of boxplot.
|
|
74
|
+
- `violinplot_limitations`: Visualize limitations of violinplot.
|
|
75
|
+
- `countplot_limitations`: Visualize limitations of countplot.
|
|
76
|
+
- `categorical_variable_perc`: Visualize percentage of categorical variables.
|
|
77
|
+
- `spearman_correlation`: Visualize spearman correlation.
|
|
78
|
+
- `calculate_crammers_v`: Calculate Crammer's V.
|
|
79
|
+
|
|
80
|
+
- **what_if_streamlit**:
|
|
81
|
+
- `ShapSaver`: Save SHAP explainer components for lazy loading in what-if analysis.
|
|
82
|
+
- `ColumnMetadataGenerator`: Generate column metadata from a DataFrame or CSV file.
|
|
83
|
+
|
|
84
|
+
- **monitoring**:
|
|
85
|
+
- `mapping`: Create column mapping from configuration file for Evidently.
|
|
86
|
+
- `test_data`: Test data for issues using Evidently test suites.
|
|
87
|
+
- `check_data_drift`: Check data for drift using Evidently metrics.
|
|
88
|
+
- `send_email_with_table`: Send email notifications with HTML tables for monitoring alerts.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=80.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "utilsds-models"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Solution for specific models"
|
|
9
|
+
readme = {file = "docs/ALTERNATIVE_README.md", content-type = "text/markdown"}
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = {text = "MIT License"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "DS Team", email = "ds@sts.pl"}
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"pandas>=2.2.2",
|
|
22
|
+
"numpy>=1.26.0",
|
|
23
|
+
"scikit-learn>=1.5.0",
|
|
24
|
+
"matplotlib>=3.9.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pre-commit>=3.5.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["."]
|
|
34
|
+
include = ["utilsds-models*"]
|
|
35
|
+
exclude = ["tests*", "docs*"]
|
|
File without changes
|