diff --git a/docs/.buildinfo.bak b/.buildinfo similarity index 100% rename from docs/.buildinfo.bak rename to .buildinfo diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 8491816..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "Python 3", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", - "customizations": { - "codespaces": { - "openFiles": [ - "README.md", - "app.py" - ] - }, - "vscode": { - "settings": {}, - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance" - ] - } - }, - "updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y - diff --git a/README.md b/README.md deleted file mode 100644 index c776fc7..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Probabilistic-model -Fit various probabilistic models - -## Documentation -See documentation at: [Probabilistic-model](https://mohit-coder-droid.github.io/Probabilistic-model/) \ No newline at end of file diff --git a/docs/_images/exp_13_1.png b/_images/exp_12_1.png similarity index 100% rename from docs/_images/exp_13_1.png rename to _images/exp_12_1.png diff --git a/docs/_images/exp_14_0.png b/_images/exp_13_0.png similarity index 100% rename from docs/_images/exp_14_0.png rename to _images/exp_13_0.png diff --git a/_images/exp_13_1.png b/_images/exp_13_1.png new file mode 100644 index 0000000..5b925d7 Binary files /dev/null and b/_images/exp_13_1.png differ diff --git a/_images/exp_14_0.png b/_images/exp_14_0.png new file mode 100644 index 0000000..92430ea Binary files /dev/null and b/_images/exp_14_0.png differ diff --git a/docs/_images/exp_17_1.png b/_images/exp_16_1.png similarity index 100% rename from docs/_images/exp_17_1.png rename to _images/exp_16_1.png diff --git a/docs/_images/exp_18_0.png b/_images/exp_17_0.png similarity index 100% rename from docs/_images/exp_18_0.png rename to _images/exp_17_0.png diff --git a/_images/exp_17_1.png b/_images/exp_17_1.png new file mode 100644 index 0000000..4b9fe7d Binary files /dev/null and b/_images/exp_17_1.png differ diff --git a/_images/exp_18_0.png b/_images/exp_18_0.png new file mode 100644 index 0000000..3838c8f Binary files /dev/null and b/_images/exp_18_0.png differ diff --git a/docs/_images/exp_21_1.png b/_images/exp_20_1.png similarity index 100% rename from docs/_images/exp_21_1.png rename to _images/exp_20_1.png diff --git a/docs/_images/exp_22_0.png b/_images/exp_21_0.png similarity index 100% rename from docs/_images/exp_22_0.png rename to _images/exp_21_0.png diff --git a/_images/exp_21_1.png b/_images/exp_21_1.png new file mode 100644 index 0000000..7d3896e Binary files /dev/null and b/_images/exp_21_1.png differ diff --git a/_images/exp_22_0.png b/_images/exp_22_0.png new file mode 100644 index 0000000..5638f9b Binary files /dev/null and b/_images/exp_22_0.png differ diff --git a/docs/_images/exp_25_1.png b/_images/exp_24_1.png similarity index 100% rename from docs/_images/exp_25_1.png rename to _images/exp_24_1.png diff --git a/docs/_images/exp_26_0.png b/_images/exp_25_0.png similarity index 100% rename from docs/_images/exp_26_0.png rename to _images/exp_25_0.png diff --git a/_images/exp_25_1.png b/_images/exp_25_1.png new file mode 100644 index 0000000..25f347a Binary files /dev/null and b/_images/exp_25_1.png differ diff --git a/_images/exp_26_0.png b/_images/exp_26_0.png new file mode 100644 index 0000000..63cc45f Binary files /dev/null and b/_images/exp_26_0.png differ diff --git a/docs/_images/exp_29_1.png b/_images/exp_28_1.png similarity index 100% rename from docs/_images/exp_29_1.png rename to _images/exp_28_1.png diff --git a/docs/_images/exp_30_0.png b/_images/exp_29_0.png similarity index 100% rename from docs/_images/exp_30_0.png rename to _images/exp_29_0.png diff --git a/_images/exp_29_1.png b/_images/exp_29_1.png new file mode 100644 index 0000000..cf68a65 Binary files /dev/null and b/_images/exp_29_1.png differ diff --git a/_images/exp_30_0.png b/_images/exp_30_0.png new file mode 100644 index 0000000..7f64a02 Binary files /dev/null and b/_images/exp_30_0.png differ diff --git a/docs/_images/exp_33_1.png b/_images/exp_32_1.png similarity index 100% rename from docs/_images/exp_33_1.png rename to _images/exp_32_1.png diff --git a/docs/_images/exp_34_0.png b/_images/exp_33_0.png similarity index 100% rename from docs/_images/exp_34_0.png rename to _images/exp_33_0.png diff --git a/_images/exp_33_1.png b/_images/exp_33_1.png new file mode 100644 index 0000000..fca52fb Binary files /dev/null and b/_images/exp_33_1.png differ diff --git a/_images/exp_34_0.png b/_images/exp_34_0.png new file mode 100644 index 0000000..22a22fd Binary files /dev/null and b/_images/exp_34_0.png differ diff --git a/docs/_images/exp_37_1.png b/_images/exp_36_1.png similarity index 100% rename from docs/_images/exp_37_1.png rename to _images/exp_36_1.png diff --git a/docs/_images/exp_38_0.png b/_images/exp_37_0.png similarity index 100% rename from docs/_images/exp_38_0.png rename to _images/exp_37_0.png diff --git a/_images/exp_37_1.png b/_images/exp_37_1.png new file mode 100644 index 0000000..d7fdb07 Binary files /dev/null and b/_images/exp_37_1.png differ diff --git a/_images/exp_38_0.png b/_images/exp_38_0.png new file mode 100644 index 0000000..b122bb5 Binary files /dev/null and b/_images/exp_38_0.png differ diff --git a/docs/_images/exp_41_1.png b/_images/exp_40_1.png similarity index 100% rename from docs/_images/exp_41_1.png rename to _images/exp_40_1.png diff --git a/docs/_images/exp_42_0.png b/_images/exp_41_0.png similarity index 100% rename from docs/_images/exp_42_0.png rename to _images/exp_41_0.png diff --git a/_images/exp_41_1.png b/_images/exp_41_1.png new file mode 100644 index 0000000..73c6028 Binary files /dev/null and b/_images/exp_41_1.png differ diff --git a/_images/exp_42_0.png b/_images/exp_42_0.png new file mode 100644 index 0000000..5bd8f93 Binary files /dev/null and b/_images/exp_42_0.png differ diff --git a/docs/_images/exp_45_1.png b/_images/exp_44_1.png similarity index 100% rename from docs/_images/exp_45_1.png rename to _images/exp_44_1.png diff --git a/docs/_images/exp_46_0.png b/_images/exp_45_0.png similarity index 100% rename from docs/_images/exp_46_0.png rename to _images/exp_45_0.png diff --git a/_images/exp_45_1.png b/_images/exp_45_1.png new file mode 100644 index 0000000..b6cb093 Binary files /dev/null and b/_images/exp_45_1.png differ diff --git a/_images/exp_46_0.png b/_images/exp_46_0.png new file mode 100644 index 0000000..f24982a Binary files /dev/null and b/_images/exp_46_0.png differ diff --git a/docs/_images/exp_49_1.png b/_images/exp_48_1.png similarity index 100% rename from docs/_images/exp_49_1.png rename to _images/exp_48_1.png diff --git a/docs/_images/exp_50_0.png b/_images/exp_49_0.png similarity index 100% rename from docs/_images/exp_50_0.png rename to _images/exp_49_0.png diff --git a/_images/exp_49_1.png b/_images/exp_49_1.png new file mode 100644 index 0000000..520a764 Binary files /dev/null and b/_images/exp_49_1.png differ diff --git a/_images/exp_50_0.png b/_images/exp_50_0.png new file mode 100644 index 0000000..404ac59 Binary files /dev/null and b/_images/exp_50_0.png differ diff --git a/docs/_modules/app.html b/_modules/app.html similarity index 100% rename from docs/_modules/app.html rename to _modules/app.html diff --git a/docs/_modules/index.html b/_modules/index.html similarity index 97% rename from docs/_modules/index.html rename to _modules/index.html index 9bafcfe..4d72e0f 100644 --- a/docs/_modules/index.html +++ b/_modules/index.html @@ -10,7 +10,6 @@ - diff --git a/docs/_modules/probabilistic_model/probabilistic_models.html b/_modules/probabilistic_model/probabilistic_models.html similarity index 100% rename from docs/_modules/probabilistic_model/probabilistic_models.html rename to _modules/probabilistic_model/probabilistic_models.html diff --git a/docs/_modules/probabilistic_model/utils.html b/_modules/probabilistic_model/utils.html similarity index 100% rename from docs/_modules/probabilistic_model/utils.html rename to _modules/probabilistic_model/utils.html diff --git a/docs/_sources/Probabilistic_model.rst.txt b/_sources/Probabilistic_model.rst.txt similarity index 100% rename from docs/_sources/Probabilistic_model.rst.txt rename to _sources/Probabilistic_model.rst.txt diff --git a/docs/_sources/app.rst.txt b/_sources/app.rst.txt similarity index 100% rename from docs/_sources/app.rst.txt rename to _sources/app.rst.txt diff --git a/docs/_sources/exp.ipynb.txt b/_sources/exp.ipynb.txt similarity index 100% rename from docs/_sources/exp.ipynb.txt rename to _sources/exp.ipynb.txt diff --git a/docs/_sources/index.rst.txt b/_sources/index.rst.txt similarity index 100% rename from docs/_sources/index.rst.txt rename to _sources/index.rst.txt diff --git a/docs/_sources/modules.rst.txt b/_sources/modules.rst.txt similarity index 100% rename from docs/_sources/modules.rst.txt rename to _sources/modules.rst.txt diff --git a/docs/_sources/probabilistic_models.rst.txt b/_sources/probabilistic_models.rst.txt similarity index 100% rename from docs/_sources/probabilistic_models.rst.txt rename to _sources/probabilistic_models.rst.txt diff --git a/docs/_sources/utils.rst.txt b/_sources/utils.rst.txt similarity index 100% rename from docs/_sources/utils.rst.txt rename to _sources/utils.rst.txt diff --git a/docs/_static/_sphinx_javascript_frameworks_compat.js b/_static/_sphinx_javascript_frameworks_compat.js similarity index 100% rename from docs/_static/_sphinx_javascript_frameworks_compat.js rename to _static/_sphinx_javascript_frameworks_compat.js diff --git a/docs/_static/basic.css b/_static/basic.css similarity index 100% rename from docs/_static/basic.css rename to _static/basic.css diff --git a/docs/_static/css/badge_only.css b/_static/css/badge_only.css similarity index 100% rename from docs/_static/css/badge_only.css rename to _static/css/badge_only.css diff --git a/docs/_static/css/fonts/Roboto-Slab-Bold.woff b/_static/css/fonts/Roboto-Slab-Bold.woff similarity index 100% rename from docs/_static/css/fonts/Roboto-Slab-Bold.woff rename to _static/css/fonts/Roboto-Slab-Bold.woff diff --git a/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 b/_static/css/fonts/Roboto-Slab-Bold.woff2 similarity index 100% rename from docs/_static/css/fonts/Roboto-Slab-Bold.woff2 rename to _static/css/fonts/Roboto-Slab-Bold.woff2 diff --git a/docs/_static/css/fonts/Roboto-Slab-Regular.woff b/_static/css/fonts/Roboto-Slab-Regular.woff similarity index 100% rename from docs/_static/css/fonts/Roboto-Slab-Regular.woff rename to _static/css/fonts/Roboto-Slab-Regular.woff diff --git a/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 b/_static/css/fonts/Roboto-Slab-Regular.woff2 similarity index 100% rename from docs/_static/css/fonts/Roboto-Slab-Regular.woff2 rename to _static/css/fonts/Roboto-Slab-Regular.woff2 diff --git a/docs/_static/css/fonts/fontawesome-webfont.eot b/_static/css/fonts/fontawesome-webfont.eot similarity index 100% rename from docs/_static/css/fonts/fontawesome-webfont.eot rename to _static/css/fonts/fontawesome-webfont.eot diff --git a/docs/_static/css/fonts/fontawesome-webfont.svg b/_static/css/fonts/fontawesome-webfont.svg similarity index 100% rename from docs/_static/css/fonts/fontawesome-webfont.svg rename to _static/css/fonts/fontawesome-webfont.svg diff --git a/docs/_static/css/fonts/fontawesome-webfont.ttf b/_static/css/fonts/fontawesome-webfont.ttf similarity index 100% rename from docs/_static/css/fonts/fontawesome-webfont.ttf rename to _static/css/fonts/fontawesome-webfont.ttf diff --git a/docs/_static/css/fonts/fontawesome-webfont.woff b/_static/css/fonts/fontawesome-webfont.woff similarity index 100% rename from docs/_static/css/fonts/fontawesome-webfont.woff rename to _static/css/fonts/fontawesome-webfont.woff diff --git a/docs/_static/css/fonts/fontawesome-webfont.woff2 b/_static/css/fonts/fontawesome-webfont.woff2 similarity index 100% rename from docs/_static/css/fonts/fontawesome-webfont.woff2 rename to _static/css/fonts/fontawesome-webfont.woff2 diff --git a/docs/_static/css/fonts/lato-bold-italic.woff b/_static/css/fonts/lato-bold-italic.woff similarity index 100% rename from docs/_static/css/fonts/lato-bold-italic.woff rename to _static/css/fonts/lato-bold-italic.woff diff --git a/docs/_static/css/fonts/lato-bold-italic.woff2 b/_static/css/fonts/lato-bold-italic.woff2 similarity index 100% rename from docs/_static/css/fonts/lato-bold-italic.woff2 rename to _static/css/fonts/lato-bold-italic.woff2 diff --git a/docs/_static/css/fonts/lato-bold.woff b/_static/css/fonts/lato-bold.woff similarity index 100% rename from docs/_static/css/fonts/lato-bold.woff rename to _static/css/fonts/lato-bold.woff diff --git a/docs/_static/css/fonts/lato-bold.woff2 b/_static/css/fonts/lato-bold.woff2 similarity index 100% rename from docs/_static/css/fonts/lato-bold.woff2 rename to _static/css/fonts/lato-bold.woff2 diff --git a/docs/_static/css/fonts/lato-normal-italic.woff b/_static/css/fonts/lato-normal-italic.woff similarity index 100% rename from docs/_static/css/fonts/lato-normal-italic.woff rename to _static/css/fonts/lato-normal-italic.woff diff --git a/docs/_static/css/fonts/lato-normal-italic.woff2 b/_static/css/fonts/lato-normal-italic.woff2 similarity index 100% rename from docs/_static/css/fonts/lato-normal-italic.woff2 rename to _static/css/fonts/lato-normal-italic.woff2 diff --git a/docs/_static/css/fonts/lato-normal.woff b/_static/css/fonts/lato-normal.woff similarity index 100% rename from docs/_static/css/fonts/lato-normal.woff rename to _static/css/fonts/lato-normal.woff diff --git a/docs/_static/css/fonts/lato-normal.woff2 b/_static/css/fonts/lato-normal.woff2 similarity index 100% rename from docs/_static/css/fonts/lato-normal.woff2 rename to _static/css/fonts/lato-normal.woff2 diff --git a/docs/_static/css/theme.css b/_static/css/theme.css similarity index 100% rename from docs/_static/css/theme.css rename to _static/css/theme.css diff --git a/docs/_static/doctools.js b/_static/doctools.js similarity index 100% rename from docs/_static/doctools.js rename to _static/doctools.js diff --git a/docs/_static/documentation_options.js b/_static/documentation_options.js similarity index 100% rename from docs/_static/documentation_options.js rename to _static/documentation_options.js diff --git a/docs/_static/file.png b/_static/file.png similarity index 100% rename from docs/_static/file.png rename to _static/file.png diff --git a/docs/_static/fonts/Lato/lato-bold.eot b/_static/fonts/Lato/lato-bold.eot similarity index 100% rename from docs/_static/fonts/Lato/lato-bold.eot rename to _static/fonts/Lato/lato-bold.eot diff --git a/docs/_static/fonts/Lato/lato-bold.ttf b/_static/fonts/Lato/lato-bold.ttf similarity index 100% rename from docs/_static/fonts/Lato/lato-bold.ttf rename to _static/fonts/Lato/lato-bold.ttf diff --git a/docs/_static/fonts/Lato/lato-bold.woff b/_static/fonts/Lato/lato-bold.woff similarity index 100% rename from docs/_static/fonts/Lato/lato-bold.woff rename to _static/fonts/Lato/lato-bold.woff diff --git a/docs/_static/fonts/Lato/lato-bold.woff2 b/_static/fonts/Lato/lato-bold.woff2 similarity index 100% rename from docs/_static/fonts/Lato/lato-bold.woff2 rename to _static/fonts/Lato/lato-bold.woff2 diff --git a/docs/_static/fonts/Lato/lato-bolditalic.eot b/_static/fonts/Lato/lato-bolditalic.eot similarity index 100% rename from docs/_static/fonts/Lato/lato-bolditalic.eot rename to _static/fonts/Lato/lato-bolditalic.eot diff --git a/docs/_static/fonts/Lato/lato-bolditalic.ttf b/_static/fonts/Lato/lato-bolditalic.ttf similarity index 100% rename from docs/_static/fonts/Lato/lato-bolditalic.ttf rename to _static/fonts/Lato/lato-bolditalic.ttf diff --git a/docs/_static/fonts/Lato/lato-bolditalic.woff b/_static/fonts/Lato/lato-bolditalic.woff similarity index 100% rename from docs/_static/fonts/Lato/lato-bolditalic.woff rename to _static/fonts/Lato/lato-bolditalic.woff diff --git a/docs/_static/fonts/Lato/lato-bolditalic.woff2 b/_static/fonts/Lato/lato-bolditalic.woff2 similarity index 100% rename from docs/_static/fonts/Lato/lato-bolditalic.woff2 rename to _static/fonts/Lato/lato-bolditalic.woff2 diff --git a/docs/_static/fonts/Lato/lato-italic.eot b/_static/fonts/Lato/lato-italic.eot similarity index 100% rename from docs/_static/fonts/Lato/lato-italic.eot rename to _static/fonts/Lato/lato-italic.eot diff --git a/docs/_static/fonts/Lato/lato-italic.ttf b/_static/fonts/Lato/lato-italic.ttf similarity index 100% rename from docs/_static/fonts/Lato/lato-italic.ttf rename to _static/fonts/Lato/lato-italic.ttf diff --git a/docs/_static/fonts/Lato/lato-italic.woff b/_static/fonts/Lato/lato-italic.woff similarity index 100% rename from docs/_static/fonts/Lato/lato-italic.woff rename to _static/fonts/Lato/lato-italic.woff diff --git a/docs/_static/fonts/Lato/lato-italic.woff2 b/_static/fonts/Lato/lato-italic.woff2 similarity index 100% rename from docs/_static/fonts/Lato/lato-italic.woff2 rename to _static/fonts/Lato/lato-italic.woff2 diff --git a/docs/_static/fonts/Lato/lato-regular.eot b/_static/fonts/Lato/lato-regular.eot similarity index 100% rename from docs/_static/fonts/Lato/lato-regular.eot rename to _static/fonts/Lato/lato-regular.eot diff --git a/docs/_static/fonts/Lato/lato-regular.ttf b/_static/fonts/Lato/lato-regular.ttf similarity index 100% rename from docs/_static/fonts/Lato/lato-regular.ttf rename to _static/fonts/Lato/lato-regular.ttf diff --git a/docs/_static/fonts/Lato/lato-regular.woff b/_static/fonts/Lato/lato-regular.woff similarity index 100% rename from docs/_static/fonts/Lato/lato-regular.woff rename to _static/fonts/Lato/lato-regular.woff diff --git a/docs/_static/fonts/Lato/lato-regular.woff2 b/_static/fonts/Lato/lato-regular.woff2 similarity index 100% rename from docs/_static/fonts/Lato/lato-regular.woff2 rename to _static/fonts/Lato/lato-regular.woff2 diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot b/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot rename to _static/fonts/RobotoSlab/roboto-slab-v7-bold.eot diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf b/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf rename to _static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff b/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff rename to _static/fonts/RobotoSlab/roboto-slab-v7-bold.woff diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 b/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 rename to _static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot b/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot rename to _static/fonts/RobotoSlab/roboto-slab-v7-regular.eot diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf b/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf rename to _static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff b/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff rename to _static/fonts/RobotoSlab/roboto-slab-v7-regular.woff diff --git a/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 b/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 similarity index 100% rename from docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 rename to _static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 diff --git a/docs/_static/jquery.js b/_static/jquery.js similarity index 100% rename from docs/_static/jquery.js rename to _static/jquery.js diff --git a/docs/_static/js/badge_only.js b/_static/js/badge_only.js similarity index 100% rename from docs/_static/js/badge_only.js rename to _static/js/badge_only.js diff --git a/docs/_static/js/theme.js b/_static/js/theme.js similarity index 100% rename from docs/_static/js/theme.js rename to _static/js/theme.js diff --git a/docs/_static/js/versions.js b/_static/js/versions.js similarity index 100% rename from docs/_static/js/versions.js rename to _static/js/versions.js diff --git a/docs/_static/language_data.js b/_static/language_data.js similarity index 100% rename from docs/_static/language_data.js rename to _static/language_data.js diff --git a/docs/_static/minus.png b/_static/minus.png similarity index 100% rename from docs/_static/minus.png rename to _static/minus.png diff --git a/docs/_static/nbsphinx-broken-thumbnail.svg b/_static/nbsphinx-broken-thumbnail.svg similarity index 100% rename from docs/_static/nbsphinx-broken-thumbnail.svg rename to _static/nbsphinx-broken-thumbnail.svg diff --git a/docs/_static/nbsphinx-code-cells.css b/_static/nbsphinx-code-cells.css similarity index 100% rename from docs/_static/nbsphinx-code-cells.css rename to _static/nbsphinx-code-cells.css diff --git a/docs/_static/nbsphinx-gallery.css b/_static/nbsphinx-gallery.css similarity index 100% rename from docs/_static/nbsphinx-gallery.css rename to _static/nbsphinx-gallery.css diff --git a/docs/_static/nbsphinx-no-thumbnail.svg b/_static/nbsphinx-no-thumbnail.svg similarity index 100% rename from docs/_static/nbsphinx-no-thumbnail.svg rename to _static/nbsphinx-no-thumbnail.svg diff --git a/docs/_static/plus.png b/_static/plus.png similarity index 100% rename from docs/_static/plus.png rename to _static/plus.png diff --git a/docs/_static/pygments.css b/_static/pygments.css similarity index 100% rename from docs/_static/pygments.css rename to _static/pygments.css diff --git a/docs/_static/searchtools.js b/_static/searchtools.js similarity index 100% rename from docs/_static/searchtools.js rename to _static/searchtools.js diff --git a/docs/_static/sphinx_highlight.js b/_static/sphinx_highlight.js similarity index 100% rename from docs/_static/sphinx_highlight.js rename to _static/sphinx_highlight.js diff --git a/docs/app.html b/app.html similarity index 98% rename from docs/app.html rename to app.html index cc52d75..7646260 100644 --- a/docs/app.html +++ b/app.html @@ -11,7 +11,6 @@ - diff --git a/app.py b/app.py deleted file mode 100644 index c2f50c5..0000000 --- a/app.py +++ /dev/null @@ -1,295 +0,0 @@ -import streamlit as st -from probabilistic_model import * -import pandas as pd -import numpy as np -import matplotlib.pyplot as plt - -# --- Page Configuration --- -st.set_page_config(layout="wide", page_title="Probabilistic Model Fitter") - -# --- Main App Interface --- -st.title("Probabilistic Model Fitting ⚙️") -st.markdown("Upload your data, select the analysis type, map your data columns, and explore various probabilistic models.") - -# --- Sidebar for All User Controls --- -with st.sidebar: - st.header("Controls") - - global selected_files - selected_files = {} - - # 1. File Uploader - uploaded_files = st.file_uploader( - "Upload .xlsx or .csv files", - type=["xlsx", "csv"], - accept_multiple_files=True - ) - - if uploaded_files: - for uploaded_file in uploaded_files: - if st.checkbox(f"✔️ {uploaded_file.name}"): - selected_files[f"{uploaded_file.name}"] = pd.read_excel(uploaded_file) - -# --- Main Panel Logic --- -if not uploaded_files: - st.info("👈 Please upload one or more data files to get started.") - st.stop() - -def plot_different_cdf(model,cdf=[0.5,0.9,0.1,0.99,0.01]): - temperature_values = np.linspace(10, 600, 100) - fig, ax = plt.subplots(figsize=(10,6)) - - for (name,df) in selected_files.items(): - ax.scatter(df["Temperature"], df["Mpa"], edgecolors='black', alpha=0.7, s=30, label=f"{name}") - - if st.checkbox(f"✔️ Show Different CDF values", value=True, key=f"{model.name}_cdf_check"): - for i in range(len(cdf)): - ys_predicted_cdf = model.predict(cdf[i],temperature_values) - ax.plot(temperature_values, ys_predicted_cdf, linestyle="-", linewidth=1, label=f"Predicted YS (CDF={cdf[i]})") - - var_cdf = st.slider("Select CDF value", min_value=0.01, max_value=0.99, value=0.5, step=0.01, key=f"{model.name}_slider") - ys_predicted_cdf = model.predict(var_cdf, temperature_values) - ax.plot(temperature_values, ys_predicted_cdf, linestyle="-", linewidth=2, label=f"Predicted YS (Selected CDF={var_cdf})") - - ax.set_xlabel("Temperature (°C)", fontsize=12, fontweight="bold") - ax.set_ylabel("Yield Stress (YS)", fontsize=12, fontweight="bold") - ax.set_title("Yield Stress vs. Temperature Comparison", fontsize=14, fontweight="bold") - ax.legend() - st.pyplot(fig) - -def line_fit_plot(model,df_dict): - fig,ax = plt.subplots(figsize=(10, 6)) - - for temp in df_dict.keys(): - data = df_dict[temp]["Mpa"].values - data = np.sort(data) - - try: - sigma_values, ln_sigma_values,sigma_fit_log, y_fit = model.transform(data) - except: - sigma_values, ln_sigma_values,sigma_fit_log, y_fit = model.transform(data, temp) - - ax.scatter(sigma_values, ln_sigma_values, label=f"Temp {temp}") - ax.plot(sigma_fit_log, y_fit, linestyle='-') - - ax.set_title("Probability Plot with Fitted Line", fontsize=14, fontweight="bold") - ax.set_xlabel("ln(Data)", fontsize=12) - ax.set_ylabel(model.transform_y_label, fontsize=12) - ax.grid(True, linestyle='--', alpha=0.6) - ax.legend(fontsize=10) - st.pyplot(fig) - -def plot_different_cdf_two_var(predict, params,temperature,data,cdf=[0.5,0.9,0.1,0.99,0.01]): - fig, ax = plt.subplots(figsize=(8,6)) - - strain_values = np.linspace(0.002,0.020, 100) - temperature_values = np.ones_like(strain_values) * temperature - data = data[data['Temperature']==temperature] - - ax.scatter(data["Unnamed: 2"] ,data['Strain amplitude'], edgecolors='black', alpha=0.7, s=30, label=f"Vendor 1") - - for i in range(len(cdf)): - ys_predicted_cdf = predict(cdf[i],temperature_values, strain_values, params) - ax.plot( ys_predicted_cdf,strain_values, linestyle="-", linewidth=1, label=f"Predicted YS (CDF={cdf[i]})") - - ax.set_xscale('log') - ax.set_xlabel("Total Strain Amplitude", fontsize=12, fontweight="bold") - ax.set_ylabel("Normalized Failure Cycle", fontsize=12, fontweight="bold") - ax.set_title("For Temperature {}".format(temperature), fontsize=14, fontweight="bold") - ax.set_xlim(1e-3,1) - ax.legend() - st.pyplot(fig) - - -# --- Process Files and Get User Input --- -try: - # Read and combine all uploaded files into a single DataFrame - all_files = [pd.read_excel(file) if file.name.endswith('xlsx') else pd.read_csv(file) for file in uploaded_files] - data = pd.concat(all_files, ignore_index=True) - - # Get available column names for dropdowns - options = data.columns.tolist() - - with st.sidebar: - # 2. Data Preview - with st.expander("Preview Uploaded Data"): - st.dataframe(data.head()) - - # 3. Select Analysis Type - analysis_type = st.radio( - "Select Analysis Type:", - ("Yield Stress vs. Temperature", "Fatigue Life Analysis", "Fatigue Crack growth Analysis"), - help="Choose the type of model you want to fit based on your data." - ) - - # --- Column Selectors --- - st.header("Column Mapping") - - # --- CASE 1: Yield Stress vs. Temperature --- - if analysis_type == "Yield Stress vs. Temperature": - x_col = st.selectbox("Select the Temperature column (X-axis)", options, index=options.index('Temperature') if 'Temperature' in options else 0) - y_col = st.selectbox("Select the Yield Stress column (Y-axis)", options, index=options.index('Mpa') if 'Mpa' in options else 1) - - run_button = st.toggle("Run Analysis") - - # --- CASE 2: Fatigue Life Analysis --- - elif analysis_type == "Fatigue Life Analysis": - temp_col = st.selectbox("Select the Temperature column", options, index=options.index('Temperature') if 'Temperature' in options else 0) - strain_col = st.selectbox("Select the Strain Amplitude column", options, index=options.index('Strain amplitude') if 'Strain amplitude' in options else 1) - cycles_col = st.selectbox("Select the Failure Cycles column", options, index=options.index('Failure cycle') if 'Failure cycle' in options else 2) - - run_button = st.toggle("Run Fatigue Analysis") - - elif analysis_type == "Fatigue Crack growth Analysis": - temp_col = st.selectbox("Select the Temperature column", options, index=options.index('Temperature, C') if 'Temperature, C' in options else 0) - c_col = st.selectbox("Select c column", options, index=options.index('c ') if 'c ' in options else 0) - m_col = st.selectbox("Select m column", options, index=options.index('m') if 'm' in options else 0) - krange_col = st.selectbox("Select ▲ K Range column", options, index=options.index('▲ K Range') if '▲ K Range' in options else 0) - r_ratio_col = st.selectbox("Select R- Ratio column", options, index=options.index('R- Ratio') if 'R- Ratio' in options else 0) - - isLinear = st.selectbox("Regression Equation",["Linear","Arrhenius"],index=0) - - run_button = st.toggle("Run Fatigue Crack growth Analysis") - - -# --- Run Analysis and Display Results --- - if run_button: - st.header("📈 Model Results") - - # --- EXECUTE CASE 1 --- - if analysis_type == "Yield Stress vs. Temperature": - # Process data using selected columns - df, df_dict = df_processor(data, temp_col=x_col, stress_col=y_col) - X_values = df['Inverse_Temp'].values - Y_values = df['Mpa'].values - - # Fit various models (your predefined logic) - weibull = WeibullModel(X_values, Y_values) - lognormal = LognormalModel(X_values, Y_values) - weibull_p = WeibullModel(np.log(df[x_col].values), Y_values, power_law=True) - lognormal_p = LognormalModel(np.log(df[x_col].values), Y_values, power_law=True) - normal = NormalModel(X_values, Y_values) - weibull3 = WeibullModel3(X_values, Y_values) - lognormal3 = LognormalModel3(X_values, Y_values) - gumbell = Gumbell(X_values, Y_values) - expo = Exponential(X_values, Y_values) - gamma = Gamma(X_values, Y_values) - models = [weibull, lognormal, weibull_p, lognormal_p, normal, weibull3, lognormal3, gumbell, expo, gamma] - - # Display results in tabs (your predefined logic) - tab_models = st.tabs([m.tab_name for m in models]) - for i, tab in enumerate(tab_models): - with tab: - st.subheader(models[i].name) - plots = st.tabs(["Probability Line Fit Plot", "Yield Stress vs Temperature"]) - with plots[0]: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - line_fit_plot(models[i], df_dict) - with plots[1]: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - plot_different_cdf(models[i]) - - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - with st.container(border=True): - st.markdown(f"#### Model Details") - models[i].st_description - - # --- EXECUTE CASE 2 --- - elif analysis_type == "Fatigue Life Analysis": - data_lcf = data.copy() - data_lcf['Inverse_Temp'] = 11604.53 / (data_lcf[temp_col] + 273.16) - data_lcf['Ln_Strain'] = np.log(data_lcf[strain_col]) - diff_temp = data_lcf[temp_col].unique() - - # Fit various models (your predefined logic) - weibull = WeibullModel(data_lcf['Inverse_Temp'], data_lcf[cycles_col], data_lcf['Ln_Strain']) - lognormal = LognormalModel(data_lcf['Inverse_Temp'], data_lcf[cycles_col], data_lcf['Ln_Strain']) - normal = NormalModel(data_lcf['Inverse_Temp'], data_lcf[cycles_col], data_lcf[strain_col]) - expo = Exponential(data_lcf['Inverse_Temp'], data_lcf[cycles_col], data_lcf['Ln_Strain']) - gumbell = Gumbell(data_lcf['Inverse_Temp'], data_lcf[cycles_col], data_lcf['Ln_Strain']) - gamma = Gamma(data_lcf['Inverse_Temp'], data_lcf[cycles_col], data_lcf['Ln_Strain']) - models = [weibull, lognormal, normal, expo, gumbell, gamma] - - # Display results in tabs (your predefined logic) - tab_models = st.tabs([m.tab_name for m in models]) - for i, tab in enumerate(tab_models): - with tab: - st.subheader(models[i].name) - plots = st.tabs([f"Plots for Temp: {temp}°" for temp in diff_temp]) - for j, plot_tab in enumerate(plots): - with plot_tab: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - temp_data = data_lcf[data_lcf[temp_col] == diff_temp[j]] - params = models[i].minimize(models[i].bounds, (temp_data['Inverse_Temp'], temp_data[cycles_col], temp_data['Ln_Strain'])) - plot_different_cdf_two_var(models[i].two_var_predict, params, diff_temp[j], data_lcf) - - with st.container(border=True): - st.markdown(f"#### Model Details") - models[i].st_description - - elif analysis_type == "Fatigue Crack growth Analysis": - df = fatigue_crack_preprocess_df(data,temp_col, c_col, m_col, krange_col, r_ratio_col ) - walker = WalkerEq(df, isLinear=(isLinear=="Linear")) - # walker = WalkerEq(df, isLinear=False) - - tab_models = st.tabs(["Regression", "da_dN vs R", "da_dN vs ΔK", "da_dN vs Temperature"]) - - with tab_models[0]: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - op = ["Regression Plot","da/dN regression Plot","da/dN regression error Plot"] - walker_plot = st.selectbox("Select Plot",op) - - if walker_plot == op[0]: - walker.regression_plot(walker.slope_, walker.intercept_) - if walker_plot == op[1]: - walker.regression_dAdN_plot() - if walker_plot == op[2]: - walker.regression_dAdN_error_plot() - - with tab_models[1]: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - walker.plot_da_dN_vs_r_ratio_equation() - - with tab_models[2]: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - walker.plot_da_dN_vs_deltaK_equation() - - with tab_models[3]: - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - walker.plot_da_dN_vs_temperature_equation() - - row_space1 = st.columns( - (0.1, 0.7, 0.1) - ) - with row_space1[1]: - walker.st_description() - - -except Exception as e: - st.error(f"An error occurred during processing: {e}") - - st.exception(e) # This will show a full traceback for easier debugging diff --git a/docs/.buildinfo b/docs/.buildinfo deleted file mode 100644 index 6ae9c90..0000000 --- a/docs/.buildinfo +++ /dev/null @@ -1,4 +0,0 @@ -# Sphinx build info version 1 -# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 9a401bdcd317bc898cf20e845849dba8 -tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e69de29..0000000 diff --git a/docs/searchindex.js b/docs/searchindex.js deleted file mode 100644 index dfb6eba..0000000 --- a/docs/searchindex.js +++ /dev/null @@ -1 +0,0 @@ -Search.setIndex({"alltitles": {"API Reference:": [[3, null]], "Dataset Format": [[2, "Dataset-Format"]], "Exponential:": [[2, "Exponential:"]], "Fitting various probability models": [[2, null]], "Gamma": [[2, "Gamma"]], "Gumbell Model:": [[2, "Gumbell-Model:"]], "LogNormal (3-Parameters)": [[2, "LogNormal-(3-Parameters)"]], "LogNormal Model": [[2, "LogNormal-Model"]], "Lognormal (Power Law)": [[2, "Lognormal-(Power-Law)"]], "Module contents": [[0, "module-probabilistic_model"]], "Normal Model:": [[2, "Normal-Model:"]], "Plot Utils": [[2, "Plot-Utils"]], "Probabilistic Models": [[3, null]], "Probabilistic-model": [[4, null]], "Submodules": [[0, "submodules"]], "Tutorials": [[3, null]], "Weibull (3-Parameters)": [[2, "Weibull-(3-Parameters)"]], "Weibull (Power Law)": [[2, "Weibull-(Power-Law)"]], "Weibull Model": [[2, "Weibull-Model"]], "app module": [[1, null]], "probabilistic_model package": [[0, null]], "probabilistic_model.app module": [[0, "probabilistic-model-app-module"]], "probabilistic_model.probabilistic_models module": [[0, "probabilistic-model-probabilistic-models-module"]], "probabilistic_model.utils module": [[0, "probabilistic-model-utils-module"]], "probabilistic_models module": [[5, null]], "utils module": [[6, null]]}, "docnames": ["Probabilistic_model", "app", "exp", "index", "modules", "probabilistic_models", "utils"], "envversion": {"nbsphinx": 4, "sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1}, "filenames": ["Probabilistic_model.rst", "app.rst", "exp.ipynb", "index.rst", "modules.rst", "probabilistic_models.rst", "utils.rst"], "indexentries": {"app": [[1, "module-app", false]], "arrhenius_walker_regr() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.arrhenius_walker_regr", false]], "df_processor() (in module probabilistic_model.utils)": [[6, "probabilistic_model.utils.df_processor", false]], "estimate_params() (probabilistic_model.probabilistic_models.exponential static method)": [[5, "probabilistic_model.probabilistic_models.Exponential.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.gamma static method)": [[5, "probabilistic_model.probabilistic_models.Gamma.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.gumbell static method)": [[5, "probabilistic_model.probabilistic_models.Gumbell.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.lognormalmodel static method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.lognormalmodel3 static method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.normalmodel static method)": [[5, "probabilistic_model.probabilistic_models.NormalModel.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.weibullmodel static method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel.estimate_params", false]], "estimate_params() (probabilistic_model.probabilistic_models.weibullmodel3 static method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3.estimate_params", false]], "exponential (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.Exponential", false]], "fatigue_crack_preprocess_df() (in module probabilistic_model.utils)": [[6, "probabilistic_model.utils.fatigue_crack_preprocess_df", false]], "gamma (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.Gamma", false]], "gumbell (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.Gumbell", false]], "implement_paris_eq() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.implement_paris_eq", false]], "implement_walker_eq() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.implement_walker_eq", false]], "lin_reg() (probabilistic_model.probabilistic_models.walkereq static method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.lin_reg", false]], "line_fit_plot() (in module app)": [[1, "app.line_fit_plot", false]], "linear_walker_regr() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.linear_walker_regr", false]], "log_likelihood() (probabilistic_model.probabilistic_models.exponential method)": [[5, "probabilistic_model.probabilistic_models.Exponential.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.gamma method)": [[5, "probabilistic_model.probabilistic_models.Gamma.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.gumbell method)": [[5, "probabilistic_model.probabilistic_models.Gumbell.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.lognormalmodel method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.lognormalmodel3 method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.normalmodel method)": [[5, "probabilistic_model.probabilistic_models.NormalModel.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.probmodel method)": [[5, "probabilistic_model.probabilistic_models.ProbModel.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.weibullmodel method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel.log_likelihood", false]], "log_likelihood() (probabilistic_model.probabilistic_models.weibullmodel3 method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3.log_likelihood", false]], "lognormalmodel (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.LognormalModel", false]], "lognormalmodel3 (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3", false]], "median_rank() (in module probabilistic_model.utils)": [[6, "probabilistic_model.utils.median_rank", false]], "minimize() (probabilistic_model.probabilistic_models.lognormalmodel3 method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3.minimize", false]], "minimize() (probabilistic_model.probabilistic_models.probmodel method)": [[5, "probabilistic_model.probabilistic_models.ProbModel.minimize", false]], "minimize() (probabilistic_model.probabilistic_models.weibullmodel3 method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3.minimize", false]], "module": [[0, "module-probabilistic_model", false], [1, "module-app", false], [5, "module-probabilistic_model.probabilistic_models", false], [6, "module-probabilistic_model.utils", false]], "normalmodel (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.NormalModel", false]], "plot_da_dn_vs_deltak_equation() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.plot_da_dN_vs_deltaK_equation", false]], "plot_da_dn_vs_r_ratio_equation() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.plot_da_dN_vs_r_ratio_equation", false]], "plot_da_dn_vs_temperature_equation() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.plot_da_dN_vs_temperature_equation", false]], "plot_different_cdf() (in module app)": [[1, "app.plot_different_cdf", false]], "plot_different_cdf_two_var() (in module app)": [[1, "app.plot_different_cdf_two_var", false]], "power_st_description() (probabilistic_model.probabilistic_models.probmodel method)": [[5, "probabilistic_model.probabilistic_models.ProbModel.power_st_description", false]], "predict() (probabilistic_model.probabilistic_models.exponential method)": [[5, "probabilistic_model.probabilistic_models.Exponential.predict", false]], "predict() (probabilistic_model.probabilistic_models.gamma method)": [[5, "probabilistic_model.probabilistic_models.Gamma.predict", false]], "predict() (probabilistic_model.probabilistic_models.gumbell method)": [[5, "probabilistic_model.probabilistic_models.Gumbell.predict", false]], "predict() (probabilistic_model.probabilistic_models.lognormalmodel method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel.predict", false]], "predict() (probabilistic_model.probabilistic_models.lognormalmodel3 method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3.predict", false]], "predict() (probabilistic_model.probabilistic_models.normalmodel method)": [[5, "probabilistic_model.probabilistic_models.NormalModel.predict", false]], "predict() (probabilistic_model.probabilistic_models.probmodel method)": [[5, "probabilistic_model.probabilistic_models.ProbModel.predict", false]], "predict() (probabilistic_model.probabilistic_models.weibullmodel method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel.predict", false]], "predict() (probabilistic_model.probabilistic_models.weibullmodel3 method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3.predict", false]], "probabilistic_model": [[0, "module-probabilistic_model", false]], "probabilistic_model.probabilistic_models": [[5, "module-probabilistic_model.probabilistic_models", false]], "probabilistic_model.utils": [[6, "module-probabilistic_model.utils", false]], "probmodel (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.ProbModel", false]], "regression_dadn_error_plot() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.regression_dAdN_error_plot", false]], "regression_dadn_plot() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.regression_dAdN_plot", false]], "regression_plot() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.regression_plot", false]], "regression_walker_eq() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.regression_walker_eq", false]], "st_description (probabilistic_model.probabilistic_models.exponential property)": [[5, "probabilistic_model.probabilistic_models.Exponential.st_description", false]], "st_description (probabilistic_model.probabilistic_models.gamma property)": [[5, "probabilistic_model.probabilistic_models.Gamma.st_description", false]], "st_description (probabilistic_model.probabilistic_models.gumbell property)": [[5, "probabilistic_model.probabilistic_models.Gumbell.st_description", false]], "st_description (probabilistic_model.probabilistic_models.lognormalmodel property)": [[5, "probabilistic_model.probabilistic_models.LognormalModel.st_description", false]], "st_description (probabilistic_model.probabilistic_models.lognormalmodel3 property)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3.st_description", false]], "st_description (probabilistic_model.probabilistic_models.normalmodel property)": [[5, "probabilistic_model.probabilistic_models.NormalModel.st_description", false]], "st_description (probabilistic_model.probabilistic_models.weibullmodel property)": [[5, "probabilistic_model.probabilistic_models.WeibullModel.st_description", false]], "st_description (probabilistic_model.probabilistic_models.weibullmodel3 property)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3.st_description", false]], "st_description() (probabilistic_model.probabilistic_models.probmodel method)": [[5, "probabilistic_model.probabilistic_models.ProbModel.st_description", false]], "st_description() (probabilistic_model.probabilistic_models.walkereq method)": [[5, "probabilistic_model.probabilistic_models.WalkerEq.st_description", false]], "transform() (probabilistic_model.probabilistic_models.exponential method)": [[5, "probabilistic_model.probabilistic_models.Exponential.transform", false]], "transform() (probabilistic_model.probabilistic_models.gamma method)": [[5, "probabilistic_model.probabilistic_models.Gamma.transform", false]], "transform() (probabilistic_model.probabilistic_models.gumbell method)": [[5, "probabilistic_model.probabilistic_models.Gumbell.transform", false]], "transform() (probabilistic_model.probabilistic_models.lognormalmodel method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel.transform", false]], "transform() (probabilistic_model.probabilistic_models.lognormalmodel3 method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel3.transform", false]], "transform() (probabilistic_model.probabilistic_models.normalmodel method)": [[5, "probabilistic_model.probabilistic_models.NormalModel.transform", false]], "transform() (probabilistic_model.probabilistic_models.weibullmodel method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel.transform", false]], "transform() (probabilistic_model.probabilistic_models.weibullmodel3 method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3.transform", false]], "two_var_predict() (probabilistic_model.probabilistic_models.exponential method)": [[5, "probabilistic_model.probabilistic_models.Exponential.two_var_predict", false]], "two_var_predict() (probabilistic_model.probabilistic_models.gamma method)": [[5, "probabilistic_model.probabilistic_models.Gamma.two_var_predict", false]], "two_var_predict() (probabilistic_model.probabilistic_models.gumbell method)": [[5, "probabilistic_model.probabilistic_models.Gumbell.two_var_predict", false]], "two_var_predict() (probabilistic_model.probabilistic_models.lognormalmodel method)": [[5, "probabilistic_model.probabilistic_models.LognormalModel.two_var_predict", false]], "two_var_predict() (probabilistic_model.probabilistic_models.normalmodel method)": [[5, "probabilistic_model.probabilistic_models.NormalModel.two_var_predict", false]], "two_var_predict() (probabilistic_model.probabilistic_models.weibullmodel method)": [[5, "probabilistic_model.probabilistic_models.WeibullModel.two_var_predict", false]], "walkereq (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.WalkerEq", false]], "weibullmodel (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.WeibullModel", false]], "weibullmodel3 (class in probabilistic_model.probabilistic_models)": [[5, "probabilistic_model.probabilistic_models.WeibullModel3", false]]}, "objects": {"": [[1, 0, 0, "-", "app"], [0, 0, 0, "-", "probabilistic_model"]], "app": [[1, 1, 1, "", "line_fit_plot"], [1, 1, 1, "", "plot_different_cdf"], [1, 1, 1, "", "plot_different_cdf_two_var"]], "probabilistic_model": [[5, 0, 0, "-", "probabilistic_models"], [6, 0, 0, "-", "utils"]], "probabilistic_model.probabilistic_models": [[5, 2, 1, "", "Exponential"], [5, 2, 1, "", "Gamma"], [5, 2, 1, "", "Gumbell"], [5, 2, 1, "", "LognormalModel"], [5, 2, 1, "", "LognormalModel3"], [5, 2, 1, "", "NormalModel"], [5, 2, 1, "", "ProbModel"], [5, 2, 1, "", "WalkerEq"], [5, 2, 1, "", "WeibullModel"], [5, 2, 1, "", "WeibullModel3"]], "probabilistic_model.probabilistic_models.Exponential": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.Gamma": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.Gumbell": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.LognormalModel": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.LognormalModel3": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "minimize"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"]], "probabilistic_model.probabilistic_models.NormalModel": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.ProbModel": [[5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "minimize"], [5, 3, 1, "", "power_st_description"], [5, 3, 1, "", "predict"], [5, 3, 1, "", "st_description"]], "probabilistic_model.probabilistic_models.WalkerEq": [[5, 3, 1, "", "arrhenius_walker_regr"], [5, 3, 1, "", "implement_paris_eq"], [5, 3, 1, "", "implement_walker_eq"], [5, 3, 1, "", "lin_reg"], [5, 3, 1, "", "linear_walker_regr"], [5, 3, 1, "", "plot_da_dN_vs_deltaK_equation"], [5, 3, 1, "", "plot_da_dN_vs_r_ratio_equation"], [5, 3, 1, "", "plot_da_dN_vs_temperature_equation"], [5, 3, 1, "", "regression_dAdN_error_plot"], [5, 3, 1, "", "regression_dAdN_plot"], [5, 3, 1, "", "regression_plot"], [5, 3, 1, "", "regression_walker_eq"], [5, 3, 1, "", "st_description"]], "probabilistic_model.probabilistic_models.WeibullModel": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.WeibullModel3": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "minimize"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"]], "probabilistic_model.utils": [[6, 1, 1, "", "df_processor"], [6, 1, 1, "", "fatigue_crack_preprocess_df"], [6, 1, 1, "", "median_rank"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "method", "Python method"], "4": ["py", "property", "Python property"]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:method", "4": "py:property"}, "terms": {"": [2, 6], "0": [1, 2], "01": [1, 2], "0233": 2, "0241": 2, "0242": 2, "0253": 2, "0386": 2, "0387": 2, "0439": 2, "0584": 2, "1": [1, 2], "10": 2, "100": 2, "11": 2, "11604": 2, "12": 2, "13": 2, "14": 2, "15": 2, "16": 2, "17": 2, "176": 2, "18": 2, "19": 2, "1938": 2, "1950": 2, "2": 2, "20": 2, "2116": 2, "2186": 2, "22": 2, "23": 2, "233": 2, "2357539701": 2, "24": 2, "246": 2, "2584": 2, "26": 2, "273": 2, "3": [3, 5], "30": 2, "37": 2, "38": 2, "39": 2, "4": 2, "433": 2, "4442": 2, "45": 2, "46": 2, "4686": 2, "4714": 2, "4732": 2, "4825": 2, "4f": 2, "5": [1, 2], "52": 2, "53": 2, "5455": 2, "56": 2, "57": 2, "5750": 2, "6": 2, "600": 2, "7": 2, "7048": 2, "72": 2, "73": 2, "74": 2, "7600": 2, "78": 2, "79": 2, "8": 2, "80": 2, "83": 2, "8564": 2, "8574": 2, "8598": 2, "8613": 2, "8982": 2, "9": [1, 2], "9026": 2, "9860": 2, "9896": 2, "99": [1, 2], "To": 5, "_continuous_distn": 2, "_method": 2, "abc": 5, "abstract": 5, "acceler": 5, "accord": 5, "add": 3, "alpha": 2, "app": [3, 4, 6], "appdata": 2, "append": 2, "ar": 5, "ar_cdf": 5, "arg": 5, "arrai": 5, "arrhenius_walker_regr": [4, 5], "articl": 2, "ascend": 2, "ax": 2, "base": 5, "basic": 6, "benard": 6, "black": 2, "bold": 2, "bound": 5, "c": 2, "c_col": 6, "cannot": 2, "cdf": [1, 2, 5], "class": 5, "com": 2, "comparison": 2, "comput": 6, "content": 3, "convert": 2, "core": 2, "cumul": 6, "d": 2, "data": [1, 2, 5], "datafram": 6, "dataset": 3, "def": 2, "default": 5, "delta": 2, "deploy": 2, "descript": 5, "detail": 3, "determin": 5, "df": [2, 5, 6], "df_1": 2, "df_2": 2, "df_dict": [1, 2], "df_processor": [2, 4, 6], "dict": 6, "document": 3, "drop": 2, "dtype": 5, "edgecolor": 2, "encount": 2, "equat": 5, "erdo\u011fan": 5, "estimate_param": [4, 5], "except": 2, "exp": 2, "exponenti": [3, 4, 5], "f": 2, "fals": 5, "fatigue_cdf": 5, "fatigue_crack_preprocess_df": [4, 6], "fig": 2, "figsiz": 2, "figur": 2, "figurecanvasagg": 2, "fit": [3, 5], "float": [5, 6], "float64": 5, "fontsiz": 2, "fontweight": 2, "format": 3, "formula": 6, "from": 2, "function": 6, "gamma": [3, 4, 5], "gb": 2, "give": 5, "given": 5, "gm": 2, "grid": 2, "gumbel": [3, 4, 5], "have": 2, "here": 2, "http": 2, "i": [2, 6], "implement": 5, "implement_paris_eq": [4, 5], "implement_walker_eq": [4, 5], "import": 2, "interact": 2, "intercept": [2, 5], "inverse_temp": 2, "ipykernel_18124": 2, "ipykernel_18340": 2, "ipykernel_25556": 2, "islinear": 5, "k": [2, 5], "kei": 2, "kelvin": 2, "krange_col": 6, "kwarg": 5, "l": 5, "label": 2, "law": 3, "legend": 2, "len": 2, "lib": 2, "likelihood": 5, "lin_reg": [4, 5], "line": 2, "line_fit_plot": [1, 2, 4], "linear_walker_regr": [4, 5], "linestyl": 2, "linewidth": 2, "linspac": 2, "list": 5, "lm": 2, "ln": 2, "ln_mpa": 2, "ln_sigma_valu": 2, "lnm": 2, "local": 2, "log": [2, 5], "log_likelihood": [4, 5], "lognorm": [3, 5], "lognormalmodel": [2, 4, 5], "lognormalmodel3": [2, 4, 5], "m": [2, 5], "m_col": 6, "median": 6, "median_rank": [4, 6], "minim": [4, 5], "model": [1, 5], "modul": [3, 4], "mohit": 2, "mpa": 2, "multipli": 2, "n": 6, "name": 2, "ndarrai": 5, "need": 5, "neg": 5, "non": 2, "normal": [3, 5], "normalmodel": [2, 4, 5], "np": [2, 5], "numpi": 2, "object": 5, "out": 2, "overflow": 2, "packag": 2, "paper": 2, "param": [1, 5], "paramet": [3, 5], "pari": 5, "path": 2, "paul": 2, "pd": 2, "pdf": 5, "pii": 2, "plot": 3, "plot_da_dn_vs_deltak_equ": [4, 5], "plot_da_dn_vs_r_ratio_equ": [4, 5], "plot_da_dn_vs_temperature_equ": [4, 5], "plot_different_cdf": [1, 2, 4], "plot_different_cdf_two_var": [1, 4], "plt": 2, "pow": 2, "power": 3, "power_law": [2, 5], "power_st_descript": [4, 5], "predict": [1, 2, 4, 5], "print": 2, "probabilistic_model": [2, 3, 4, 6], "probabl": [3, 6], "probmodel": [4, 5], "process": 6, "program": 2, "project": 2, "properti": 5, "py": 2, "python": 2, "python311": 2, "quantil": 2, "r_ratio_col": 6, "rang": 2, "rank": 6, "re_cdf": 5, "read_excel": 2, "regression_dadn_error_plot": [4, 5], "regression_dadn_plot": [4, 5], "regression_plot": [4, 5], "regression_walker_eq": [4, 5], "reset_index": 2, "restructuredtext": 3, "return": [2, 5, 6], "runtimewarn": 2, "s2666359721000378": 2, "sc": 2, "scale": [2, 5], "scatter": 2, "scienc": 2, "sciencedirect": 2, "scipi": 2, "see": 3, "set_titl": 2, "set_xlabel": 2, "set_ylabel": 2, "shape": [2, 5], "show": 2, "shown": 2, "sigma": [2, 5], "sigma_fit_log": 2, "sigma_valu": [2, 5], "site": 2, "slope": [2, 5], "sort": 2, "sort_valu": 2, "sourc": [1, 5, 6], "st_descript": [4, 5], "standard": 2, "stat": 2, "static": 5, "strain": 5, "strain_valu": 5, "streamlit": [5, 6], "stress": 2, "stress_col": 6, "studi": 2, "subplot": 2, "sum": 5, "sy": 2, "syntax": 3, "temp": [2, 5], "temp_col": 6, "temperatur": [1, 2], "temperature_valu": [2, 5], "thi": 5, "thu": 2, "tight_layout": 2, "titl": 2, "train": 5, "transform": [2, 4, 5], "true": [2, 5], "try": 2, "tupl": 6, "two": 5, "two_var_predict": [4, 5], "type": [5, 6], "u": [2, 5], "um": 2, "uniqu": 2, "us": [2, 3, 5, 6], "user": 2, "userwarn": 2, "util": [3, 4], "v": [2, 5], "valu": [2, 5], "variabl": 5, "variable_valu": 5, "variou": 3, "vendor": 2, "w": [2, 5], "walkereq": [4, 5], "wb": 2, "wb3": 2, "we": 2, "websit": 5, "weibul": [3, 5], "weibullmodel": [2, 4, 5], "weibullmodel3": [2, 4, 5], "when": 5, "www": 2, "x": [2, 5], "x_valu": [2, 5], "x_values2": 5, "xlabel": 2, "xlogi": 2, "y": [2, 5], "y_fit": 2, "y_valu": [2, 5], "yield": 2, "ylabel": 2, "your": 3, "ys_predicted_cdf": 2, "yup": 2}, "titles": ["probabilistic_model package", "app module", "Fitting various probability models", "Probabilistic Models", "Probabilistic-model", "probabilistic_models module", "utils module"], "titleterms": {"3": 2, "api": 3, "app": [0, 1], "content": 0, "dataset": 2, "exponenti": 2, "fit": 2, "format": 2, "gamma": 2, "gumbel": 2, "law": 2, "lognorm": 2, "model": [2, 3, 4], "modul": [0, 1, 5, 6], "normal": 2, "packag": 0, "paramet": 2, "plot": 2, "power": 2, "probabilist": [3, 4], "probabilistic_model": [0, 5], "probabl": 2, "refer": 3, "submodul": 0, "tutori": 3, "util": [0, 2, 6], "variou": 2, "weibul": 2}}) \ No newline at end of file diff --git a/docs/exp.html b/exp.html similarity index 99% rename from docs/exp.html rename to exp.html index 811d4fc..b129bef 100644 --- a/docs/exp.html +++ b/exp.html @@ -12,7 +12,6 @@ - diff --git a/docs/exp.ipynb b/exp.ipynb similarity index 100% rename from docs/exp.ipynb rename to exp.ipynb diff --git a/docs/genindex.html b/genindex.html similarity index 99% rename from docs/genindex.html rename to genindex.html index cd8371e..f3bf62c 100644 --- a/docs/genindex.html +++ b/genindex.html @@ -10,7 +10,6 @@ - diff --git a/docs/index.html b/index.html similarity index 98% rename from docs/index.html rename to index.html index f2fa90f..b0d1452 100644 --- a/docs/index.html +++ b/index.html @@ -11,7 +11,6 @@ - diff --git a/docs/modules.html b/modules.html similarity index 99% rename from docs/modules.html rename to modules.html index 22d79e2..fec2f00 100644 --- a/docs/modules.html +++ b/modules.html @@ -11,7 +11,6 @@ - diff --git a/docs/objects.inv b/objects.inv similarity index 100% rename from docs/objects.inv rename to objects.inv diff --git a/probabilistic_model/__init__.py b/probabilistic_model/__init__.py deleted file mode 100644 index bf0d111..0000000 --- a/probabilistic_model/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .probabilistic_models import * -from .utils import * \ No newline at end of file diff --git a/probabilistic_model/__pycache__/__init__.cpython-311.pyc b/probabilistic_model/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index b89af03..0000000 Binary files a/probabilistic_model/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/probabilistic_model/__pycache__/probabilistic_models.cpython-311.pyc b/probabilistic_model/__pycache__/probabilistic_models.cpython-311.pyc deleted file mode 100644 index 815a2d1..0000000 Binary files a/probabilistic_model/__pycache__/probabilistic_models.cpython-311.pyc and /dev/null differ diff --git a/probabilistic_model/__pycache__/utils.cpython-311.pyc b/probabilistic_model/__pycache__/utils.cpython-311.pyc deleted file mode 100644 index a423b40..0000000 Binary files a/probabilistic_model/__pycache__/utils.cpython-311.pyc and /dev/null differ diff --git a/probabilistic_model/probabilistic_models.py b/probabilistic_model/probabilistic_models.py deleted file mode 100644 index b74b6d3..0000000 --- a/probabilistic_model/probabilistic_models.py +++ /dev/null @@ -1,1862 +0,0 @@ -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import scipy.stats as stats -from scipy.special import erfinv -from abc import ABC, abstractmethod -from scipy.optimize import differential_evolution -from sklearn.linear_model import LinearRegression -from sklearn.metrics import mean_squared_error -from scipy import optimize # to be deleted later on -from .utils import median_rank -import streamlit as st - -class ProbModel(ABC): - @abstractmethod - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain:np.ndarray=np.array([])): - pass - - def minimize(self, bounds, args)->np.ndarray: - result_regression = differential_evolution( - self.log_likelihood, - args=args, - bounds=bounds, - ) - - return result_regression.x - - @abstractmethod - def predict(self): - pass - - def power_st_description(self, cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values): - st.header("📋 Mathematical Formulation") - - # CDF Section - st.subheader("1. Cumulative Distribution Function (CDF)") - st.markdown(""" - The CDF of this model is given by: - """) - st.latex(cdf) - - # PDF Section - st.subheader("2. Probability Density Function (PDF)") - st.markdown(""" - The PDF of this model can be expressed as: - """) - st.latex(pdf) - - # Rearranged equation - st.subheader("3. Rearranged CDF") - st.markdown(""" - Equation (1) can be rearranged as: - """) - st.latex(re_cdf) - - # Arrhenius equation - st.subheader("4. Power Law Relationship") - st.markdown(""" - Using Power law equation in Equation (3): - """) - st.latex(ar_cdf) - - # Final fatigue life prediction model - st.subheader("5. Fatigue Life Prediction Model") - st.markdown(""" - The complete fatigue life prediction model can be presented as: - """) - st.latex(fatigue_cdf) - - st.subheader("Variable Values") - st.markdown("In the case of data given, values of the variables are") - st.markdown(variable_values) - - def st_description(self, cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values): - st.header("📋 Mathematical Formulation") - - # CDF Section - st.subheader("1. Cumulative Distribution Function (CDF)") - st.markdown(""" - The CDF of this model is given by: - """) - st.latex(cdf) - - # PDF Section - st.subheader("2. Probability Density Function (PDF)") - st.markdown(""" - The PDF of this model can be expressed as: - """) - st.latex(pdf) - - # Rearranged equation - st.subheader("3. Rearranged CDF") - st.markdown(""" - Equation (1) can be rearranged as: - """) - st.latex(re_cdf) - - # Arrhenius equation - st.subheader("4. Arrhenius Relationship") - st.markdown(""" - Using Arrhenius equation in Equation (3): - """) - st.latex(ar_cdf) - - # Final fatigue life prediction model - st.subheader("5. Fatigue Life Prediction Model") - st.markdown(""" - The complete fatigue life prediction model can be presented as: - """) - st.latex(fatigue_cdf) - - st.subheader("Variable Values") - st.markdown("In the case of data given, values of the variables are") - st.markdown(variable_values) - -class WeibullModel(ProbModel): - def __init__(self,X_values:np.ndarray, Y_values:np.ndarray,X_values2:np.ndarray=np.array([]), power_law:bool=False)->None: - """Initializes Weibull Probabilistic Model - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - X_values2 (np.ndarray, optional): Second accelerating variable (Strain). Defaults to np.array([]). - power_law (bool, optional):Whether to use power law or not. Defaults to False, which means that we will use Arrhenius equation instead of power law. - """ - self.X_values = X_values - self.X_values2 = X_values2 - self.Y_values = Y_values - self.name = "Weibull Model" - self.tab_name = "Weibull" - self.power_law = power_law - if power_law: - self.name = "Weibull Model With Power Law" - self.tab_name = "Weibull (Power)" - - # Figure out the parameters - self.two_var = False - if len(X_values2): - # self.init_params = [2.0,-1, np.log(np.mean(self.Y_values)), -3.0] - self.bounds = [(1e-6, 20), (-20, 20),(-20, 20), (-20, 20)] - self.name = "Weibull Model With Two variables" - self.two_var = True - - self.shape, self.intercept, self.slope, self.v = self.minimize(self.bounds, args=(self.X_values, self.Y_values, self.X_values2)) - else: - # init_params = [2.0, np.log(np.mean(self.Y_values)), 0.0] - bounds = [(1e-6, 30), (-10, 10), (-10, 10)] - - self.shape, self.intercept, self.slope = self.minimize( bounds, args=(self.X_values, self.Y_values)) - - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain:np.ndarray=np.array([])): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - strain(np.ndarray): Defaults to np.array([]). - - Returns: - Gives a negative sum of log likelihood for given data - """ - shape = params[0] - u = params[1] - w = params[2] - - if shape <= 0: - return np.inf - - if self.two_var: - v = params[3] - scale = np.exp(u + w * temp + v * strain) - else: - scale = np.exp(u + w * temp) - - return -np.sum(stats.weibull_min.logpdf(sigma_values, c=shape, scale=scale)) - - def predict(self,cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray=np.array([]))->np.ndarray: - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - if self.power_law: - return np.exp( - (self.intercept + (self.slope * np.log(temperature_values))) + - ((1 / self.shape) * np.log(np.log(1 / (1 - cdf)))) - ) - - elif self.two_var: - return np.exp( - (self.intercept + (self.slope * 11604.53 / (temperature_values + 273.16)) + self.v * np.log(strain_values)) + - ((1 / self.shape) * np.log(np.log(1 / (1 - cdf)))) - ) / 1000000 - - return np.exp( - (self.intercept + (self.slope * 11604.53 / (temperature_values + 273.16))) + - ((1 / self.shape) * np.log(np.log(1 / (1 - cdf)))) - ) - - def two_var_predict(self, cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray, params:np.ndarray) -> np.ndarray: - """To predict values when there are two accelerating variables - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray) - params (np.ndarray): Parameters that will be needed to predict values \n\n `shape, intercept, slope, v = params`. \n - """ - shape, intercept, slope, v = params - return np.exp( - (intercept + (slope * 11604.53 / (temperature_values + 273.16)) + v * np.log(strain_values)) + - ((1 / shape) * np.log(np.log(1 / (1 - cdf)))) - ) / 1000000 - - @staticmethod - def estimate_params(data:np.ndarray, **kwargs): - """Fit a weibull model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted weibull model - """ - shape, loc, scale = stats.weibull_min.fit(data, floc=0, **kwargs) - return shape, scale - - def transform(self, data:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # Apply Weibull probability plot transformation - sigma_values = np.log(data) # X-axis: ln(data) - wb_sigma_values = np.log(-np.log(1 - cdf_values)) # Y-axis: ln(-ln(1 - p)) - - shape, scale = self.estimate_params(data, f0=self.shape) - - # Generate fitted Weibull line - sigma_line = np.linspace(min(data), max(data), 100) - pred_sigma_line = np.log(-np.log(1 - stats.weibull_min.cdf(sigma_line, shape, scale=scale))) - - self.transform_y_label = "ln(-ln(1 - p))" # name to be displayed in the y-axis of the graph - - return sigma_values, wb_sigma_values, np.log(sigma_line), pred_sigma_line - - @property - def st_description(self): - """Description of this model to be used in the streamlit website""" - cdf = r""" - f_w = 1 - exp\left(-\left(\frac{\sigma_f}{\sigma_m}\right)^m\right) \quad \text{...(1)} - """ - - pdf = r""" - F_w = \left(\frac{m}{\sigma_m}\right)\left(\frac{\sigma_f}{\sigma_m}\right)^{m-1}exp\left(-\left(\frac{\sigma_f}{\sigma_m}\right)^m\right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = exp\left(ln(\sigma_m)+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right) \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = exp\left(\biggl\{U_t+\frac{W_t}{T}\biggl\}+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = exp\left(\biggl\{U_t+\frac{W_t}{T}+Vln(\epsilon)\biggl\}+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right) \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $m$ | {self.shape:.6f} | - """ - - if self.two_var: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $V_t$ | {self.v:.6f} | - | $m$ | {self.shape:.6f} | - """ - - if self.power_law: - ar_cdf = r""" - \sigma_f = exp\left(\biggl\{U_t+W_t ln(T)\biggl\}+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = exp\left(\biggl\{U_t++W_t ln(T)+Vln(\epsilon)\biggl\}+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right) \quad \text{...(5)} - """ - - super().power_st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - else: - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class NormalModel(ProbModel): - def __init__(self, X_values:np.ndarray, Y_values:np.ndarray, X_values2:np.ndarray=np.array([])): - """Initializes Normal Probabilistic Model - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - X_values2 (np.ndarray, optional): Second accelerating variable (Strain). Defaults to np.array([]). - """ - - self.X_values = X_values - self.X_values2 = X_values2 - self.Y_values = Y_values - self.name = "Normal Model" - self.tab_name = "Normal" - - self.two_var = False - if len(X_values2): - self.name = "Normal Model With Two variables" - self.two_var = True - self.bounds = [(1e-6, 100000),(-100000, 100000), (-100000, 100000), (-100000, 100000)] - - self.sigma, self.intercept, self.slope, self.q = self.minimize(self.bounds, args=(self.X_values, self.Y_values, self.X_values2)) - else: - self.bounds = [(1e-6, 30),(-300, 300), (-20, 20), (-300, 300)] - self.sigma, self.intercept, self.slope,_ = self.minimize(self.bounds, args=(self.X_values, self.Y_values)) - - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain:np.ndarray=np.array([])): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - strain(np.ndarray): Defaults to np.array([]). - - Returns: - Gives a negative sum of log likelihood for given data - """ - sigma = params[0] - k = params[1] - m = params[2] - - if sigma <= 0: - return np.inf # Avoid invalid sigma - - if self.two_var: - l = params[3] - mu = k + m * temp + l*strain - else: - mu = k + m * temp - log_likelihood = np.sum(stats.norm.logpdf(sigma_values, loc=mu, scale=sigma)) - - return -log_likelihood - - def predict(self,cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray=np.array([])): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - z = np.sqrt(2) * self.sigma * erfinv(2 * cdf - 1) - if self.two_var: - return self.intercept + (self.slope * 11604.53) / (temperature_values + 273.16) + self.q * np.log(strain_values) + z - return self.intercept + (self.slope * 11604.53) / (temperature_values + 273.16) + z - - def two_var_predict(self, cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray, params:np.ndarray) -> np.ndarray: - """To predict values when there are two accelerating variables - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray) - params (np.ndarray): Parameters that will be needed to predict values \n\n `sigma, k, m, l= params`. \n - """ - sigma, k, m, l = params - z = np.sqrt(2) * sigma * erfinv(2 * cdf - 1) - return np.exp(k + (m * 11604.53) / (temperature_values + 273.16) + l * np.log(strain_values) + z) / 1000000 - - @staticmethod - def estimate_params(data:np.ndarray): - """Fit a normal model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted normal model - """ - mu, sigma = np.mean(data), np.std(data, ddof=0) - return mu, sigma - - def transform(self,data:np.ndarray, temp:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # X-axis: ln(data), Y-axis: inverse CDF of normal - sigma_values = data - pred_sigma_values = stats.norm.ppf(cdf_values) # Normal Quantile - - inverse_temp = 11604.53 / (temp + 273.16) - mu = self.intercept + self.slope * inverse_temp - - # Generate fitted line - sigma_line = np.linspace(min(data), max(data), 100) - pred_sigma_line = stats.norm.ppf(stats.norm.cdf(sigma_line, loc=mu,scale=self.sigma)) - - self.transform_y_label = "Standard Normal Quantile" - - return sigma_values, pred_sigma_values, sigma_line, pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_n = \frac{1}{2} + \frac{1}{2} \, \text{erf} \left( \frac{\sigma_f - \sigma_m}{\sqrt{2} \sigma_{sl}} \right) \quad \text{...(1)} - """ - - pdf = r""" - F_n = \frac{1}{\sigma_{sl} \sqrt{2\pi}} \exp\left( -\left(\frac{\sigma_f - \sigma_m}{\sqrt{2}\sigma_{sl}}\right)^2 \right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = \sigma_m + \sigma_{sl} \sqrt{2} \, \text{erf}^{-1}(2f_n - 1) \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = \left( P_t + \frac{R_t}{T} \right) + \left( \sigma_{sl} \sqrt{2} \, \text{erf}^{-1}(2f_n - 1) \right) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = \left( P_t + Q_t \ln(\epsilon) + \frac{R_t}{T} \right) + \left( \sigma_{sl} \sqrt{2} \, \text{erf}^{-1}(2f_n - 1) \right) \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $P_t$ | {self.intercept} | - | $R_t$ | {self.slope} | - | $\sigma_{{sl}}$ | {self.slope} | - """ - - if self.two_var: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $P_t$ | {self.intercept} | - | $R_t$ | {self.slope} | - | $Q_t$ | {self.q} | - | $\sigma_{{sl}}$ | {self.slope} | - """ - - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class LognormalModel(ProbModel): - def __init__(self,X_values:np.ndarray, Y_values:np.ndarray,X_values2:np.ndarray=np.array([]), power_law:bool=False)->None: - """Initializes LogNormal Probabilistic Model - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - X_values2 (np.ndarray, optional): Second accelerating variable (Strain). Defaults to np.array([]). - power_law (bool, optional):Whether to use power law or not. Defaults to False, which means that we will use Arrhenius equation instead of power law. - """ - self.X_values = X_values - self.X_values2 = X_values2 - self.Y_values = Y_values - self.name = "LogNormal Model" - self.tab_name = "LogNormal" - self.power_law = power_law - if power_law: - self.name = "LogNormal Model With Power Law" - self.tab_name = "LogNormal (Power)" - - self.two_var = False - if len(X_values2): - self.name = "LogNormal Model With Two variables" - self.two_var = True - - self.bounds = [(-20, 20),(-20, 20),(1e-6, 20), (-20, 20)] - self.k, self.m, self.sigma, self.l = self.minimize(self.bounds, args=(self.X_values, self.Y_values, self.X_values2)) - else: - self.bounds = [(-20, 20),(-20, 20), (1e-10, 20)] - self.k, self.m, self.sigma = self.minimize(self.bounds, args=(self.X_values, self.Y_values)) - - - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain:np.ndarray=np.array([])): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - strain(np.ndarray): Defaults to np.array([]). - - Returns: - Gives a negative sum of log likelihood for given data - """ - k = params[0] - m = params[1] - sigma = params[2] - if sigma <= 0: - return np.inf # Avoid invalid sigma - - if self.two_var: - l = params[3] - mu = k + m * temp + l*strain - else: - mu = k + m * temp - - log_likelihood = np.sum(stats.norm.logpdf(np.log(sigma_values), loc=mu, scale=sigma) - np.log(sigma_values)) - return -log_likelihood - - def predict(self,cdf:float, temperature_values:np.ndarray, strain_values = np.array([])): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - z = np.sqrt(2) * self.sigma * erfinv(2 * cdf - 1) - if self.power_law: - return np.exp(self.k + self.m * np.log(temperature_values) + z) - - elif self.two_var: - return np.exp(self.k + (self.m * 11604.53) / (temperature_values + 273.16) + self.l * np.log(strain_values) + z) / 1000000 - return np.exp(self.k + (self.m * 11604.53) / (temperature_values + 273.16) + z) - - def two_var_predict(self, cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray, params:np.ndarray) -> np.ndarray: - """To predict values when there are two accelerating variables - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray) - params (np.ndarray): Parameters that will be needed to predict values \n\n `k, m, sigma, l= params`. \n - """ - k, m, sigma, l = params - z = np.sqrt(2) * sigma * erfinv(2 * cdf - 1) - return np.exp(k + (m * 11604.53) / (temperature_values + 273.16) + l * np.log(strain_values) + z) / 1000000 - - @staticmethod - def estimate_params(data:np.ndarray): - """Fit a Lognormal model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted Lognormal model - """ - log_data = np.log(data) - mu, sigma = np.mean(log_data), np.std(log_data, ddof=0) - return mu, sigma - - def transform(self,data:np.ndarray, temp:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # X-axis: ln(data), Y-axis: inverse CDF of normal - sigma_values = np.log(data) - pred_sigma_values = stats.lognorm.ppf(cdf_values, s=self.sigma) # log(Normal quantile) - - # Generate fitted line - sigma_line = np.linspace(min(data), max(data), 100) - inverse_temp = 11604.53 / (temp + 273.16) - median = np.exp(self.k + self.m * inverse_temp) - - if self.power_law: - median = np.exp(self.k + self.m * np.log(temp)) - - pred_sigma_line = stats.lognorm.ppf(stats.lognorm.cdf(sigma_line, s=self.sigma, scale=median), s=self.sigma) - self.transform_y_label = "Standard Normal Quantile" - - return sigma_values, pred_sigma_values, np.log(sigma_line), pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_{ln} = \frac{1}{2} + \frac{1}{2} \, \text{erf} \left[ \frac{\ln(\sigma_f) - \ln(\sigma_m)}{\sqrt{2} \sigma_{sl}} \right] \quad \text{...(1)} - """ - - pdf = r""" - F_{ln} = \frac{1}{(\sigma_f) \sigma_{sl} \sqrt{2\pi}} \exp\left( -\left( \frac{\ln(\sigma_f) - \ln(\sigma_m)}{\sqrt{2} \sigma_{sl}} \right)^2 \right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = \exp \left( \ln(\sigma_m) + \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right) \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = \exp \left( \left\{ K_t + \frac{M_t}{T} \right\} + \left\{ \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right\} \right) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = \exp \left( \left\{ K_t + L \ln(\epsilon) + \frac{M_t}{T} \right\} + \left\{ \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right\} \right) \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $K_t$ | {self.k:.6f} | - | $M_t$ | {self.m:.6f} | - | $\sigma{{sl}}$ | {self.sigma:.6f} | - """ - - if self.two_var: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $K_t$ | {self.k:.6f} | - | $M_t$ | {self.m:.6f} | - | $L_t$ | {self.l:.6f} | - | $\sigma{{sl}}$ | {self.sigma:.6f} | - """ - - if self.power_law: - ar_cdf = r""" - \sigma_f = \exp \left( \left\{ K_t + M_t ln(T) \right\} + \left\{ \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right\} \right) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = \exp \left( \left\{ K_t + L \ln(\epsilon) + M_t ln(T) \right\} + \left\{ \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right\} \right) \quad \text{...(5)} - """ - - super().power_st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - else: - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class WeibullModel3(ProbModel): - def __init__(self,X_values:np.ndarray, Y_values:np.ndarray): - """Initializes Weibull Probabilistic Model with 3 parameters - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - """ - self.X_values = X_values - self.Y_values = Y_values - self.name = "3-Parameter Weibull Model" - self.tab_name = "3-Parameter Weibull" - self.minimize() - - def log_likelihood(self, params:list,temp:np.ndarray, sigma_values:np.ndarray): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - - Returns: - Gives a negative sum of log likelihood for given data - """ - shape = params[0] - u = params[1] - w = params[2] - loc = params[3] - - if shape <= 0 or np.any(self.Y_values - loc <= 0): - return np.inf - scale = np.exp(u + w * temp) - - return -np.sum(stats.weibull_min.logpdf(sigma_values-loc, c=shape, scale=scale)) - - def minimize(self): - init_params = [2.0, np.log(np.mean(self.Y_values)), 0.0, np.min(self.Y_values) * 0.9] - bounds = [(1e-6, None), (None, None), (None, None), (None, np.min(self.Y_values) - 1e-6)] - - rng = np.random.default_rng(seed=212) - perm = rng.permutation(len(self.X_values)) - - result_regression = optimize.minimize( - self.log_likelihood, - init_params, - args=(self.X_values[perm], self.Y_values[perm]), - bounds=bounds, - method='L-BFGS-B' - ) - - self.shape, self.intercept, self.slope,self.delta = result_regression.x - - def predict(self,cdf:float, temperature_values:np.ndarray): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - - Returns: - Predict values according to the trained model - """ - return np.exp( - (self.intercept + (self.slope * 11604.53 / (temperature_values + 273.16))) + - ((1 / self.shape) * np.log(np.log(1 / (1 - cdf)))) - ) + self.delta - - @staticmethod - def estimate_params(data:np.ndarray, **kwargs): - """Fit a weibull 3-parameter model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted weibull 3-parameter model - """ - shape, loc, scale = stats.weibull_min.fit(data, **kwargs) # Lock location to 0 for typical Weibull fitting - return shape, scale, loc - - def transform(self, data:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - shape, scale,loc = self.estimate_params(data, f0=self.shape) - - # Apply Weibull probability plot transformation - sigma_values = np.log(data-loc) # X-axis: ln(data) - wb_sigma_values = np.log(-np.log(1 - cdf_values)) # Y-axis: ln(-ln(1 - p)) - - # Generate fitted Weibull line - sigma_line = np.linspace(min(data), max(data), 100) - pred_sigma_line = np.log(-np.log(1 - stats.weibull_min.cdf(sigma_line, shape, scale=scale,loc=loc))) - - self.transform_y_label = "ln(-ln(1 - p))" # name to be displayed in the y-axis of the graph - - return sigma_values, wb_sigma_values, np.log(sigma_line - loc), pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_w = 1 - exp\left(-\left(\frac{\sigma_f - \delta}{\sigma_m}\right)^m\right) \quad \text{...(1)} - """ - - pdf = r""" - F_w = \left(\frac{m}{\sigma_m}\right)\left(\frac{\sigma_f - \delta}{\sigma_m}\right)^{m-1}exp\left(-\left(\frac{\sigma_f - \delta}{\sigma_m}\right)^m\right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = exp\left(ln(\sigma_m)+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right)+\delta \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = exp\left(\biggl\{U_t+\frac{W_t}{T}\biggl\}+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right)+\delta \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = exp\left(\biggl\{U_t+\frac{W_t}{T}+Vln(\epsilon)\biggl\}+\frac{1}{m}ln\left(ln\left(\frac{1}{1-f_w}\right)\right)\right)+\delta \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $m$ | {self.shape:.6f} | - | $\delta$ | {self.delta:.6f} | - """ - - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class LognormalModel3(ProbModel): - def __init__(self, X_values:np.ndarray, Y_values:np.ndarray): - """Initializes LogNormal Probabilistic Model with 3 parameters - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - """ - self.X_values = X_values - self.Y_values = Y_values - self.name = "3-Parameter LogNormal Model" - self.tab_name = "3-Parameter LogNormal" - - self.minimize() - - def log_likelihood(self, params:list,temp:np.ndarray, sigma_values:np.ndarray): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - - Returns: - Gives a negative sum of log likelihood for given data - """ - k,m, sigma,gamma = params - if sigma <= 0: - return np.inf # Avoid invalid sigma - - mu = k + m * temp - log_likelihood = np.sum(stats.norm.logpdf(np.log(sigma_values-gamma), loc=mu, scale=sigma) - np.log(sigma_values)) - return -log_likelihood - - def minimize(self): - init_params = [10, 1,1,1] - bounds = [(None, None),(None, None), (1e-10, None),(None, None)] # mu unbounded, sigma > 0 - result_lognormal = optimize.minimize( - self.log_likelihood, - init_params, - args=(self.X_values, self.Y_values,), - method='L-BFGS-B', - bounds=bounds - ) - - self.k, self.m, self.sigma,self.gamma = result_lognormal.x - - def predict(self,cdf:float, temperature_values:np.ndarray): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - z = np.sqrt(2) * self.sigma * erfinv(2 * cdf - 1) - return np.exp(self.k + (self.m * 11604.53) / (temperature_values + 273.16) + z) + self.gamma - - @staticmethod - def estimate_params(data:np.ndarray): - """Fit a lognormal 3-parameter model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted lognormal 3-parameter model - """ - log_data = np.log(data) - mu, sigma = np.mean(log_data), np.std(log_data, ddof=0) - return mu, sigma - - def transform(self,data:np.ndarray, temp:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # X-axis: ln(data), Y-axis: inverse CDF of normal - sigma_values = np.log(data) - pred_sigma_values = stats.lognorm.ppf(cdf_values, s=self.sigma) # log(Normal quantile) - - inverse_temp = 11604.53 / (temp + 273.16) - median = np.exp(self.k + self.m * inverse_temp) - - # Generate fitted line - sigma_line = np.linspace(min(data), max(data), 100) - self.gamma - pred_sigma_line = stats.lognorm.ppf(stats.lognorm.cdf(sigma_line, scale=median, s=self.sigma),s=self.sigma) - - self.transform_y_label = "Standard Normal Quantile" - - return sigma_values, pred_sigma_values, np.log(sigma_line), pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_{ln} = \frac{1}{2} + \frac{1}{2} \, \text{erf} \left[ \frac{\ln(\sigma_f-\gamma) - \ln(\sigma_m)}{\sqrt{2} \sigma_{sl}} \right] \quad \text{...(1)} - """ - - pdf = r""" - F_{ln} = \frac{1}{(\sigma_f-\gamma) \sigma_{sl} \sqrt{2\pi}} \exp\left( -\left( \frac{\ln(\sigma_f-\gamma) - \ln(\sigma_m)}{\sqrt{2} \sigma_{sl}} \right)^2 \right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = \exp \left( \ln(\sigma_m) + \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right)+\gamma \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = \exp \left( \left\{ K_t + \frac{M_t}{T} \right\} + \left\{ \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right\} \right)+\gamma \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = \exp \left( \left\{ K_t + L \ln(\epsilon) + \frac{M_t}{T} \right\} + \left\{ \sqrt{2} \, \sigma_{sl} \, \text{erf}^{-1}(2f_{ln} - 1) \right\} \right)+\gamma \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $K_t$ | {self.k:.6f} | - | $M_t$ | {self.m:.6f} | - | $\sigma_{{sl}}$ | {self.sigma:.6f} | - | $\gamma$ | {self.gamma:.6f} | - """ - - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class Gumbell(ProbModel): - def __init__(self,X_values:np.ndarray, Y_values:np.ndarray,X_values2:np.ndarray=np.array([])): - """Initializes Gumbell Probabilistic Model - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - X_values2 (np.ndarray, optional): Second accelerating variable (Strain). Defaults to np.array([]). - """ - self.X_values = X_values - self.X_values2 = X_values2 - self.Y_values = Y_values - self.name = "Gumbell Model" - self.tab_name = "Gumbell" - - self.two_var = False - if len(X_values2): - # self.init_params = [2.0,-1, np.log(np.mean(self.Y_values)), -3.0] - self.bounds = [(-100000, 100000),(-100000, 100000),(1e-6, 100000), (-100000, 100000)] - self.name = "Gumbell Model With Two variables" - self.two_var = True - - self.intercept, self.slope,self.scale, self.v = self.minimize(self.bounds, args=(self.X_values, self.Y_values, self.X_values2)) - else: - # init_params = [2.0, np.log(np.mean(self.Y_values)), 0.0] - bounds = [(-20, 400), (-20, 20), (1e-6, 30)] - - self.intercept, self.slope,self.scale = self.minimize( bounds, args=(self.X_values, self.Y_values)) - - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain_values=np.array([])): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - strain(np.ndarray): Defaults to np.array([]). - - Returns: - Gives a negative sum of log likelihood for given data - """ - u = params[0] # Intercept - w = params[1] # Slope - scale = params[2] # Scale - - if scale <= 0: - return np.inf - - if self.two_var: - v = params[3] - loc = u + w * temp + v * strain_values - else: - loc = u + w * temp - z = (sigma_values - loc) / scale - z = np.clip(z, -700, 700) # -exp(-z) overflows around -745 - logpdf = -z - np.exp(-z) - np.log(scale) - return -np.sum(logpdf) - - def predict(self,cdf:float, temperature_values:np.ndarray,strain_values=np.array([])): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - inv_temp = 11604.53 / (temperature_values + 273.16) - if self.two_var: - return (self.intercept + self.slope * inv_temp + self.v*np.log(strain_values) - self.scale * np.log(-np.log(cdf))) / 1000000 - - return self.intercept + self.slope * inv_temp - self.scale * np.log(-np.log(cdf)) - - def two_var_predict(self, cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray, params:np.ndarray) -> np.ndarray: - """To predict values when there are two accelerating variables - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray) - params (np.ndarray): Parameters that will be needed to predict values \n `u,w,scale,v= params`. - """ - u,w,scale,v = params - inv_temp = 11604.53 / (temperature_values + 273.16) - return (u + w * inv_temp + v*np.log(strain_values) - scale * np.log(-np.log(cdf)))/1000000 - - @staticmethod - def estimate_params(data:np.ndarray, **kwargs): - """Fit a gumbell model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted gumbell model - """ - pass - - def transform(self, data, temp): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # Apply Weibull probability plot transformation - sigma_values = np.log(data) # X-axis: data - wb_sigma_values = -np.log(-np.log(cdf_values)) # Reduced variate Y - - # Predicted location (mean) , - # Why are we using temperature here, in this transformation - inv_temp = 11604.53 / (temp + 273.16) - mu = self.intercept + self.slope * inv_temp - - # Generate prediction line - sigma_line = np.linspace(min(data), max(data), 100) - cdf_fit = stats.gumbel_r.cdf(sigma_line, loc=mu, scale=self.scale) - pred_sigma_line = -np.log(-np.log(cdf_fit)) - - self.transform_y_label = "ln(-ln(1 - p))" # name to be displayed in the y-axis of the graph - - return sigma_values, wb_sigma_values, np.log(sigma_line), pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_{gb} = exp\left(-exp\left(-\frac{\sigma_f - \mu}{\sigma_m}\right)\right) \quad \text{...(1)} - """ - - pdf = r""" - F_{gb} = \frac{1}{\sigma_m}\left(-exp\left(-\frac{\sigma_f - \mu}{\sigma_m} + e^{-z}\right)\right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = -\sigma_mln(-ln(f_{gb})) + \mu \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = -\sigma_mln(-ln(f_{gb})) + \left( P_t + \frac{R_t}{T} \right) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = -\sigma_mln(-ln(f_{gb})) + \left( P_t + Q_tln(\epsilon) +\frac{R_t}{T} \right) \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $\sigma_m$ | {self.scale:.6f} | - """ - - if self.two_var: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $V_t$ | {self.v:.6f} | - | $\sigma_m$ | {self.scale:.6f} | - """ - - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class Exponential(ProbModel): - def __init__(self,X_values:np.ndarray, Y_values:np.ndarray, X_values2:np.ndarray=np.array([])): - """Initializes Exponential Probabilistic Model - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - X_values2 (np.ndarray, optional): Second accelerating variable (Strain). Defaults to np.array([]). - """ - self.X_values = X_values - self.X_values2 = X_values2 - self.Y_values = Y_values - self.name = "Exponential Model" - self.tab_name = "Exponential" - - self.two_var = False - if len(X_values2): - self.bounds = [(-20, 20), (-20, 20), (-20, 20)] - self.name = "Exponential Model with two variables" - self.two_var = True - - self.intercept, self.slope, self.v = self.minimize(self.bounds, args=(self.X_values, self.Y_values, self.X_values2)) - else: - bounds = [(-10, 10), (-10, 10)] - self.intercept, self.slope = self.minimize(bounds, args=(self.X_values, self.Y_values)) - - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain_values = np.array([])): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - strain(np.ndarray): Defaults to np.array([]). - - Returns: - Gives a negative sum of log likelihood for given data - """ - u = params[0] - w = params[1] - - if self.two_var: - v = params[2] - scale = np.exp(u + w * temp + v * strain_values) - else: - scale = np.exp(u + w * temp) - - return -np.sum(stats.expon.logpdf(sigma_values, scale=scale)) - - def predict(self,cdf:float, temperature_values:np.ndarray): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - inv_temp_range = 11604.53 / (temperature_values + 273.16) - lambda_vals = np.exp(self.intercept + self.slope * inv_temp_range) - return -lambda_vals * np.log(1 - cdf) - - def two_var_predict(self, cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray, params:np.ndarray) -> np.ndarray: - """To predict values when there are two accelerating variables - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray) - params (np.ndarray): Parameters that will be needed to predict values \n\n `u,w,v= params`. \n - """ - u,w,v = params - inv_temp_range = 11604.53 / (temperature_values + 273.16) - lambda_vals = np.exp(u + w * inv_temp_range + v * np.log(strain_values)) - return -lambda_vals * np.log(1 - cdf) / 1000000 - - @staticmethod - def estimate_params(data:np.ndarray, **kwargs): - pass - - def transform(self, data:np.ndarray, temp:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # Exponential probability transformation - sigma_values = np.log(data) - exp_sigma_values = np.log(-np.log(1 - cdf_values)) # Reduced variate for exponential - - # Predicted location (mean) , - # Why are we using temperature here, in this transformation - inv_temp = 11604.53 / (temp + 273.16) - lambda_val = np.exp(self.intercept + self.slope * inv_temp) - - # Generate prediction line - sigma_line = np.linspace(min(data), max(data), 100) - cdf_fit = stats.expon.cdf(sigma_line, scale=lambda_val) - pred_sigma_line = np.log(-np.log(1-cdf_fit)) - - self.transform_y_label = "ln(-ln(1 - p))" # name to be displayed in the y-axis of the graph - - return sigma_values, exp_sigma_values, np.log(sigma_line), pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_{exp} = 1 - \exp\left(- \frac{\sigma_f}{\sigma_m}\right) \quad \text{...(1)} - """ - - pdf = r""" - F_{exp} = \frac{1}{\sigma_m}\exp\left(- \frac{\sigma_f}{\sigma_m}\right) \quad \text{...(2)} - """ - - re_cdf = r""" - \sigma_f = -\sigma_m \ln(1-f_{exp}) \quad \text{...(3)} - """ - - ar_cdf = r""" - \sigma_f = -\left( U_t +\frac{W_t}{T} \right) \ln(1-f_{exp}) \quad \text{...(4)} - """ - - fatigue_cdf = r""" - \sigma_f = -\left( U_t + V_t\ln(\epsilon) +\frac{W_t}{T} \right) \ln(1-f_{exp}) \quad \text{...(5)} - """ - - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - """ - - if self.two_var: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $V_t$ | {self.v:.6f} | - """ - - super().st_description(cdf, pdf, re_cdf, ar_cdf, fatigue_cdf, variable_values) - - return '' - -class Gamma(ProbModel): - def __init__(self,X_values:np.ndarray, Y_values:np.ndarray,X_values2:np.ndarray=np.array([])): - """Initializes Gamma Probabilistic Model - - Args: - X_values (np.ndarray): First accelerating variable (Temperature) - Y_values (np.ndarray): Values to be modelled - X_values2 (np.ndarray, optional): Second accelerating variable (Strain). Defaults to np.array([]). - """ - self.X_values = X_values - self.X_values2 = X_values2 - self.Y_values = Y_values - self.name = "Gamma Model" - self.tab_name = "Gamma" - - self.two_var = False - if len(X_values2): - self.two_var = True - self.bounds = [(1e-6, 20), (-20, 20),(-20, 20), (-20, 20)] - self.shape,self.intercept, self.slope, self.v = self.minimize(self.bounds, args=(self.X_values, self.Y_values, self.X_values2)) - - else: - self.bounds = [(1e-6, 1000), (-10, 10),(-10, 10)] - self.shape,self.intercept, self.slope= self.minimize(self.bounds, args=(self.X_values, self.Y_values)) - - def log_likelihood(self,params:list, temp:np.ndarray, sigma_values:np.ndarray, strain_values:np.ndarray=np.array([])): - """Log likelihood - - Args: - params (list): parameters that are to be determined - temp (np.ndarray) - sigma_values (np.ndarray) - strain(np.ndarray): Defaults to np.array([]). - - Returns: - Gives a negative sum of log likelihood for given data - """ - u = params[1] - w = params[2] - shape = params[0] - if self.two_var: - v = params[3] - scale = np.exp(u + w * temp + v * strain_values) - else: - scale = np.exp(u + w * temp) - - return -np.sum(stats.gamma.logpdf(sigma_values, a=shape, scale=scale)) - - def predict(self,cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray=np.array([])): - """To predict values - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray): Defaults to np.array([]) - - Returns: - Predict values according to the trained model - """ - inv_temp_range = 11604.53 / (temperature_values + 273.16) - - if self.two_var: - scale_range = np.exp(self.intercept + self.slope * inv_temp_range + self.v * np.log(strain_values)) - return stats.gamma.ppf(cdf, a=shape, scale=scale_range) / 1000000 - - scale_range = np.exp(self.intercept + self.slope * inv_temp_range) - return stats.gamma.ppf(cdf, a=self.shape, scale=scale_range) - - def two_var_predict(self, cdf:float, temperature_values:np.ndarray, strain_values:np.ndarray, params:np.ndarray) -> np.ndarray: - """To predict values when there are two accelerating variables - - Args: - cdf (float) - temperature_values (np.ndarray) - strain_values (np.ndarray) - params (np.ndarray): Parameters that will be needed to predict values \n\n `shape,u,w,v= params`. \n - """ - shape,u,w,v = params - inv_temp_range = 11604.53 / (temperature_values + 273.16) - scale_range = np.exp(u + w * inv_temp_range + v * np.log(strain_values)) - return stats.gamma.ppf(cdf, a=shape, scale=scale_range) / 1000000 - - @staticmethod - def estimate_params(data:np.ndarray, **kwargs): - """Fit a gamma model on the `data` - - Args: - data (np.ndarray) - - Returns: - Gives shape and scale of the fitted gamma model - """ - return stats.gamma.fit(data, **kwargs) - - def transform(self, data:np.ndarray, temp:np.ndarray): - n = len(data) - cdf_values = np.array([median_rank(n, i + 1) for i in range(n)]) - - # Estimate scale using fixed shape - _, loc, scale = stats.gamma.fit(data, floc=0, f0=self.shape) - - # Exponential probability transformation - sigma_values = np.log(data) - gm_sigma_values = stats.gamma.ppf(cdf_values, a=self.shape) - - # Predicted location (mean) - inv_temp = 11604.53 / (temp + 273.16) - lambda_val = np.exp(self.intercept + self.slope * inv_temp) - - # Generate prediction line - sigma_line = np.linspace(min(data), max(data), 100) - pred_sigma_line = stats.gamma.ppf(stats.gamma.cdf(sigma_line, a=self.shape, scale=scale), a=self.shape) - - self.transform_y_label = "ln(-ln(1 - p))" # name to be displayed in the y-axis of the graph - - return sigma_values, gm_sigma_values, np.log(sigma_line), pred_sigma_line - - @property - def st_description(self): - cdf = r""" - f_{gm}(x) = \frac{1}{\Gamma(m)} \, \gamma\left(m, \frac{\sigma_f}{\sigma_m}\right) \quad \text{...(1)} - """ - - pdf = r""" - F_{gm}(x) = \frac{1}{\sigma_m^{\alpha}\Gamma(m)} \,\sigma_f^{\alpha-1}\,exp\left(-\frac{\sigma_f}{\sigma_m}\right) \quad \text{...(2)} - """ - - st.header("📋 Mathematical Formulation") - - # CDF Section - st.subheader("1. Cumulative Distribution Function (CDF)") - st.markdown(""" - The CDF of this model is given by: - """) - st.latex(cdf) - - # PDF Section - st.subheader("2. Probability Density Function (PDF)") - st.markdown(""" - The PDF of this model can be expressed as: - """) - st.latex(pdf) - - st.markdown("Equation (1) can't be written in terms of $\sigma_f$, so we have to do iteration to get $\sigma_f$") - - st.subheader("Variable Values") - st.markdown("In the case of data given, values of the variables are") - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $\sigma_m$ | {self.shape:.6f} | - """ - - if self.two_var: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $V_t$ | {self.v:.6f} | - | $\sigma_m$ | {self.shape:.6f} | - """ - st.markdown(variable_values) - - return '' - -# Make a class of walker equation to have values to plot various things -class WalkerEq(): - def __init__(self, df:pd.DataFrame, isLinear:bool=True): - self.df = df - self.linear = isLinear # whether the relationship is linear or arrhenious - - # Do the basic regressions - self.implement_paris_eq() - if isLinear: - self.linear_walker_regr() - else: - self.arrhenius_walker_regr() - - - self.implement_walker_eq() - self.regression_walker_eq() - - def implement_paris_eq(self): - """Implementation of Paris–Erdoğan equation""" - self.df["da_dN"] = self.df.apply( - lambda row: row["c"] * ((row["Delta K"]) ** row["m"]), - axis = 1 - ) - - self.df['Temperature,K'] = self.df.apply( - lambda row: row['Temperature, C'] + 273.15, - axis = 1 - ) - - @staticmethod - def lin_reg(X, Y): - # Compute means - X_mean = sum(X) / len(X) - Y_mean = sum(Y) / len(Y) - - # Compute slope - numerator = sum((X[i] - X_mean) * (Y[i] - Y_mean) for i in range(len(X))) - denominator = sum((X[i] - X_mean) ** 2 for i in range(len(X))) - slope = numerator / denominator - - # Compute intercept - intercept = Y_mean - slope * X_mean - - return slope, intercept - - def implement_walker_eq(self): - self.df["y"] = self.df.apply( - lambda row: np.log(row["da_dN"]) - (row["M"] * np.log(row["Delta K"])), - axis = 1 - ) - - self.df['x'] = self.df.apply( - lambda row: row["M"] * np.log(1 - row["R- Ratio"]), - axis = 1 - ) - - def linear_walker_regr(self): - features = ['Temperature,K'] - target = 'm' - X = self.df[features] - y = self.df[target] - - linear_model = LinearRegression() - linear_model.fit(X, y) - - self.intercept = linear_model.intercept_ - self.slope = linear_model.coef_[0] - - # Predict full set - X_full = self.df[['Temperature,K']] - self.df['M'] = linear_model.predict(X_full) # predicted m - - self.compute_M = lambda temp_C, intercept, slope: intercept + slope * (temp_C + 273.15) - - def arrhenius_walker_regr(self): - R = 8.314 # J/mol·K - X = 1 / self.df['Temperature,K'].values.reshape(-1, 1) - y_log = np.log(self.df['m'].values) - - arrhenius_model = LinearRegression() - arrhenius_model.fit(X, y_log) - - # Evaluate - lnA = arrhenius_model.intercept_ - Ea_over_R = -arrhenius_model.coef_[0] - Ea = Ea_over_R * R - self.slope = lnA - self.intercept = Ea - - # Predict full set - X_full = 1 / self.df['Temperature,K'].values.reshape(-1, 1) - log_m_pred = arrhenius_model.predict(X_full) - self.df['M'] = np.exp(log_m_pred) - - self.compute_M = lambda temp_C, Ea, lnA: np.exp(lnA - Ea / (R * (temp_C + 273.15))) - - def regression_walker_eq(self): - self.df["y"] = self.df.apply( - lambda row: np.log(row["da_dN"]) - (row["M"] * np.log(row["Delta K"])), - axis = 1 - ) - - self.df['x'] = self.df.apply( - lambda row: row["M"] * np.log(1 - row["R- Ratio"]), - axis = 1 - ) - - slope, intercept = self.lin_reg(self.df['x'], self.df["y"]) - self.slope_, self.intercept_= slope, intercept - - self.C = np.exp(intercept) - self.gamma = slope - - self.df['da/dN_calc'] = self.df.apply( - lambda row: self.C * ((row["Delta K"] * ((1 - row["R- Ratio"])** self.gamma)) ** row["M"]), - axis = 1 - ) - - def regression_plot(self, slope, intercept): - x_values = np.linspace(self.df['x'].min(), self.df['x'].max(), 100) - - y_values = ( - slope * x_values + intercept - ) - - fig, ax = plt.subplots(figsize=(10,6)) - ax.plot(x_values, y_values, color="red", linestyle="-", linewidth=2, label="Regressed lines") - ax.scatter(self.df['x'], self.df['y'], color="darkblue", label="Data points") - - ax.set_xlabel("X", fontsize=12, fontweight="bold") - ax.set_ylabel("Y", fontsize=12, fontweight="bold") - ax.set_title("Walker model - regression", fontsize=14, fontweight="bold") - - ax.grid(True, linestyle="-", alpha=0.6) - ax.legend(fontsize=12) - - st.pyplot(fig) - - def regression_dAdN_plot(self): - actual = self.df['da_dN'] - predicted = self.df['da/dN_calc'] - - fig, ax = plt.subplots(figsize=(10,6)) - ax.scatter(actual, predicted, color='blue', alpha=0.6, label='Predicted vs Actual da/dN') - - # Reference line (perfect prediction) - ax.plot([actual.min(), actual.max()], [actual.min(), actual.max()], 'r--', label='Ideal Fit') - - ax.set_xlabel('Actual da/dN', fontsize=12, fontweight='bold') - ax.set_ylabel('Predicted da/dN', fontsize=12, fontweight='bold') - ax.set_title('Model: Predicted vs Actual da/dN', fontsize=14, fontweight='bold') - ax.legend(fontsize=12) - ax.grid(True, linestyle='-', alpha=0.6) - st.pyplot(fig) - - def regression_dAdN_error_plot(self): - error = self.df["da/dN_calc"] - self.df["da_dN"] - - fig, ax = plt.subplots(figsize=(10,6)) - ax.hist(error, bins=20, color='teal', edgecolor='black', alpha=0.7) - - ax.set_xlabel('Prediction Error (Calc - Actual)') - ax.set_ylabel('Frequency') - ax.set_title('Histogram of da/dN Prediction Errors') - ax.grid(True) - st.pyplot(fig) - - def plot_da_dN_vs_deltaK_equation(self): - delta_K_vals = np.linspace(5, 25, 200) - - - temp_C = st.selectbox("Temperature",(self.df['Temperature, C'].unique()),key=f"plot_da_dN_vs_deltaK_equation{self.linear}") - M = self.compute_M(temp_C, self.intercept, self.slope) - - plot_all = st.toggle("Plot different K values",key=f"plot_da_dN_vs_deltaK_equation_toggle{self.linear}") - fig, ax = plt.subplots(figsize=(10,6)) - - if plot_all: - r_ratio_vals = np.linspace(0.05, 0.9, 10) - delta_K_range = np.linspace(5, 25, 200) - for r in r_ratio_vals: - da_dN_vals = [] - for dk in delta_K_range: - M = self.compute_M(temp_C, self.intercept, self.slope) - base = dk * (max(1e-8, (1 - r)) ** self.gamma) # epsilon to prevent divide-by-zero - da_dN = self.C * (base ** M) - da_dN_vals.append(da_dN) - - ax.plot(delta_K_range, da_dN_vals, label=f'R = {r:.2f}') - - scatter_df = self.df[ - (self.df['Temperature, C'] == temp_C) & - (np.isclose(self.df['R- Ratio'], r, rtol=1e-2)) - ] - # print(not scatter_df.empty) - if not scatter_df.empty: - ax.scatter(scatter_df['Delta K'], scatter_df['da_dN'], label=f'Actual R={r:.2f}', alpha=0.5) - - - ax.set_title(f'da/dN vs ΔK at T={temp_C}°C, for various R-ratios') - - else: - da_dN_vals = [] - rr = self.df['R- Ratio'].unique() - r_ratio = st.select_slider( - "Select a value for R", - options=[k for k in np.arange(min(rr),max(rr)+1,0.1)] - ) - for dk in delta_K_vals: - da_dN = self.C * ((dk * (1 - r_ratio) ** self.gamma) ** M) - da_dN_vals.append(da_dN) - - ax.plot(delta_K_vals, da_dN_vals, label='Predicted by Equation', color='darkorange') - - scatter_df = self.df[ - (self.df['Temperature, C'] == temp_C) & - (np.isclose(self.df['R- Ratio'], r_ratio, rtol=1e-2)) - ] - - if not scatter_df.empty: - ax.scatter(scatter_df['Delta K'], scatter_df['da_dN'], label='Actual data', color='navy') - - - ax.set_title(f'da/dN vs ΔK at T={temp_C}°C, R={r_ratio}') - - ax.plot(delta_K_vals, da_dN_vals, label='Predicted by Equation', color='darkorange') - ax.set_xlabel('ΔK') - ax.set_ylabel('da/dN') - ax.legend() - ax.grid(True) - st.pyplot(fig) - - def plot_da_dN_vs_r_ratio_equation(self): - r_ratio_vals = np.linspace(0.05, 1, 200) - delta_K_vals = [5, 10, 15, 20, 25] - - fig, ax = plt.subplots(figsize=(10,6)) - - # option to select temperature - temp_C = st.selectbox("Temperature",(self.df['Temperature, C'].unique()),key=f"plot_da_dN_vs_r_ratio_equation{self.linear}") - M = self.compute_M(temp_C, self.intercept, self.slope) - - # option to plot all of the values, or just to play with one - plot_all = st.toggle("Plot different K values",key=f"plot_da_dN_vs_r_ratio_equation_toggle{self.linear}") - - if plot_all: - for dk in delta_K_vals: - da_dN_vals = [] - for r in r_ratio_vals: - da_dN = self.C * ((dk * (1 - r) ** self.gamma) ** M) - da_dN_vals.append(da_dN) - - ax.plot(r_ratio_vals, da_dN_vals, label='Predicted by Equation', color='darkorange') - - scatter_df = self.df[ - (self.df['Temperature, C'] == temp_C) & - (np.isclose(self.df['Delta K'], dk, rtol=1e-2)) - ] - if not scatter_df.empty: - plt.scatter(scatter_df['R- Ratio'], scatter_df['da_dN'], label=f'Actual ΔK={dk}', alpha=0.6) - - ax.set_title(f'da/dN vs R at T={temp_C}°C') - else: - da_dN_vals = [] - ks = self.df['Delta K'].unique() - dk = st.select_slider( - "Select a value for K", - options=[k for k in range(min(ks)-1,max(ks)+1,1)] - ) - - - for r in r_ratio_vals: - da_dN = self.C * ((dk * (1 - r) ** self.gamma) ** M) - da_dN_vals.append(da_dN) - - ax.plot(r_ratio_vals, da_dN_vals, label='Predicted by Equation', color='darkorange') - - scatter_df = self.df[ - (self.df['Temperature, C'] == temp_C) & (np.isclose(self.df['Delta K'],dk, rtol=1e-2)) - ] - if not scatter_df.empty: - ax.scatter(scatter_df['R- Ratio'], scatter_df['da_dN'], label=f'Actual ΔK={dk}') - - ax.set_title(f'da/dN vs R at T={temp_C}°C, ΔK={dk}') - - ax.set_xlabel('R-Ratio') - ax.set_ylabel('da/dN') - ax.legend() - ax.grid(True) - st.pyplot(fig) - - def plot_da_dN_vs_temperature_equation(self): - temp_vals = np.linspace(50, 300, 300) - da_dN_vals = [] - - plot_type = st.radio( - "Select Plot Type:", - ("Different K ratios", "Different R ratios", "Custom"), - help="Choose the type of plot you want" - ) - - def da_dN(temp_C, dk, r_ratio, ax,doLabel=False): - M = self.compute_M(temp_C, self.intercept, self.slope) - scatter_df = self.df[ - (np.isclose(self.df['Delta K'], dk, rtol=1e-2)) & - (np.isclose(self.df['R- Ratio'], r_ratio, rtol=1e-2)) - ] - - if not scatter_df.empty: - if doLabel: - ax.scatter(scatter_df['Temperature, C'], scatter_df['da_dN'], label='Actual data') - else: - ax.scatter(scatter_df['Temperature, C'], scatter_df['da_dN']) - - return self.C * ((dk * (1 - r_ratio) ** self.gamma) ** M) - - # Start Plotting - fig, ax = plt.subplots(figsize=(10,6)) - - if plot_type=="Different R ratios": - ks = self.df['Delta K'].unique() - dk = st.select_slider( - "Select a value for K", - options=[k for k in range(min(ks)-1,max(ks)+1,1)],key=f"plot_da_dN_vs_temperature_equation_dk32{self.linear}" - ) - - r_ratio_vals = np.linspace(0.05, 0.9, 10) - - for r in r_ratio_vals: - da_dN_vals = [] - for temp_C in temp_vals: - da_dN_vals.append(da_dN(temp_C, dk, r,ax)) - - ax.plot(temp_vals, da_dN_vals, label=f'R = {r:.2f}') - - ax.set_title(f'Fatigue Crack Growth Rate vs Temperature at ΔK={dk} MPa√m') - - elif plot_type=="Different K ratios": - rr = self.df['R- Ratio'].unique() - r_ratio = st.select_slider( - "Select a value for R", - options=[k for k in np.arange(min(rr),max(rr)+1,0.1)],key=f"plot_da_dN_vs_temperature_equation_dk12{self.linear}" - ) - - delta_K_vals = [5, 10, 15, 20, 25] - - for dk in delta_K_vals: - da_dN_vals = [] - for temp_C in temp_vals: - da_dN_vals.append(da_dN(temp_C, dk, r_ratio,ax)) - - ax.plot(temp_vals, da_dN_vals, label=f'ΔK = {dk:.2f}') - - ax.set_title(f'Fatigue Crack Growth Rate vs Temperature at R={r_ratio} MPa√m') - - else: - ks = self.df['Delta K'].unique() - dk = st.select_slider( - "Select a value for K", - options=[k for k in range(min(ks)-1,max(ks)+1,1)],key=f"plot_da_dN_vs_temperature_equation_dk{self.linear}" - ) - - rr = self.df['R- Ratio'].unique() - r_ratio = st.select_slider( - "Select a value for R", - options=[k for k in np.arange(min(rr),max(rr)+1,0.1)],key=f"plot_da_dN_vs_temperature_equation_r{self.linear}" - ) - - count_scatter = 0 - for temp_C in temp_vals: - if count_scatter!=0: - da_dN_vals.append(da_dN(temp_C, dk, r_ratio,ax)) - else: - da_dN_vals.append(da_dN(temp_C, dk, r_ratio,ax, True)) - count_scatter +=1 - - ax.set_title(f'Fatigue Crack Growth Rate vs Temperature at ΔK={dk} and R={r_ratio} MPa√m') - - ax.plot(temp_vals, da_dN_vals, label='Predicted by Equation', color='darkorange') - - ax.set_xlabel('Temperature, C') - ax.set_ylabel('da/dN') - - ax.legend() - ax.grid(True) - st.pyplot(fig) - - def st_description(self): - st.header("📋 Mathematical Formulation") - - st.markdown("### Model Equation") - - st.write( - "The crack growth rate model is given by the following equation:" - ) - - st.latex(r""" - \frac{da}{dN} = C \left[ \left(1-r\right)^\gamma \, \Delta k \, \right] ^m - """) - - st.markdown( - """ - where: - - $\\frac{da}{dN}$ is the crack growth rate, - - $C$ is a material constant, - - $\\gamma$ is a fitting parameter, - - $r$ is the stress ratio, - - $\\Delta k$ is the stress intensity factor range, - - $m$ is the crack growth exponent. - """ - ) - - st.markdown("### Linearization for Regression") - - st.write( - "To determine the constants $C$ and $\\gamma$, we can transform the model into a linear form:" - ) - - st.latex(r""" - \ln\left(\frac{da}{dN}\right) - m \, \ln(\Delta k) = \gamma \, m \, \ln(1-r) + C - """) - - st.write( - "This transformation allows us to apply **linear regression** to estimate $C$ and $\\gamma$." - ) - - st.markdown("### Temperature Dependence of $m$") - - st.write( - "Since $m$ varies with temperature $T$, we can approximate it using either a **linear relation**:" - ) - - st.latex(r""" - m(T) = U + W \, T - """) - - st.write("or an **Arrhenius-type relation**:") - - st.latex(r""" - m(T) = A \, \exp\left( \frac{E_a \, R}{T} \right) - """) - - st.write( - r"Here, $R = 8.314 \ \mathrm{J/(mol \cdot K)}$ is the universal gas constant, " - r"and $A$ and $E_a$ are determined via linear regression from the experimental data." - ) - - st.markdown("### Variable Values") - st.markdown("In the case of data given, values of the variables are") - - if self.linear: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $U_t$ | {self.intercept:.6f} | - | $W_t$ | {self.slope:.6f} | - | $C$ | {self.C:.6f} | - | $\gamma$ | {self.gamma:.6f} | - """ - else: - variable_values = f""" - | Variable | Values | - |----------|-------------| - | $E_a$ | {self.intercept:.6f} | - | $lnA$ | {self.slope:.6f} | - | $C$ | {self.C:.6f} | - | $\gamma$ | {self.gamma:.6f} | - """ - - st.markdown(variable_values) - diff --git a/probabilistic_model/utils.py b/probabilistic_model/utils.py deleted file mode 100644 index f949ed9..0000000 --- a/probabilistic_model/utils.py +++ /dev/null @@ -1,46 +0,0 @@ -import pandas as pd -import matplotlib.pyplot as plt -import numpy as np - -def median_rank(n:int, i:int)->float: - """Function to compute cumulative probability using Benard's median rank formula""" - return (i - 0.3) / (n + 0.4) - -def df_processor(df:pd.DataFrame, temp_col, stress_col) -> tuple[pd.DataFrame, dict]: - """Basic processing for streamlit app""" - df_1 = df.sort_values(by=temp_col, ascending=False).reset_index(drop=True) - df_dict = {temp: df_1[df_1[temp_col] == temp].reset_index(drop=True) for temp in df_1[temp_col].unique()} - - df_1['Inverse_Temp'] = 11604.53 / (df_1[temp_col] + 273.16) # Convert to Kelvin - df_1['Ln_Mpa'] = np.log(df_1[stress_col]) # Log transformation - - return df_1, df_dict - -def fatigue_crack_preprocess_df(df, temp_col, c_col, m_col, krange_col, r_ratio_col): - # Create a list to hold expanded rows - expanded_rows = [] - - # Loop through each row - for _, row in df.iterrows(): - # Parse the ΔK range - try: - k_range = str(row[krange_col]).strip() - k_min, k_max = map(float, k_range.split('-')) - except: - continue - - # Generate integer ΔK values within the range - delta_k_values = list(range(int(k_min), int(k_max) + 1)) - - # Create a new row for each ΔK value - for delta_k in delta_k_values: - expanded_rows.append({ - 'Temperature, C': row[temp_col], - 'c': row[c_col], - 'm': row[m_col], - 'R- Ratio': row[r_ratio_col], - 'Delta K': delta_k - }) - - expanded_df = pd.DataFrame(expanded_rows) - return expanded_df \ No newline at end of file diff --git a/docs/probabilistic_models.html b/probabilistic_models.html similarity index 99% rename from docs/probabilistic_models.html rename to probabilistic_models.html index 0032688..90323fe 100644 --- a/docs/probabilistic_models.html +++ b/probabilistic_models.html @@ -11,7 +11,6 @@ - diff --git a/docs/py-modindex.html b/py-modindex.html similarity index 97% rename from docs/py-modindex.html rename to py-modindex.html index 8a701e2..10417e0 100644 --- a/docs/py-modindex.html +++ b/py-modindex.html @@ -10,7 +10,6 @@ - diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 0bf5f9b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -scipy -matplotlib -openpyxl -scikit-learn -streamlit diff --git a/docs/search.html b/search.html similarity index 97% rename from docs/search.html rename to search.html index 94f6e0a..4d0e848 100644 --- a/docs/search.html +++ b/search.html @@ -10,7 +10,6 @@ - diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000..3150bf1 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles": {"API Reference:": [[3, null]], "Dataset Format": [[2, "Dataset-Format"]], "Exponential:": [[2, "Exponential:"]], "Fitting various probability models": [[2, null]], "Gamma": [[2, "Gamma"]], "Gumbell Model:": [[2, "Gumbell-Model:"]], "LogNormal (3-Parameters)": [[2, "LogNormal-(3-Parameters)"]], "LogNormal Model": [[2, "LogNormal-Model"]], "Lognormal (Power Law)": [[2, "Lognormal-(Power-Law)"]], "Module contents": [[0, "module-probabilistic_model"]], "Normal Model:": [[2, "Normal-Model:"]], "Plot Utils": [[2, "Plot-Utils"]], "Probabilistic Models": [[3, null]], "Probabilistic-model": [[4, null]], "Submodules": [[0, "submodules"]], "Tutorials": [[3, null]], "Weibull (3-Parameters)": [[2, "Weibull-(3-Parameters)"]], "Weibull (Power Law)": [[2, "Weibull-(Power-Law)"]], "Weibull Model": [[2, "Weibull-Model"]], "app module": [[1, null]], "probabilistic_model package": [[0, null]], "probabilistic_model.app module": [[0, "probabilistic-model-app-module"]], "probabilistic_model.probabilistic_models module": [[0, "probabilistic-model-probabilistic-models-module"]], "probabilistic_model.utils module": [[0, "probabilistic-model-utils-module"]], "probabilistic_models module": [[5, null]], "utils module": [[6, null]]}, "docnames": ["Probabilistic_model", "app", "exp", "index", "modules", "probabilistic_models", "utils"], "envversion": {"nbsphinx": 4, "sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1}, "filenames": ["Probabilistic_model.rst", "app.rst", "exp.ipynb", "index.rst", "modules.rst", "probabilistic_models.rst", "utils.rst"], "indexentries": {"module": [[0, "module-probabilistic_model", false]], "probabilistic_model": [[0, "module-probabilistic_model", false]]}, "objects": {"": [[1, 0, 0, "-", "app"], [0, 0, 0, "-", "probabilistic_model"]], "app": [[1, 1, 1, "", "line_fit_plot"], [1, 1, 1, "", "plot_different_cdf"], [1, 1, 1, "", "plot_different_cdf_two_var"]], "probabilistic_model": [[5, 0, 0, "-", "probabilistic_models"], [6, 0, 0, "-", "utils"]], "probabilistic_model.probabilistic_models": [[5, 2, 1, "", "Exponential"], [5, 2, 1, "", "Gamma"], [5, 2, 1, "", "Gumbell"], [5, 2, 1, "", "LognormalModel"], [5, 2, 1, "", "LognormalModel3"], [5, 2, 1, "", "NormalModel"], [5, 2, 1, "", "ProbModel"], [5, 2, 1, "", "WalkerEq"], [5, 2, 1, "", "WeibullModel"], [5, 2, 1, "", "WeibullModel3"]], "probabilistic_model.probabilistic_models.Exponential": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.Gamma": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.Gumbell": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.LognormalModel": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.LognormalModel3": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "minimize"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"]], "probabilistic_model.probabilistic_models.NormalModel": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.ProbModel": [[5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "minimize"], [5, 3, 1, "", "power_st_description"], [5, 3, 1, "", "predict"], [5, 3, 1, "", "st_description"]], "probabilistic_model.probabilistic_models.WalkerEq": [[5, 3, 1, "", "arrhenius_walker_regr"], [5, 3, 1, "", "implement_paris_eq"], [5, 3, 1, "", "implement_walker_eq"], [5, 3, 1, "", "lin_reg"], [5, 3, 1, "", "linear_walker_regr"], [5, 3, 1, "", "plot_da_dN_vs_deltaK_equation"], [5, 3, 1, "", "plot_da_dN_vs_r_ratio_equation"], [5, 3, 1, "", "plot_da_dN_vs_temperature_equation"], [5, 3, 1, "", "regression_dAdN_error_plot"], [5, 3, 1, "", "regression_dAdN_plot"], [5, 3, 1, "", "regression_plot"], [5, 3, 1, "", "regression_walker_eq"], [5, 3, 1, "", "st_description"]], "probabilistic_model.probabilistic_models.WeibullModel": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"], [5, 3, 1, "", "two_var_predict"]], "probabilistic_model.probabilistic_models.WeibullModel3": [[5, 3, 1, "", "estimate_params"], [5, 3, 1, "", "log_likelihood"], [5, 3, 1, "", "minimize"], [5, 3, 1, "", "predict"], [5, 4, 1, "", "st_description"], [5, 3, 1, "", "transform"]], "probabilistic_model.utils": [[6, 1, 1, "", "df_processor"], [6, 1, 1, "", "fatigue_crack_preprocess_df"], [6, 1, 1, "", "median_rank"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "method", "Python method"], "4": ["py", "property", "Python property"]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:method", "4": "py:property"}, "terms": {"": [2, 6], "0": [1, 2], "01": [1, 2], "0233": 2, "0241": 2, "0242": 2, "0253": 2, "0386": 2, "0387": 2, "0439": 2, "0584": 2, "1": [1, 2], "10": 2, "100": 2, "11": 2, "11604": 2, "12": 2, "13": 2, "14": 2, "15": 2, "16": 2, "17": 2, "176": 2, "18": 2, "19": 2, "1938": 2, "1950": 2, "2": 2, "20": 2, "2116": 2, "2186": 2, "22": 2, "23": 2, "233": 2, "2357539701": 2, "24": 2, "246": 2, "2584": 2, "26": 2, "273": 2, "3": [3, 5], "30": 2, "37": 2, "38": 2, "39": 2, "4": 2, "433": 2, "4442": 2, "45": 2, "46": 2, "4686": 2, "4714": 2, "4732": 2, "4825": 2, "4f": 2, "5": [1, 2], "52": 2, "53": 2, "5455": 2, "56": 2, "57": 2, "5750": 2, "6": 2, "600": 2, "7": 2, "7048": 2, "72": 2, "73": 2, "74": 2, "7600": 2, "78": 2, "79": 2, "8": 2, "80": 2, "83": 2, "8564": 2, "8574": 2, "8598": 2, "8613": 2, "8982": 2, "9": [1, 2], "9026": 2, "9860": 2, "9896": 2, "99": [1, 2], "To": 5, "_continuous_distn": 2, "_method": 2, "abc": 5, "abstract": 5, "acceler": 5, "accord": 5, "add": 3, "alpha": 2, "app": [3, 4, 6], "appdata": 2, "append": 2, "ar": 5, "ar_cdf": 5, "arg": 5, "arrai": 5, "arrhenius_walker_regr": [4, 5], "articl": 2, "ascend": 2, "ax": 2, "base": 5, "basic": 6, "benard": 6, "black": 2, "bold": 2, "bound": 5, "c": 2, "c_col": 6, "cannot": 2, "cdf": [1, 2, 5], "class": 5, "com": 2, "comparison": 2, "comput": 6, "content": 3, "convert": 2, "core": 2, "cumul": 6, "d": 2, "data": [1, 2, 5], "datafram": 6, "dataset": 3, "def": 2, "default": 5, "delta": 2, "deploy": 2, "descript": 5, "detail": 3, "determin": 5, "df": [2, 5, 6], "df_1": 2, "df_2": 2, "df_dict": [1, 2], "df_processor": [2, 4, 6], "dict": 6, "document": 3, "drop": 2, "dtype": 5, "edgecolor": 2, "encount": 2, "equat": 5, "erdo\u011fan": 5, "estimate_param": [4, 5], "except": 2, "exp": 2, "exponenti": [3, 4, 5], "f": 2, "fals": 5, "fatigue_cdf": 5, "fatigue_crack_preprocess_df": [4, 6], "fig": 2, "figsiz": 2, "figur": 2, "figurecanvasagg": 2, "fit": [3, 5], "float": [5, 6], "float64": 5, "fontsiz": 2, "fontweight": 2, "format": 3, "formula": 6, "from": 2, "function": 6, "gamma": [3, 4, 5], "gb": 2, "give": 5, "given": 5, "gm": 2, "grid": 2, "gumbel": [3, 4, 5], "have": 2, "here": 2, "http": 2, "i": [2, 6], "implement": 5, "implement_paris_eq": [4, 5], "implement_walker_eq": [4, 5], "import": 2, "interact": 2, "intercept": [2, 5], "inverse_temp": 2, "ipykernel_18124": 2, "ipykernel_18340": 2, "ipykernel_25556": 2, "islinear": 5, "k": [2, 5], "kei": 2, "kelvin": 2, "krange_col": 6, "kwarg": 5, "l": 5, "label": 2, "law": 3, "legend": 2, "len": 2, "lib": 2, "likelihood": 5, "lin_reg": [4, 5], "line": 2, "line_fit_plot": [1, 2, 4], "linear_walker_regr": [4, 5], "linestyl": 2, "linewidth": 2, "linspac": 2, "list": 5, "lm": 2, "ln": 2, "ln_mpa": 2, "ln_sigma_valu": 2, "lnm": 2, "local": 2, "log": [2, 5], "log_likelihood": [4, 5], "lognorm": [3, 5], "lognormalmodel": [2, 4, 5], "lognormalmodel3": [2, 4, 5], "m": [2, 5], "m_col": 6, "median": 6, "median_rank": [4, 6], "minim": [4, 5], "model": [1, 5], "modul": [3, 4], "mohit": 2, "mpa": 2, "multipli": 2, "n": 6, "name": 2, "ndarrai": 5, "need": 5, "neg": 5, "non": 2, "normal": [3, 5], "normalmodel": [2, 4, 5], "np": [2, 5], "numpi": 2, "object": 5, "out": 2, "overflow": 2, "packag": 2, "paper": 2, "param": [1, 5], "paramet": [3, 5], "pari": 5, "path": 2, "paul": 2, "pd": 2, "pdf": 5, "pii": 2, "plot": 3, "plot_da_dn_vs_deltak_equ": [4, 5], "plot_da_dn_vs_r_ratio_equ": [4, 5], "plot_da_dn_vs_temperature_equ": [4, 5], "plot_different_cdf": [1, 2, 4], "plot_different_cdf_two_var": [1, 4], "plt": 2, "pow": 2, "power": 3, "power_law": [2, 5], "power_st_descript": [4, 5], "predict": [1, 2, 4, 5], "print": 2, "probabilistic_model": [2, 3, 4, 6], "probabl": [3, 6], "probmodel": [4, 5], "process": 6, "program": 2, "project": 2, "properti": 5, "py": 2, "python": 2, "python311": 2, "quantil": 2, "r_ratio_col": 6, "rang": 2, "rank": 6, "re_cdf": 5, "read_excel": 2, "regression_dadn_error_plot": [4, 5], "regression_dadn_plot": [4, 5], "regression_plot": [4, 5], "regression_walker_eq": [4, 5], "reset_index": 2, "restructuredtext": 3, "return": [2, 5, 6], "runtimewarn": 2, "s2666359721000378": 2, "sc": 2, "scale": [2, 5], "scatter": 2, "scienc": 2, "sciencedirect": 2, "scipi": 2, "see": 3, "set_titl": 2, "set_xlabel": 2, "set_ylabel": 2, "shape": [2, 5], "show": 2, "shown": 2, "sigma": [2, 5], "sigma_fit_log": 2, "sigma_valu": [2, 5], "site": 2, "slope": [2, 5], "sort": 2, "sort_valu": 2, "sourc": [1, 5, 6], "st_descript": [4, 5], "standard": 2, "stat": 2, "static": 5, "strain": 5, "strain_valu": 5, "streamlit": [5, 6], "stress": 2, "stress_col": 6, "studi": 2, "subplot": 2, "sum": 5, "sy": 2, "syntax": 3, "temp": [2, 5], "temp_col": 6, "temperatur": [1, 2], "temperature_valu": [2, 5], "thi": 5, "thu": 2, "tight_layout": 2, "titl": 2, "train": 5, "transform": [2, 4, 5], "true": [2, 5], "try": 2, "tupl": 6, "two": 5, "two_var_predict": [4, 5], "type": [5, 6], "u": [2, 5], "um": 2, "uniqu": 2, "us": [2, 3, 5, 6], "user": 2, "userwarn": 2, "util": [3, 4], "v": [2, 5], "valu": [2, 5], "variabl": 5, "variable_valu": 5, "variou": 3, "vendor": 2, "w": [2, 5], "walkereq": [4, 5], "wb": 2, "wb3": 2, "we": 2, "websit": 5, "weibul": [3, 5], "weibullmodel": [2, 4, 5], "weibullmodel3": [2, 4, 5], "when": 5, "www": 2, "x": [2, 5], "x_valu": [2, 5], "x_values2": 5, "xlabel": 2, "xlogi": 2, "y": [2, 5], "y_fit": 2, "y_valu": [2, 5], "yield": 2, "ylabel": 2, "your": 3, "ys_predicted_cdf": 2, "yup": 2}, "titles": ["probabilistic_model package", "app module", "Fitting various probability models", "Probabilistic Models", "Probabilistic-model", "probabilistic_models module", "utils module"], "titleterms": {"3": 2, "api": 3, "app": [0, 1], "content": 0, "dataset": 2, "exponenti": 2, "fit": 2, "format": 2, "gamma": 2, "gumbel": 2, "law": 2, "lognorm": 2, "model": [2, 3, 4], "modul": [0, 1, 5, 6], "normal": 2, "packag": 0, "paramet": 2, "plot": 2, "power": 2, "probabilist": [3, 4], "probabilistic_model": [0, 5], "probabl": 2, "refer": 3, "submodul": 0, "tutori": 3, "util": [0, 2, 6], "variou": 2, "weibul": 2}}) \ No newline at end of file diff --git a/docs/utils.html b/utils.html similarity index 98% rename from docs/utils.html rename to utils.html index 5c77bb6..3f54780 100644 --- a/docs/utils.html +++ b/utils.html @@ -11,7 +11,6 @@ -