machinegnostics 0.0.1__tar.gz → 0.0.2__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.
- {machinegnostics-0.0.1/src/machinegnostics.egg-info → machinegnostics-0.0.2}/PKG-INFO +25 -21
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/README.md +22 -20
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/pyproject.toml +4 -2
- machinegnostics-0.0.2/src/machinegnostics/__init__.py +367 -0
- machinegnostics-0.0.2/src/machinegnostics/data/__init__.py +8 -0
- machinegnostics-0.0.2/src/machinegnostics/data/animals_data.py +81 -0
- machinegnostics-0.0.2/src/machinegnostics/data/anscombe_data.py +64 -0
- machinegnostics-0.0.2/src/machinegnostics/data/cls_data.py +71 -0
- machinegnostics-0.0.2/src/machinegnostics/data/forbes_data.py +61 -0
- machinegnostics-0.0.2/src/machinegnostics/data/moon_data.py +72 -0
- machinegnostics-0.0.2/src/machinegnostics/data/reg_data.py +95 -0
- machinegnostics-0.0.2/src/machinegnostics/data/stackloss_data.py +63 -0
- machinegnostics-0.0.2/src/machinegnostics/integration/mlflow.py +31 -0
- machinegnostics-0.0.2/src/machinegnostics/integration/mlflow_flavor.py +55 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/characteristics.py +3 -2
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/base_distfunc.py +57 -367
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/base_egdf.py +1 -5
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/base_eldf.py +149 -38
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/base_qgdf.py +116 -391
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/base_qldf.py +129 -52
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/cluster_analysis.py +2 -7
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/data_cluster.py +56 -350
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/data_intervals.py +44 -48
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/data_membership.py +80 -70
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/distfunc_engine.py +131 -242
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/egdf.py +8 -9
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/eldf.py +9 -5
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/homogeneity.py +24 -3
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/marginal_intv_analysis.py +19 -14
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/qgdf.py +7 -7
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/qldf.py +10 -7
- machinegnostics-0.0.2/src/machinegnostics/magcal/gdf/scedasticity.py +255 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/z0_estimator.py +66 -145
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/mg_weights.py +2 -2
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/scale_param.py +134 -134
- machinegnostics-0.0.2/src/machinegnostics/magnet/__init__.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/__init__.py +4 -1
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/correlation.py +17 -15
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/cross_variance.py +8 -8
- machinegnostics-0.0.2/src/machinegnostics/metrics/entropy.py +173 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/hc.py +29 -9
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/mean.py +6 -6
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/median.py +3 -3
- machinegnostics-0.0.2/src/machinegnostics/metrics/silhouette_score.py +154 -0
- machinegnostics-0.0.2/src/machinegnostics/metrics/stationarity_test.py +144 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/std.py +46 -23
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/variance.py +10 -6
- machinegnostics-0.0.2/src/machinegnostics/models/__init__.py +177 -0
- machinegnostics-0.0.2/src/machinegnostics/models/base_io_models.py +255 -0
- machinegnostics-0.0.2/src/machinegnostics/models/base_model.py +143 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/__init__.py +0 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_boosting_cal.py +100 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_boosting_classifier_cal.py +117 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_boosting_classifier_history.py +17 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_boosting_classifier_methods.py +154 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_boosting_history.py +17 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_boosting_methods.py +158 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_cart_cal.py +116 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_cart_classifier_cal.py +132 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_cart_classifier_history.py +17 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_cart_classifier_methods.py +203 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_cart_history.py +19 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/base_cart_methods.py +205 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/boosting_classifier.py +137 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/boosting_regressor.py +132 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/random_forest_classifier.py +171 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/random_forest_regressor.py +177 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/tree_classifier.py +118 -0
- machinegnostics-0.0.2/src/machinegnostics/models/cart/tree_regressor.py +134 -0
- machinegnostics-0.0.2/src/machinegnostics/models/classification/__init__.py +0 -0
- machinegnostics-0.0.1/src/machinegnostics/models/classification/layer_param_log_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/classification/base_logistic_regressor_cal.py +34 -44
- machinegnostics-0.0.1/src/machinegnostics/models/classification/layer_history_log_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/classification/base_logistic_regressor_history.py +19 -12
- machinegnostics-0.0.2/src/machinegnostics/models/classification/base_multiclass_classifier_cal.py +339 -0
- machinegnostics-0.0.2/src/machinegnostics/models/classification/base_multiclass_classifier_history.py +141 -0
- machinegnostics-0.0.2/src/machinegnostics/models/classification/gnostic_multiclass_classifier.py +273 -0
- machinegnostics-0.0.1/src/machinegnostics/models/classification/mg_log_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/classification/logistic_regressor.py +36 -27
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/__init__.py +1 -0
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/base_clustering_cal.py +270 -0
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/base_clustering_history.py +155 -0
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/base_clustering_methods.py +493 -0
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/base_io_clustering.py +111 -0
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/kmeans_clustering.py +290 -0
- machinegnostics-0.0.2/src/machinegnostics/models/clustering/local_clustering.py +478 -0
- machinegnostics-0.0.2/src/machinegnostics/models/regression/__init__.py +0 -0
- machinegnostics-0.0.2/src/machinegnostics/models/regression/arima.py +596 -0
- machinegnostics-0.0.2/src/machinegnostics/models/regression/auto_regressor.py +315 -0
- machinegnostics-0.0.1/src/machinegnostics/models/regression/layer_param_rob_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/regression/base_regressor_cal.py +49 -37
- machinegnostics-0.0.1/src/machinegnostics/models/regression/layer_histroy_rob_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/regression/base_regressor_history.py +21 -28
- machinegnostics-0.0.2/src/machinegnostics/models/regression/base_regressor_methods.py +498 -0
- machinegnostics-0.0.1/src/machinegnostics/models/regression/mg_lin_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/regression/linear_regressor.py +37 -22
- machinegnostics-0.0.1/src/machinegnostics/models/regression/mg_poly_reg.py → machinegnostics-0.0.2/src/machinegnostics/models/regression/polynomial_regressor.py +29 -15
- machinegnostics-0.0.2/src/machinegnostics/models/regression/sarima.py +469 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2/src/machinegnostics.egg-info}/PKG-INFO +25 -21
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics.egg-info/SOURCES.txt +56 -11
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics.egg-info/requires.txt +2 -0
- machinegnostics-0.0.1/src/machinegnostics/__init__.py +0 -24
- machinegnostics-0.0.1/src/machinegnostics/magcal/gdf/scedasticity.py +0 -197
- machinegnostics-0.0.1/src/machinegnostics/models/__init__.py +0 -2
- machinegnostics-0.0.1/src/machinegnostics/models/classification/__init__.py +0 -1
- machinegnostics-0.0.1/src/machinegnostics/models/classification/layer_io_process_log_reg.py +0 -98
- machinegnostics-0.0.1/src/machinegnostics/models/classification/layer_mlflow_log_reg.py +0 -107
- machinegnostics-0.0.1/src/machinegnostics/models/regression/__init__.py +0 -2
- machinegnostics-0.0.1/src/machinegnostics/models/regression/layer_io_process_rob_rig.py +0 -88
- machinegnostics-0.0.1/src/machinegnostics/models/regression/layer_mlflow_rob_reg.py +0 -134
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/LICENSE +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/MANIFEST.in +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/setup.cfg +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/__init__.py +0 -0
- {machinegnostics-0.0.1/src/machinegnostics/magcal/util → machinegnostics-0.0.2/src/machinegnostics/integration}/__init__.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/__init__.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/criteria_eval.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/criterion.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/data_conversion.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gcor.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/__init__.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/base_df.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/der_egdf.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/eldf_intv.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/eldf_ma.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/intv_engine.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/gdf/wedf.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/layer_base.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/layer_history_base.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/layer_io_process_base.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/layer_param_base.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/sample_characteristics.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/scale_optimization.py +0 -0
- {machinegnostics-0.0.1/src/machinegnostics/magnet → machinegnostics-0.0.2/src/machinegnostics/magcal/util}/__init__.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/util/dis_docstring.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/util/logging.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/magcal/util/min_max_float.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/accu.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/accuracy.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/auto_correlation.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/auto_covariance.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/cls_report.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/conf_matrix.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/divi.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/evalmet.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/f1_score.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/gmmfe.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/mae.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/mg_r2.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/mse.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/precision.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/r2.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/recall.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/rmse.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/metrics/robr2.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/models/cross_validation.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics/models/data_split.py +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics.egg-info/dependency_links.txt +0 -0
- {machinegnostics-0.0.1 → machinegnostics-0.0.2}/src/machinegnostics.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: machinegnostics
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: Machine Gnostics is an open-source initiative that seeks to redefine the mathematical underpinnings of machine learning. While most conventional ML libraries are grounded in probabilistic and statistical frameworks, Machine Gnostics explores alternative paradigms—drawing from Mathematical Gnostics, the non-statistical and deterministic approach. Laws of Nature, Encoded—For Everyone!
|
|
5
5
|
Author-email: Nirmal Parmar <info.machinegnostics@gmail.com>
|
|
6
6
|
Maintainer-email: Nirmal Parmar <info.machinegnostics@gmail.com>
|
|
@@ -26,13 +26,19 @@ Requires-Dist: pandas
|
|
|
26
26
|
Requires-Dist: pydantic
|
|
27
27
|
Requires-Dist: scipy
|
|
28
28
|
Requires-Dist: SQLAlchemy
|
|
29
|
+
Requires-Dist: xgboost
|
|
30
|
+
Requires-Dist: scikit-learn
|
|
29
31
|
Dynamic: license-file
|
|
30
32
|
|
|
31
|
-
# Machine Gnostics
|
|
33
|
+
# [Machine Gnostics](https://machinegnostics.info) 🥭
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
[](https://badge.fury.io/py/machinegnostics) [](https://pypi.org/project/machinegnostics/) [](https://www.gnu.org/licenses/gpl-3.0) [](https://pepy.tech/project/machinegnostics) [](https://pepy.tech/project/machinegnostics) [](https://github.com/MachineGnostics/machinegnostics)
|
|
37
|
+
|
|
32
38
|
|
|
33
39
|
> Machine Gnostics: Laws of Nature, Encoded—For Everyone!
|
|
34
40
|
|
|
35
|
-
Welcome to **Machine Gnostics**, an innovative Python library designed to implement the principles of **
|
|
41
|
+
Welcome to **Machine Gnostics**, an innovative Python library designed to implement the principles of **Mathematical Gnostics** for robust data analysis, modeling, and inference. Unlike traditional statistical approaches that depend heavily on probabilistic assumptions, Machine Gnostics harnesses deterministic algebraic and geometric structures. This unique foundation enables the library to deliver exceptional resilience against outliers, noise, and corrupted data, making it a powerful tool for challenging real-world scenarios.
|
|
36
42
|
|
|
37
43
|
Machine Gnostics is an open-source initiative that seeks to redefine the mathematical underpinnings of machine learning. While most conventional ML libraries are grounded in probabilistic and statistical frameworks, Machine Gnostics explores alternative paradigms—drawing from deterministic algebra, information theory, and geometric methods. This approach opens new avenues for building robust, interpretable, and reliable analysis tools that can withstand the limitations of traditional models.
|
|
38
44
|
|
|
@@ -55,19 +61,19 @@ It is best practice to use a virtual environment to manage your project dependen
|
|
|
55
61
|
### macOS & Linux
|
|
56
62
|
|
|
57
63
|
```bash
|
|
58
|
-
# Create a new virtual environment named 'mg-env'
|
|
59
|
-
python3 -m venv mg-env
|
|
64
|
+
# Create a new virtual environment named '.mg-env'
|
|
65
|
+
python3 -m venv .mg-env
|
|
60
66
|
# Activate the environment
|
|
61
|
-
source mg-env/bin/activate
|
|
67
|
+
source .mg-env/bin/activate
|
|
62
68
|
```
|
|
63
69
|
|
|
64
70
|
### Windows
|
|
65
71
|
|
|
66
72
|
```cmd
|
|
67
|
-
# Create a new virtual environment named 'mg-env'
|
|
68
|
-
python -m venv mg-env
|
|
73
|
+
# Create a new virtual environment named '.mg-env'
|
|
74
|
+
python -m venv .mg-env
|
|
69
75
|
# Activate the environment
|
|
70
|
-
mg-env\Scripts\activate
|
|
76
|
+
.mg-env\Scripts\activate
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
---
|
|
@@ -127,19 +133,22 @@ Machine Gnostics is designed to be as simple to use as other machine learning li
|
|
|
127
133
|
```python
|
|
128
134
|
import numpy as np
|
|
129
135
|
from machinegnostics.magcal import EGDF
|
|
130
|
-
|
|
136
|
+
# data
|
|
131
137
|
data = np.array([ -13.5, 0, 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.])
|
|
138
|
+
# Create and fit GDF
|
|
132
139
|
egdf = EGDF()
|
|
133
140
|
egdf.fit(data)
|
|
141
|
+
# Quick plot
|
|
134
142
|
egdf.plot()
|
|
135
|
-
|
|
143
|
+
# EGDF params
|
|
144
|
+
egdf.params
|
|
136
145
|
```
|
|
137
146
|
|
|
138
147
|
### Example "Polynomial Regression"
|
|
139
148
|
|
|
140
149
|
```python
|
|
141
150
|
import numpy as np
|
|
142
|
-
from machinegnostics.models
|
|
151
|
+
from machinegnostics.models import PolynomialRegressor
|
|
143
152
|
|
|
144
153
|
# Example data
|
|
145
154
|
X = np.array([0., 0.4, 0.8, 1.2, 1.6, 2. ])
|
|
@@ -149,12 +158,8 @@ y = np.array([17.89408548, 69.61586934, -7.19890572, 9.37670866, -10.55673099, 1
|
|
|
149
158
|
model = PolynomialRegressor(degree=2)
|
|
150
159
|
model.fit(X, y)
|
|
151
160
|
|
|
152
|
-
model_lr = LinearRegressor()
|
|
153
|
-
model_lr.fit(X, y)
|
|
154
|
-
|
|
155
161
|
# Make predictions
|
|
156
162
|
y_pred = model.predict(X)
|
|
157
|
-
y_pred_lr = model_lr.predict(X)
|
|
158
163
|
|
|
159
164
|
print("Predictions:", y_pred)
|
|
160
165
|
|
|
@@ -165,7 +170,6 @@ print("Coefficients:", model.coefficients)
|
|
|
165
170
|
import matplotlib.pyplot as plt
|
|
166
171
|
plt.scatter(X, y, color='blue', label='Data')
|
|
167
172
|
plt.plot(X, y_pred, color='red', label='Polynomial Prediction')
|
|
168
|
-
plt.plot(X, y_pred_lr, color='green', label='Linear Prediction')
|
|
169
173
|
plt.xlabel('X')
|
|
170
174
|
plt.ylabel('y')
|
|
171
175
|
plt.title('Polynomial Regression')
|
|
@@ -192,7 +196,7 @@ plt.show()
|
|
|
192
196
|
**macOS & Linux:**
|
|
193
197
|
|
|
194
198
|
```bash
|
|
195
|
-
source mg-env/bin/activate
|
|
199
|
+
source .mg-env/bin/activate
|
|
196
200
|
# or for conda
|
|
197
201
|
conda activate myenv
|
|
198
202
|
```
|
|
@@ -200,7 +204,7 @@ plt.show()
|
|
|
200
204
|
**Windows:**
|
|
201
205
|
|
|
202
206
|
```cmd
|
|
203
|
-
mg-env\Scripts\activate
|
|
207
|
+
.mg-env\Scripts\activate
|
|
204
208
|
# or for conda
|
|
205
209
|
conda activate myenv
|
|
206
210
|
```
|
|
@@ -224,13 +228,13 @@ plt.show()
|
|
|
224
228
|
**macOS & Linux:**
|
|
225
229
|
|
|
226
230
|
```bash
|
|
227
|
-
pip install --upgrade pip
|
|
231
|
+
python3 -m pip install --upgrade pip
|
|
228
232
|
```
|
|
229
233
|
|
|
230
234
|
**Windows:**
|
|
231
235
|
|
|
232
236
|
```cmd
|
|
233
|
-
pip install --upgrade pip
|
|
237
|
+
python -m pip install --upgrade pip
|
|
234
238
|
```
|
|
235
239
|
|
|
236
240
|
**Install from a Clean Environment:** If you encounter conflicts, try creating a fresh virtual environment and reinstalling.
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
# Machine Gnostics
|
|
1
|
+
# [Machine Gnostics](https://machinegnostics.info) 🥭
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
[](https://badge.fury.io/py/machinegnostics) [](https://pypi.org/project/machinegnostics/) [](https://www.gnu.org/licenses/gpl-3.0) [](https://pepy.tech/project/machinegnostics) [](https://pepy.tech/project/machinegnostics) [](https://github.com/MachineGnostics/machinegnostics)
|
|
5
|
+
|
|
2
6
|
|
|
3
7
|
> Machine Gnostics: Laws of Nature, Encoded—For Everyone!
|
|
4
8
|
|
|
5
|
-
Welcome to **Machine Gnostics**, an innovative Python library designed to implement the principles of **
|
|
9
|
+
Welcome to **Machine Gnostics**, an innovative Python library designed to implement the principles of **Mathematical Gnostics** for robust data analysis, modeling, and inference. Unlike traditional statistical approaches that depend heavily on probabilistic assumptions, Machine Gnostics harnesses deterministic algebraic and geometric structures. This unique foundation enables the library to deliver exceptional resilience against outliers, noise, and corrupted data, making it a powerful tool for challenging real-world scenarios.
|
|
6
10
|
|
|
7
11
|
Machine Gnostics is an open-source initiative that seeks to redefine the mathematical underpinnings of machine learning. While most conventional ML libraries are grounded in probabilistic and statistical frameworks, Machine Gnostics explores alternative paradigms—drawing from deterministic algebra, information theory, and geometric methods. This approach opens new avenues for building robust, interpretable, and reliable analysis tools that can withstand the limitations of traditional models.
|
|
8
12
|
|
|
@@ -25,19 +29,19 @@ It is best practice to use a virtual environment to manage your project dependen
|
|
|
25
29
|
### macOS & Linux
|
|
26
30
|
|
|
27
31
|
```bash
|
|
28
|
-
# Create a new virtual environment named 'mg-env'
|
|
29
|
-
python3 -m venv mg-env
|
|
32
|
+
# Create a new virtual environment named '.mg-env'
|
|
33
|
+
python3 -m venv .mg-env
|
|
30
34
|
# Activate the environment
|
|
31
|
-
source mg-env/bin/activate
|
|
35
|
+
source .mg-env/bin/activate
|
|
32
36
|
```
|
|
33
37
|
|
|
34
38
|
### Windows
|
|
35
39
|
|
|
36
40
|
```cmd
|
|
37
|
-
# Create a new virtual environment named 'mg-env'
|
|
38
|
-
python -m venv mg-env
|
|
41
|
+
# Create a new virtual environment named '.mg-env'
|
|
42
|
+
python -m venv .mg-env
|
|
39
43
|
# Activate the environment
|
|
40
|
-
mg-env\Scripts\activate
|
|
44
|
+
.mg-env\Scripts\activate
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
---
|
|
@@ -97,19 +101,22 @@ Machine Gnostics is designed to be as simple to use as other machine learning li
|
|
|
97
101
|
```python
|
|
98
102
|
import numpy as np
|
|
99
103
|
from machinegnostics.magcal import EGDF
|
|
100
|
-
|
|
104
|
+
# data
|
|
101
105
|
data = np.array([ -13.5, 0, 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.])
|
|
106
|
+
# Create and fit GDF
|
|
102
107
|
egdf = EGDF()
|
|
103
108
|
egdf.fit(data)
|
|
109
|
+
# Quick plot
|
|
104
110
|
egdf.plot()
|
|
105
|
-
|
|
111
|
+
# EGDF params
|
|
112
|
+
egdf.params
|
|
106
113
|
```
|
|
107
114
|
|
|
108
115
|
### Example "Polynomial Regression"
|
|
109
116
|
|
|
110
117
|
```python
|
|
111
118
|
import numpy as np
|
|
112
|
-
from machinegnostics.models
|
|
119
|
+
from machinegnostics.models import PolynomialRegressor
|
|
113
120
|
|
|
114
121
|
# Example data
|
|
115
122
|
X = np.array([0., 0.4, 0.8, 1.2, 1.6, 2. ])
|
|
@@ -119,12 +126,8 @@ y = np.array([17.89408548, 69.61586934, -7.19890572, 9.37670866, -10.55673099, 1
|
|
|
119
126
|
model = PolynomialRegressor(degree=2)
|
|
120
127
|
model.fit(X, y)
|
|
121
128
|
|
|
122
|
-
model_lr = LinearRegressor()
|
|
123
|
-
model_lr.fit(X, y)
|
|
124
|
-
|
|
125
129
|
# Make predictions
|
|
126
130
|
y_pred = model.predict(X)
|
|
127
|
-
y_pred_lr = model_lr.predict(X)
|
|
128
131
|
|
|
129
132
|
print("Predictions:", y_pred)
|
|
130
133
|
|
|
@@ -135,7 +138,6 @@ print("Coefficients:", model.coefficients)
|
|
|
135
138
|
import matplotlib.pyplot as plt
|
|
136
139
|
plt.scatter(X, y, color='blue', label='Data')
|
|
137
140
|
plt.plot(X, y_pred, color='red', label='Polynomial Prediction')
|
|
138
|
-
plt.plot(X, y_pred_lr, color='green', label='Linear Prediction')
|
|
139
141
|
plt.xlabel('X')
|
|
140
142
|
plt.ylabel('y')
|
|
141
143
|
plt.title('Polynomial Regression')
|
|
@@ -162,7 +164,7 @@ plt.show()
|
|
|
162
164
|
**macOS & Linux:**
|
|
163
165
|
|
|
164
166
|
```bash
|
|
165
|
-
source mg-env/bin/activate
|
|
167
|
+
source .mg-env/bin/activate
|
|
166
168
|
# or for conda
|
|
167
169
|
conda activate myenv
|
|
168
170
|
```
|
|
@@ -170,7 +172,7 @@ plt.show()
|
|
|
170
172
|
**Windows:**
|
|
171
173
|
|
|
172
174
|
```cmd
|
|
173
|
-
mg-env\Scripts\activate
|
|
175
|
+
.mg-env\Scripts\activate
|
|
174
176
|
# or for conda
|
|
175
177
|
conda activate myenv
|
|
176
178
|
```
|
|
@@ -194,13 +196,13 @@ plt.show()
|
|
|
194
196
|
**macOS & Linux:**
|
|
195
197
|
|
|
196
198
|
```bash
|
|
197
|
-
pip install --upgrade pip
|
|
199
|
+
python3 -m pip install --upgrade pip
|
|
198
200
|
```
|
|
199
201
|
|
|
200
202
|
**Windows:**
|
|
201
203
|
|
|
202
204
|
```cmd
|
|
203
|
-
pip install --upgrade pip
|
|
205
|
+
python -m pip install --upgrade pip
|
|
204
206
|
```
|
|
205
207
|
|
|
206
208
|
**Install from a Clean Environment:** If you encounter conflicts, try creating a fresh virtual environment and reinstalling.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "machinegnostics"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.2"
|
|
8
8
|
description = "Machine Gnostics is an open-source initiative that seeks to redefine the mathematical underpinnings of machine learning. While most conventional ML libraries are grounded in probabilistic and statistical frameworks, Machine Gnostics explores alternative paradigms—drawing from Mathematical Gnostics, the non-statistical and deterministic approach. Laws of Nature, Encoded—For Everyone!"
|
|
9
9
|
|
|
10
10
|
readme = "README.md"
|
|
@@ -49,7 +49,9 @@ dependencies = [
|
|
|
49
49
|
"pandas",
|
|
50
50
|
"pydantic",
|
|
51
51
|
"scipy",
|
|
52
|
-
"SQLAlchemy"
|
|
52
|
+
"SQLAlchemy",
|
|
53
|
+
"xgboost",
|
|
54
|
+
"scikit-learn"
|
|
53
55
|
]
|
|
54
56
|
|
|
55
57
|
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Machine Gnostics: Robust Machine Learning with Gnostic Weights
|
|
3
|
+
================================================================
|
|
4
|
+
|
|
5
|
+
Machine Gnostics is a comprehensive framework for robust machine learning that
|
|
6
|
+
automatically handles outliers and noisy data through gnostic weight mechanisms.
|
|
7
|
+
|
|
8
|
+
Key Innovation:
|
|
9
|
+
---------------
|
|
10
|
+
The framework introduces **gnostic weights (gw)** that adaptively down-weight
|
|
11
|
+
outliers and poorly-fitting data points, leading to more robust models without
|
|
12
|
+
manual outlier detection or data preprocessing.
|
|
13
|
+
|
|
14
|
+
Main Components:
|
|
15
|
+
----------------
|
|
16
|
+
1. **Models**: Regression, classification, and clustering with gnostic weights
|
|
17
|
+
- LinearRegressor, PolynomialRegressor
|
|
18
|
+
- LogisticRegressor, MulticlassClassifier
|
|
19
|
+
- KMeansClustering
|
|
20
|
+
|
|
21
|
+
2. **Metrics**: Custom robust metrics and standard ML evaluation metrics
|
|
22
|
+
- Robust R² (robr2), standard metrics (MSE, MAE, RMSE, R²)
|
|
23
|
+
- Classification metrics (accuracy, precision, recall, F1)
|
|
24
|
+
- Gnostic-specific metrics (hc, gmmfe, divI, evalMet)
|
|
25
|
+
|
|
26
|
+
3. **Calibration (magcal)**: Gnostic weight computation and calibration
|
|
27
|
+
4. **Integration**: MLflow integration for experiment tracking
|
|
28
|
+
|
|
29
|
+
Quick Start:
|
|
30
|
+
------------
|
|
31
|
+
import machinegnostics as mg
|
|
32
|
+
|
|
33
|
+
# Direct metric access
|
|
34
|
+
r2 = mg.r2_score(y_true, y_pred)
|
|
35
|
+
acc = mg.accuracy_score(y_true, y_pred)
|
|
36
|
+
|
|
37
|
+
# Model usage
|
|
38
|
+
from machinegnostics.models import LinearRegressor
|
|
39
|
+
model = LinearRegressor()
|
|
40
|
+
model.fit(X, y)
|
|
41
|
+
|
|
42
|
+
# Clustering
|
|
43
|
+
from machinegnostics.models import KMeansClustering
|
|
44
|
+
kmeans = mg.models.KMeansClustering(n_clusters=3)
|
|
45
|
+
kmeans.fit(X)
|
|
46
|
+
|
|
47
|
+
Usage Patterns:
|
|
48
|
+
---------------
|
|
49
|
+
# Pattern 1: Direct function access
|
|
50
|
+
import machinegnostics as mg
|
|
51
|
+
result = mg.mean(data)
|
|
52
|
+
score = mg.robr2(y_true, y_pred)
|
|
53
|
+
|
|
54
|
+
# Pattern 2: Submodule access
|
|
55
|
+
from machinegnostics import models, metrics
|
|
56
|
+
model = models.LinearRegressor()
|
|
57
|
+
r2 = metrics.r2_score(y_true, y_pred)
|
|
58
|
+
|
|
59
|
+
# Pattern 3: Specific imports
|
|
60
|
+
from machinegnostics import robr2, KMeansClustering
|
|
61
|
+
|
|
62
|
+
Architecture:
|
|
63
|
+
-------------
|
|
64
|
+
- **models**: Machine learning models with gnostic weights
|
|
65
|
+
- **metrics**: Evaluation metrics (robust and standard)
|
|
66
|
+
- **magcal**: Calibration and gnostic weight computation
|
|
67
|
+
- **integration**: Third-party integrations (MLflow, etc.)
|
|
68
|
+
|
|
69
|
+
Notes:
|
|
70
|
+
------
|
|
71
|
+
- All models implement fit(), predict(), and score() methods
|
|
72
|
+
- Gnostic weights are computed automatically during training
|
|
73
|
+
- History tracking available for all iterative models
|
|
74
|
+
- Compatible with scikit-learn API conventions
|
|
75
|
+
|
|
76
|
+
References:
|
|
77
|
+
-----------
|
|
78
|
+
For more information on gnostic weights and the mathematical framework,
|
|
79
|
+
see the documentation and published papers.
|
|
80
|
+
|
|
81
|
+
Version: 1.0.0
|
|
82
|
+
Author: Machine Gnostics Team
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
# =============================================================================
|
|
86
|
+
# Core Metrics - Statistical Functions
|
|
87
|
+
# =============================================================================
|
|
88
|
+
# Basic statistical measures for data analysis
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
from .metrics.mean import mean
|
|
92
|
+
from .metrics.median import median
|
|
93
|
+
from .metrics.std import std
|
|
94
|
+
from .metrics.variance import variance
|
|
95
|
+
_STATS_AVAILABLE = True
|
|
96
|
+
except ImportError as e:
|
|
97
|
+
_STATS_AVAILABLE = False
|
|
98
|
+
_STATS_IMPORT_ERROR = str(e)
|
|
99
|
+
|
|
100
|
+
# =============================================================================
|
|
101
|
+
# Core Metrics - Covariance and Correlation
|
|
102
|
+
# =============================================================================
|
|
103
|
+
# Measures of relationship between variables
|
|
104
|
+
|
|
105
|
+
try:
|
|
106
|
+
from .metrics.auto_covariance import auto_covariance
|
|
107
|
+
from .metrics.cross_variance import cross_covariance
|
|
108
|
+
from .metrics.correlation import correlation
|
|
109
|
+
from .metrics.auto_correlation import auto_correlation
|
|
110
|
+
_COVAR_AVAILABLE = True
|
|
111
|
+
except ImportError as e:
|
|
112
|
+
_COVAR_AVAILABLE = False
|
|
113
|
+
_COVAR_IMPORT_ERROR = str(e)
|
|
114
|
+
|
|
115
|
+
# =============================================================================
|
|
116
|
+
# Regression Metrics
|
|
117
|
+
# =============================================================================
|
|
118
|
+
# Standard and robust metrics for regression evaluation
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
from .metrics.robr2 import robr2 # Robust R² (gnostic)
|
|
122
|
+
from .metrics.r2 import r2_score, adjusted_r2_score
|
|
123
|
+
from .metrics.mse import mean_squared_error
|
|
124
|
+
from .metrics.mae import mean_absolute_error
|
|
125
|
+
from .metrics.rmse import root_mean_squared_error
|
|
126
|
+
_REGRESSION_METRICS_AVAILABLE = True
|
|
127
|
+
except ImportError as e:
|
|
128
|
+
_REGRESSION_METRICS_AVAILABLE = False
|
|
129
|
+
_REGRESSION_METRICS_IMPORT_ERROR = str(e)
|
|
130
|
+
|
|
131
|
+
# =============================================================================
|
|
132
|
+
# Classification Metrics
|
|
133
|
+
# =============================================================================
|
|
134
|
+
# Standard metrics for classification evaluation
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
from .metrics.accuracy import accuracy_score
|
|
138
|
+
from .metrics.precision import precision_score
|
|
139
|
+
from .metrics.recall import recall_score
|
|
140
|
+
from .metrics.f1_score import f1_score
|
|
141
|
+
from .metrics.conf_matrix import confusion_matrix
|
|
142
|
+
from .metrics.cls_report import classification_report
|
|
143
|
+
_CLASSIFICATION_METRICS_AVAILABLE = True
|
|
144
|
+
except ImportError as e:
|
|
145
|
+
_CLASSIFICATION_METRICS_AVAILABLE = False
|
|
146
|
+
_CLASSIFICATION_METRICS_IMPORT_ERROR = str(e)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# =============================================================================
|
|
150
|
+
# Clustering Metrics
|
|
151
|
+
# =============================================================================
|
|
152
|
+
# Standard metrics for clustering evaluation
|
|
153
|
+
|
|
154
|
+
try:
|
|
155
|
+
from .metrics.silhouette_score import silhouette_score
|
|
156
|
+
_CLUSTERING_METRICS_AVAILABLE = True
|
|
157
|
+
except ImportError as e:
|
|
158
|
+
_CLUSTERING_METRICS_AVAILABLE = False
|
|
159
|
+
_CLUSTERING_METRICS_IMPORT_ERROR = str(e)
|
|
160
|
+
|
|
161
|
+
# =============================================================================
|
|
162
|
+
# Gnostic-Specific Metrics
|
|
163
|
+
# =============================================================================
|
|
164
|
+
# Custom metrics for gnostic model evaluation
|
|
165
|
+
|
|
166
|
+
try:
|
|
167
|
+
from .metrics.hc import hc # Harmonic characteristics
|
|
168
|
+
from .metrics.gmmfe import gmmfe # Gnostic model metric
|
|
169
|
+
from .metrics.divi import divI # Diversity index
|
|
170
|
+
from .metrics.evalmet import evalMet # Evaluation metric
|
|
171
|
+
from .metrics.entropy import entropy # Gnostic Entropy
|
|
172
|
+
_GNOSTIC_METRICS_AVAILABLE = True
|
|
173
|
+
except ImportError as e:
|
|
174
|
+
_GNOSTIC_METRICS_AVAILABLE = False
|
|
175
|
+
_GNOSTIC_METRICS_IMPORT_ERROR = str(e)
|
|
176
|
+
|
|
177
|
+
# =============================================================================
|
|
178
|
+
# Submodule Imports
|
|
179
|
+
# =============================================================================
|
|
180
|
+
# Import submodules for dot notation access (e.g., mg.models.LinearRegressor)
|
|
181
|
+
|
|
182
|
+
try:
|
|
183
|
+
from . import models
|
|
184
|
+
_MODELS_AVAILABLE = True
|
|
185
|
+
except ImportError as e:
|
|
186
|
+
_MODELS_AVAILABLE = False
|
|
187
|
+
_MODELS_IMPORT_ERROR = str(e)
|
|
188
|
+
|
|
189
|
+
try:
|
|
190
|
+
from . import metrics
|
|
191
|
+
_METRICS_MODULE_AVAILABLE = True
|
|
192
|
+
except ImportError as e:
|
|
193
|
+
_METRICS_MODULE_AVAILABLE = False
|
|
194
|
+
_METRICS_MODULE_IMPORT_ERROR = str(e)
|
|
195
|
+
|
|
196
|
+
try:
|
|
197
|
+
from . import magcal
|
|
198
|
+
_MAGCAL_AVAILABLE = True
|
|
199
|
+
except ImportError as e:
|
|
200
|
+
_MAGCAL_AVAILABLE = False
|
|
201
|
+
_MAGCAL_IMPORT_ERROR = str(e)
|
|
202
|
+
|
|
203
|
+
# =============================================================================
|
|
204
|
+
# Integration Support
|
|
205
|
+
# =============================================================================
|
|
206
|
+
# Third-party integrations (MLflow, etc.)
|
|
207
|
+
|
|
208
|
+
try:
|
|
209
|
+
from .integration import mlflow
|
|
210
|
+
_MLFLOW_AVAILABLE = True
|
|
211
|
+
except ImportError as e:
|
|
212
|
+
_MLFLOW_AVAILABLE = False
|
|
213
|
+
_MLFLOW_IMPORT_ERROR = str(e)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
# =============================================================================
|
|
217
|
+
# Public API Definition
|
|
218
|
+
# =============================================================================
|
|
219
|
+
|
|
220
|
+
__all__ = [
|
|
221
|
+
# Submodules
|
|
222
|
+
'models',
|
|
223
|
+
'metrics',
|
|
224
|
+
'magcal',
|
|
225
|
+
'mlflow',
|
|
226
|
+
|
|
227
|
+
# Statistical metrics
|
|
228
|
+
'mean',
|
|
229
|
+
'median',
|
|
230
|
+
'std',
|
|
231
|
+
'variance',
|
|
232
|
+
|
|
233
|
+
# Covariance/Correlation
|
|
234
|
+
'auto_covariance',
|
|
235
|
+
'cross_covariance',
|
|
236
|
+
'correlation',
|
|
237
|
+
'auto_correlation',
|
|
238
|
+
|
|
239
|
+
# Regression metrics
|
|
240
|
+
'robr2',
|
|
241
|
+
'r2_score',
|
|
242
|
+
'adjusted_r2_score',
|
|
243
|
+
'mean_squared_error',
|
|
244
|
+
'mean_absolute_error',
|
|
245
|
+
'root_mean_squared_error',
|
|
246
|
+
|
|
247
|
+
# Classification metrics
|
|
248
|
+
'accuracy_score',
|
|
249
|
+
'precision_score',
|
|
250
|
+
'recall_score',
|
|
251
|
+
'f1_score',
|
|
252
|
+
'confusion_matrix',
|
|
253
|
+
'classification_report',
|
|
254
|
+
|
|
255
|
+
# Gnostic metrics
|
|
256
|
+
'hc',
|
|
257
|
+
'gmmfe',
|
|
258
|
+
'divI',
|
|
259
|
+
'evalMet',
|
|
260
|
+
'entropy'
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
]
|
|
264
|
+
|
|
265
|
+
# =============================================================================
|
|
266
|
+
# Module Metadata
|
|
267
|
+
# =============================================================================
|
|
268
|
+
|
|
269
|
+
__author__ = 'Nirmal Parmar'
|
|
270
|
+
|
|
271
|
+
# check version with tomal file
|
|
272
|
+
__version__ = '0.0.2'
|
|
273
|
+
|
|
274
|
+
# =============================================================================
|
|
275
|
+
# Import Validation and Health Check
|
|
276
|
+
# =============================================================================
|
|
277
|
+
|
|
278
|
+
def _check_imports():
|
|
279
|
+
"""
|
|
280
|
+
Validate all imports and provide helpful diagnostics.
|
|
281
|
+
|
|
282
|
+
This function runs automatically on module import and warns about
|
|
283
|
+
any missing components while still allowing the module to function
|
|
284
|
+
with available components.
|
|
285
|
+
"""
|
|
286
|
+
import warnings
|
|
287
|
+
errors = []
|
|
288
|
+
|
|
289
|
+
# Check core functionality
|
|
290
|
+
if not _STATS_AVAILABLE:
|
|
291
|
+
errors.append(f"Statistical metrics unavailable: {_STATS_IMPORT_ERROR}")
|
|
292
|
+
|
|
293
|
+
if not _COVAR_AVAILABLE:
|
|
294
|
+
errors.append(f"Covariance/correlation metrics unavailable: {_COVAR_IMPORT_ERROR}")
|
|
295
|
+
|
|
296
|
+
if not _REGRESSION_METRICS_AVAILABLE:
|
|
297
|
+
errors.append(f"Regression metrics unavailable: {_REGRESSION_METRICS_IMPORT_ERROR}")
|
|
298
|
+
|
|
299
|
+
if not _CLASSIFICATION_METRICS_AVAILABLE:
|
|
300
|
+
errors.append(f"Classification metrics unavailable: {_CLASSIFICATION_METRICS_IMPORT_ERROR}")
|
|
301
|
+
|
|
302
|
+
if not _CLUSTERING_METRICS_AVAILABLE:
|
|
303
|
+
errors.append(f"Clustering metrics unavailable: {_CLUSTERING_METRICS_IMPORT_ERROR}")
|
|
304
|
+
|
|
305
|
+
if not _GNOSTIC_METRICS_AVAILABLE:
|
|
306
|
+
errors.append(f"Gnostic-specific metrics unavailable: {_GNOSTIC_METRICS_IMPORT_ERROR}")
|
|
307
|
+
|
|
308
|
+
# Check submodules
|
|
309
|
+
if not _MODELS_AVAILABLE:
|
|
310
|
+
errors.append(f"Models submodule unavailable: {_MODELS_IMPORT_ERROR}")
|
|
311
|
+
|
|
312
|
+
if not _METRICS_MODULE_AVAILABLE:
|
|
313
|
+
errors.append(f"Metrics submodule unavailable: {_METRICS_MODULE_IMPORT_ERROR}")
|
|
314
|
+
|
|
315
|
+
if not _MAGCAL_AVAILABLE:
|
|
316
|
+
errors.append(f"Magcal (calibration) submodule unavailable: {_MAGCAL_IMPORT_ERROR}")
|
|
317
|
+
|
|
318
|
+
# Check integrations (optional)
|
|
319
|
+
if not _MLFLOW_AVAILABLE:
|
|
320
|
+
# MLflow is optional, so just note it
|
|
321
|
+
pass
|
|
322
|
+
|
|
323
|
+
# Emit warnings if there are errors
|
|
324
|
+
if errors:
|
|
325
|
+
warning_msg = (
|
|
326
|
+
"Some Machine Gnostics components could not be imported:\n" +
|
|
327
|
+
"\n".join(f" - {err}" for err in errors) +
|
|
328
|
+
"\n\nThe module will function with reduced capabilities."
|
|
329
|
+
)
|
|
330
|
+
warnings.warn(warning_msg, ImportWarning, stacklevel=2)
|
|
331
|
+
|
|
332
|
+
def get_available_components():
|
|
333
|
+
"""
|
|
334
|
+
Return a dictionary showing which components are available.
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
337
|
+
--------
|
|
338
|
+
dict
|
|
339
|
+
Dictionary with component names as keys and availability status as values.
|
|
340
|
+
|
|
341
|
+
Example:
|
|
342
|
+
--------
|
|
343
|
+
>>> import machinegnostics as mg
|
|
344
|
+
>>> mg.get_available_components()
|
|
345
|
+
{'stats': True, 'models': True, 'metrics': True, ...}
|
|
346
|
+
"""
|
|
347
|
+
return {
|
|
348
|
+
'statistical_metrics': _STATS_AVAILABLE,
|
|
349
|
+
'covariance_correlation': _COVAR_AVAILABLE,
|
|
350
|
+
'regression_metrics': _REGRESSION_METRICS_AVAILABLE,
|
|
351
|
+
'classification_metrics': _CLASSIFICATION_METRICS_AVAILABLE,
|
|
352
|
+
'clustering_metrics': _CLUSTERING_METRICS_AVAILABLE,
|
|
353
|
+
'gnostic_metrics': _GNOSTIC_METRICS_AVAILABLE,
|
|
354
|
+
'models_submodule': _MODELS_AVAILABLE,
|
|
355
|
+
'metrics_submodule': _METRICS_MODULE_AVAILABLE,
|
|
356
|
+
'magcal_submodule': _MAGCAL_AVAILABLE,
|
|
357
|
+
'mlflow_integration': _MLFLOW_AVAILABLE,
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
# Run import validation
|
|
361
|
+
_check_imports()
|
|
362
|
+
|
|
363
|
+
# Add helper to __all__
|
|
364
|
+
__all__.append('get_available_components')
|
|
365
|
+
|
|
366
|
+
# Clean up namespace
|
|
367
|
+
del _check_imports
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# import datasets
|
|
2
|
+
from .anscombe_data import make_anscombe_check_data
|
|
3
|
+
from .moon_data import make_moons_check_data
|
|
4
|
+
from .reg_data import make_regression_check_data
|
|
5
|
+
from .stackloss_data import make_stackloss_check_data
|
|
6
|
+
from .cls_data import make_classification_check_data
|
|
7
|
+
from .forbes_data import make_forbes_check_data
|
|
8
|
+
from .animals_data import make_animals_check_data
|