├── docker
└── Dockerfile
├── tests
├── __init__.py
└── test_models
│ └── __init__.py
├── examples
└── __init__.py
├── profeld
└── __init__.py
├── requirements.txt
├── CHANGELOG.md
├── codecov.yml
├── .github
├── ISSUE_TEMPLATE
│ ├── bug-report.md
│ ├── feature-request.md
│ └── question.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── lint.yml
│ ├── codeql-analysis.yml
│ └── test.yml
├── docs
├── requirements_docs.txt
├── Makefile
├── make.bat
└── source
│ ├── index.rst
│ ├── conf.py
│ └── _static
│ └── logo.svg
├── Makefile
├── .readthedocs.yml
├── .pre-commit-config.yaml
├── LICENSE
├── README_CN.md
├── .gitignore
├── setup.cfg
├── pyproject.toml
└── README.md
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/profeld/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/test_models/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy==1.16.2
2 | pandas==0.24.2
3 | joblib==0.14.1
4 | scikit-learn==0.20.3
5 | scipy==1.2.1
6 | tensorflow>=2.1.1
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Release notes
2 |
3 | ## v0.0.1 Initial release (15/10/2022)
4 |
5 | ### Added
6 | - method support
7 |
8 | ### Contributor
9 | - LongxingTan
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | precision: 2
3 | round: down
4 | range: "70...100"
5 | status:
6 | project:
7 | default:
8 | threshold: 0.2%
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "🐛 Bug Report"
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "🚀 Feature Request"
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "❓Question"
3 | about: Ask a general question
4 | title: ''
5 | labels: question
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## ❔Question
11 |
12 |
13 | ## Additional context
14 |
--------------------------------------------------------------------------------
/docs/requirements_docs.txt:
--------------------------------------------------------------------------------
1 | recommonmark>=0.7.1
2 | nbconvert>=6.3.0
3 | pandoc>=1.0
4 | ipython
5 | sphinx>3.2
6 | nbsphinx==0.8.8
7 | sphinx_markdown_tables==0.0.17
8 | pydata_sphinx_theme==0.8.0
9 | docutils
10 | sphinx-autobuild
11 |
12 | tensorflow==2.7.1
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Description
2 |
3 | This PR ...
4 |
5 | ### Checklist
6 |
7 | - [ ] Linked issues (if existing)
8 | - [ ] Amended changelog.md for large changes (and added myself there as contributor)
9 | - [ ] Added/modified tests
10 | - [ ] Used pre-commit hooks when committing to ensure that code is compliant with hooks. Install hooks with `pre-commit install`.
11 | To run hooks independent of commit, execute `pre-commit run --all-files`
12 |
13 | Thank you for joining. Have fun!
14 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: style test docs pre-release
2 |
3 | check_dirs := profeld examples tests
4 |
5 | # run checks on all files and potentially modifies some of them
6 |
7 | style:
8 | black --preview $(check_dirs)
9 | isort $(check_dirs)
10 | flake8
11 |
12 | # run tests for the library
13 |
14 | test:
15 | python -m unittest
16 |
17 |
18 | # run tests for the docs
19 |
20 | docs:
21 | make -C docs clean M=$(shell pwd)
22 | make -C docs html M=$(shell pwd)
23 |
24 | # release
25 |
26 | # pre-release:
27 | # python utils/release.py
28 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | # .readthedocs.yml
2 | # Read the Docs configuration file
3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4 |
5 | # Required
6 | version: 2
7 |
8 | # Build documentation in the docs/ directory with Sphinx
9 | # reference: https://docs.readthedocs.io/en/stable/config-file/v2.html#sphinx
10 | sphinx:
11 | configuration: docs/source/conf.py
12 | fail_on_warning: false
13 |
14 | # Build documentation with MkDocs
15 | #mkdocs:
16 | # configuration: mkdocs.yml
17 |
18 | # Optionally build your docs in additional formats such as PDF and ePub
19 | formats:
20 | - htmlzip
21 |
22 | # Optionally set the version of Python and requirements required to build your docs
23 | python:
24 | version: 3.8
25 | install:
26 | - requirements: docs/requirements_docs.txt
27 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | # See https://pre-commit.com for more information
2 | # See https://pre-commit.com/hooks.html for more hooks
3 | repos:
4 | - repo: https://github.com/pre-commit/pre-commit-hooks
5 | rev: v4.1.0
6 | hooks:
7 | - id: trailing-whitespace
8 | - id: end-of-file-fixer
9 | - id: check-yaml
10 | - id: check-ast
11 | - repo: https://gitlab.com/pycqa/flake8
12 | rev: "3.9.2"
13 | hooks:
14 | - id: flake8
15 | - repo: https://github.com/pre-commit/mirrors-isort
16 | rev: v5.10.1
17 | hooks:
18 | - id: isort
19 | - repo: https://github.com/psf/black
20 | rev: 22.3.0
21 | hooks:
22 | - id: black
23 | - repo: https://github.com/nbQA-dev/nbQA
24 | rev: 1.3.1
25 | hooks:
26 | - id: nbqa-black
27 | - id: nbqa-isort
28 | - id: nbqa-flake8
29 | - id: nbqa-check-ast
30 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | [license-image]: https://img.shields.io/badge/License-MIT-blue.svg
2 | [license-url]: https://opensource.org/licenses/MIT
3 | [pypi-image]: https://badge.fury.io/py/python-profeld.svg
4 | [pypi-url]: https://pypi.python.org/pypi/python-profeld
5 | [build-image]: https://github.com/LongxingTan/python-profeld/actions/workflows/test.yml/badge.svg?branch=master
6 | [build-url]: https://github.com/LongxingTan/python-profeld/actions/workflows/test.yml?query=branch%3Amaster
7 | [lint-image]: https://github.com/LongxingTan/python-profeld/actions/workflows/lint.yml/badge.svg
8 | [lint-url]: https://github.com/LongxingTan/python-profeld/actions/workflows/lint.yml
9 | [docs-image]: https://readthedocs.org/projects/python-profeld/badge/?version=latest
10 | [docs-url]: https://python-profeld.readthedocs.io/en/latest/
11 |
12 |
13 |
14 |
15 |
16 | [![LICENSE][license-image]][license-url]
17 | [![PyPI Version][pypi-image]][pypi-url]
18 | [![Build Status][build-image]][build-url]
19 | [![Lint Status][lint-image]][lint-url]
20 | [![Docs Status][docs-image]][docs-url]
21 |
22 | **[Documentation](https://python-profeld.readthedocs.io)** | **[Tutorials](https://python-profeld.readthedocs.io/en/latest/tutorials.html)** | **[Release Notes](https://python-profeld.readthedocs.io/en/latest/CHANGELOG.html)** | **[中文](./README_CN.md)**
23 |
24 | **python-profeld** 是一个生存分析、预测性维护python工具。
25 |
26 | ProFeld是戴姆勒内部开发使用的Weibull生存分析软件名字,python-profeld则配备了更多相关算法。中文名扁鹊,希望做到故障领域的望闻问切。
27 |
28 | ## 快速入门
29 |
30 | 预测性维护是工业互联网最广泛的应用之一。
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyBuilder
31 | target/
32 |
33 | # Jupyter Notebook
34 | .ipynb_checkpoints
35 |
36 | # IPython
37 | profile_default/
38 | ipython_config.py
39 |
40 | # pyenv
41 | .python-version
42 |
43 | # Sphinx documentation
44 | docs/_build/
45 | docs/source/api/
46 | docs/source/CHANGELOG.md
47 |
48 | # mkdocs documentation
49 | /site
50 |
51 | # pycharm
52 | .idea
53 |
54 | # vscode
55 | .vscode
56 |
57 | # checkpoints
58 | *.ckpt
59 | *.pkl
60 | .DS_Store
61 |
62 | # Environments
63 | .env
64 | .venv
65 | env/
66 | venv/
67 | ENV/
68 | env.bak/
69 | venv.bak/
70 |
71 | # Unit test / coverage reports
72 | htmlcov/
73 | .tox/
74 | .nox/
75 | .coverage
76 | .coverage.*
77 | .cache
78 | nosetests.xml
79 | coverage.xml
80 | *.cover
81 | *.py,cover
82 | .hypothesis/
83 | .pytest_cache/
84 |
85 | # yuetan
86 | **/nohup.out
87 | /reference/*
88 | /backup/*
89 | **/temp.py
90 | /data/logs/*
91 | /data/*.zip
92 | /data/raw/*
93 | /data/web/*
94 | /weights/scaler.pkl
95 | /weights/saved_model.pb
96 | /weights/variables/*
97 | /weights/checkpoint
98 | /weights/checkpoint.data-00000-of-00001
99 | /weights/checkpoint.index
100 |
--------------------------------------------------------------------------------
/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | .. python-ProFeld documentation master file, created by
2 | sphinx-quickstart on Sun Oct 9 14:27:23 2022.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to python-ProFeld's documentation!
7 | ==========================================
8 |
9 | predictive maintenance predict a specific member's future performance giving its historical feature data. It encompasses a variety of topics, including but not limited to: failure prediction, failure diagnosis (root cause analysis), failure detection, failure type classification, and recommendation of mitigation or maintenance actions after failure. It's helpful to reduce repair costs, reduce production down time and improve worker safety.
10 |
11 | Predictive maintenance differs from preventive maintenance because it relies on the actual condition of equipment, rather than average or expected life statistics, to predict when maintenance will be required, so predictive maintenance gives personal prediction service.
12 |
13 | Preventive maintenance consider all samples statistical property, instead of each member's, we can decide to maintain or not when the operation time reaches the mean time. Survival analysis do the similar thing, but it can also predict the whole sample's future performance. So that's why we use survival analysis in Mercedes, to evaluate vehicle issue's future performance.
14 |
15 |
16 | .. toctree::
17 | :maxdepth: 2
18 | :caption: Contents:
19 |
20 |
21 |
22 | Indices and tables
23 | ==================
24 |
25 | * :ref:`genindex`
26 | * :ref:`modindex`
27 | * :ref:`search`
28 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | max-line-length = 120
3 | show-source = true
4 | ignore =
5 | E203, # space before : (needed for how black formats slicing)
6 | W503, # line break before binary operator
7 | W504, # line break after binary operator
8 | E402, # module level import not at top of file
9 | E731, # do not assign a lambda expression, use a def
10 | E741, # ignore not easy to read variables like i l I etc.
11 | C406, # Unnecessary list literal - rewrite as a dict literal.
12 | C408, # Unnecessary dict call - rewrite as a literal.
13 | C409, # Unnecessary list passed to tuple() - rewrite as a tuple literal.
14 | S001, # found modulo formatter (incorrect picks up mod operations)
15 | F401 # unused imports
16 | exclude = docs/build/*.py,
17 | node_modules/*.py,
18 | .eggs/*.py,
19 | versioneer.py,
20 | venv/*,
21 | .venv/*,
22 | .git/*
23 | .history/*
24 |
25 | [isort]
26 | profile = black
27 | honor_noqa = true
28 | line_length = 120
29 | combine_as_imports = true
30 | force_sort_within_sections = true
31 | known_first_party = tfts
32 |
33 | [tool:pytest]
34 | addopts =
35 | -rsxX
36 | -vv
37 | --last-failed
38 | --cov=tfts
39 | --cov-report=html
40 | --cov-config=setup.cfg
41 | --cov-report=term-missing:skip-covered
42 | --no-cov-on-fail
43 | -n0
44 | testpaths = tests/
45 | log_cli_level = ERROR
46 | markers =
47 |
48 | [coverage:report]
49 | omit = tests/*
50 | ignore_errors = False
51 | show_missing = true
52 |
53 | [mypy]
54 | ignore_missing_imports = true
55 | no_implicit_optional = true
56 | check_untyped_defs = true
57 |
58 | cache_dir = .cache/mypy/
59 |
--------------------------------------------------------------------------------
/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: Lint
2 |
3 | on:
4 | push:
5 | branches: [master, dev]
6 | pull_request:
7 | branches: [master]
8 |
9 | jobs:
10 | linter-black:
11 | name: Check code formatting with Black
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Checkout
15 | uses: actions/checkout@v2
16 | - name: Set up Python 3.8
17 | uses: actions/setup-python@v2
18 | with:
19 | python-version: 3.8
20 | - name: Install Black
21 | run: pip install black[jupyter]
22 | - name: Run Black
23 | run: black --check .
24 |
25 | imports-check-isort:
26 | name: Check valid import formatting with isort
27 | runs-on: ubuntu-latest
28 | steps:
29 | - name: Checkout
30 | uses: actions/checkout@v2
31 | - name: Set up Python 3.8
32 | uses: actions/setup-python@v2
33 | with:
34 | python-version: 3.8
35 | - name: Install isort
36 | run: pip install isort==5.6.4
37 | - name: Run isort
38 | run: isort --check-only --diff .
39 |
40 | linter-flake8:
41 | name: Check valid formatting with flake8
42 | runs-on: ubuntu-latest
43 | timeout-minutes: 10
44 | steps:
45 | - name: Checkout
46 | uses: actions/checkout@v2
47 | - uses: actions/setup-python@v2
48 | with:
49 | python-version: 3.8
50 |
51 | - name: Install dependencies
52 | run: pip install flake8
53 | - name: Run checks
54 | run: flake8
55 |
56 |
57 | pre-commit-hooks:
58 | name: Check that pre-commit hooks pass
59 | runs-on: ubuntu-latest
60 | timeout-minutes: 10
61 | steps:
62 | - name: Checkout
63 | uses: actions/checkout@v2
64 | - uses: actions/setup-python@v2
65 | with:
66 | python-version: 3.8
67 | - name: Install dependencies
68 | run: pip install pre-commit
69 |
70 | - name: Run checks
71 | run: pre-commit run --all-files
72 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # This action runs GitHub's industry-leading static analysis engine, CodeQL, against a repository's source code to find security vulnerabilities.
2 | # https://github.com/github/codeql-action
3 |
4 | name: "CodeQL"
5 |
6 | on:
7 | # push:
8 | # branches: [master, main]
9 | # pull_request:
10 | # branches: [master, main]
11 | schedule:
12 | - cron: '0 0 15 3 *' # Runs at 00:00 UTC on the 15th of every March
13 |
14 | jobs:
15 | analyze:
16 | name: Analyze
17 | runs-on: ubuntu-latest
18 |
19 | strategy:
20 | fail-fast: false
21 | matrix:
22 | language: ['python']
23 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
24 |
25 | steps:
26 | - name: Checkout repository
27 | uses: actions/checkout@v3
28 |
29 | # Initializes the CodeQL tools for scanning.
30 | - name: Initialize CodeQL
31 | uses: github/codeql-action/init@v2
32 | with:
33 | languages: ${{ matrix.language }}
34 | # If you wish to specify custom queries, you can do so here or in a config file.
35 | # By default, queries listed here will override any specified in a config file.
36 | # Prefix the list here with "+" to use these queries and those in the config file.
37 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
38 |
39 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
40 | # If this step fails, then you should remove it and run the build manually (see below)
41 | - name: Autobuild
42 | uses: github/codeql-action/autobuild@v2
43 |
44 | # ℹ️ Command-line programs to run using the OS shell.
45 | # 📚 https://git.io/JvXDl
46 |
47 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
48 | # and modify them (or add more) to build your code if your project
49 | # uses a compiled language
50 |
51 | #- run: |
52 | # make bootstrap
53 | # make release
54 |
55 | - name: Perform CodeQL Analysis
56 | uses: github/codeql-action/analyze@v2
--------------------------------------------------------------------------------
/docs/source/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # This file only contains a selection of the most common options. For a full
4 | # list see the documentation:
5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
6 |
7 | # -- Path setup --------------------------------------------------------------
8 |
9 | # If extensions (or modules to document with autodoc) are in another directory,
10 | # add these directories to sys.path here. If the directory is relative to the
11 | # documentation root, use os.path.abspath to make it absolute, like shown here.
12 | #
13 | import os
14 | import shutil
15 | import sys
16 | from pathlib import Path
17 |
18 | SOURCE_PATH = Path(os.path.dirname(__file__)) # noqa # docs source
19 | PROJECT_PATH = SOURCE_PATH.joinpath("../..") # noqa # project root
20 |
21 |
22 | # -- Project information -----------------------------------------------------
23 |
24 | project = "python-ProFeld"
25 | copyright = "2022, Longxing Tan"
26 | author = "Longxing Tan"
27 |
28 |
29 | # -- General configuration ---------------------------------------------------
30 |
31 | # Add any Sphinx extension module names here, as strings. They can be
32 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33 | # ones.
34 | extensions = []
35 |
36 | # Add any paths that contain templates here, relative to this directory.
37 | templates_path = ["_templates"]
38 |
39 | # List of patterns, relative to source directory, that match files and
40 | # directories to ignore when looking for source files.
41 | # This pattern also affects html_static_path and html_extra_path.
42 | exclude_patterns = []
43 |
44 |
45 | # -- Options for HTML output -------------------------------------------------
46 |
47 | # The theme to use for HTML and HTML Help pages. See the documentation for
48 | # a list of builtin themes.
49 | #
50 | html_theme = "alabaster"
51 |
52 | # Add any paths that contain custom static files (such as style sheets) here,
53 | # relative to this directory. They are copied after the builtin static files,
54 | # so a file named "default.css" will overwrite the builtin "default.css".
55 | html_static_path = ["_static"]
56 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.black]
2 | line-length = 120
3 | include = '\.pyi?$'
4 | exclude = '''
5 | (
6 | /(
7 | \.eggs # exclude a few common directories in the
8 | | \.git # root of the project
9 | | \.hg
10 | | \.mypy_cache
11 | | \.tox
12 | | \.venv
13 | | _build
14 | | buck-out
15 | | build
16 | | dist
17 | )/
18 | | docs/build/
19 | | node_modules/
20 | | venve/
21 | | .venv/
22 | )
23 | '''
24 |
25 | [tool.nbqa.mutate]
26 | isort = 1
27 | black = 1
28 |
29 | [tool.poetry]
30 | name = "profeld"
31 | readme = "README.md" # Markdown files are supported
32 | version = "0.0.1" # is being replaced automatically
33 |
34 | authors = ["Longxing Tan"]
35 | classifiers = [
36 | "Intended Audience :: Developers",
37 | "Intended Audience :: Science/Research",
38 | "Programming Language :: Python :: 3",
39 | "Programming Language :: Python :: 3.7",
40 | "Programming Language :: Python :: 3.8",
41 | "Programming Language :: Python :: 3.9",
42 | "Topic :: Scientific/Engineering",
43 | "Topic :: Scientific/Engineering :: Mathematics",
44 | "Topic :: Scientific/Engineering :: Artificial Intelligence",
45 | "Topic :: Software Development",
46 | "Topic :: Software Development :: Libraries",
47 | "Topic :: Software Development :: Libraries :: Python Modules",
48 | "License :: OSI Approved :: MIT License"]
49 | description = "Survival analysis and predictive maintenance library with Python"
50 | repository = "https://github.com/LongxingTan/python-profeld"
51 | documentation = "https://python-profeld.readthedocs.io"
52 | homepage = "https://python-profeld.readthedocs.io"
53 |
54 | [tool.poetry.dependencies]
55 | python = ">=3.7,<3.11"
56 |
57 | tensorflow = "^2.4.1"
58 | pandas = "^1.1.0"
59 | scikit-learn = ">=0.24,<1.2"
60 | matplotlib = "*"
61 |
62 | [tool.poetry.dev-dependencies]
63 | # checks and make tools
64 | pre-commit = "^2.20.0"
65 | invoke = "*"
66 | flake8 = "*"
67 | mypy = "*"
68 | pylint = "*"
69 | isort = "*"
70 | coverage = "*"
71 |
72 | # jupyter notebook
73 | ipykernel = "*"
74 | black = { version = "*", allow-prereleases = true, extras = ["jupyter"] }
75 |
76 | # documentatation
77 | sphinx = "*"
78 | pydata-sphinx-theme = "*"
79 | nbsphinx = "*"
80 | # pandoc = "*"
81 | recommonmark = "*"
82 | ipywidgets = "^8.0.1"
83 |
84 | [tool.poetry-dynamic-versioning]
85 | enable = true
86 | vcs = "git"
87 | dirty = false
88 | style = "semver" # semantic versioning
89 |
90 | [build-system] # make the package pip installable
91 | requires = ["poetry-core>=1.0.7", "poetry-dynamic-versioning>=0.13.1"]
92 | build-backend = "poetry.core.masonry.api"
93 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [license-image]: https://img.shields.io/badge/License-MIT-blue.svg
2 | [license-url]: https://opensource.org/licenses/MIT
3 | [pypi-image]: https://badge.fury.io/py/python-profeld.svg
4 | [pypi-url]: https://pypi.python.org/pypi/python-profeld
5 | [build-image]: https://github.com/LongxingTan/python-profeld/actions/workflows/test.yml/badge.svg?branch=master
6 | [build-url]: https://github.com/LongxingTan/python-profeld/actions/workflows/test.yml?query=branch%3Amaster
7 | [lint-image]: https://github.com/LongxingTan/python-profeld/actions/workflows/lint.yml/badge.svg
8 | [lint-url]: https://github.com/LongxingTan/python-profeld/actions/workflows/lint.yml
9 | [docs-image]: https://readthedocs.org/projects/python-profeld/badge/?version=latest
10 | [docs-url]: https://python-profeld.readthedocs.io/en/latest/
11 |
12 |
13 |
14 |
15 |
16 | [![LICENSE][license-image]][license-url]
17 | [![PyPI Version][pypi-image]][pypi-url]
18 | [![Build Status][build-image]][build-url]
19 | [![Lint Status][lint-image]][lint-url]
20 | [![Docs Status][docs-image]][docs-url]
21 |
22 | **[Documentation](https://python-profeld.readthedocs.io)** | **[Tutorials](https://python-profeld.readthedocs.io/en/latest/tutorials.html)** | **[Release Notes](https://python-profeld.readthedocs.io/en/latest/CHANGELOG.html)** | **[中文](./README_CN.md)**
23 |
24 | **python-profeld** is a python library for survival analysis and predictive maintenance. It's named after and inspired by the reliability software I used in Daimler, but python-profeld is more powerful.
25 |
26 | ## Tutorial
27 |
28 | ### Installation
29 |
30 | ```shell
31 | $ pip install profeld
32 | ```
33 |
34 | ### Usage
35 |
36 | ```python
37 | import profeld
38 |
39 |
40 | ```
41 |
42 | ## Examples
43 |
44 | ```python
45 |
46 | ```
47 |
48 | ## Acknowledgements
49 |
50 | Survival analysis, is important for me. This is where my career started, after graduation I joined Mercedes and worked as a pioneer in automotive field quality. It's still a dream time to work together with Dr. Andreas Jacobi and Christoph Jordan to predict the vehicle performance, and we really made a difference with ProFeld and helped Mercedes customers to have a better product. (Even so, I can never afford one, just like thousand years ago the Chinese poet said: 遍身罗绮者,不是养蚕人)
51 |
52 | After that, I continue implementing predictive maintenance applications for industry until 2023. Cheers for the great time! It's nice to share some tutorials and insights here, just like they once taught me since my first working day in Beijing and Stuttgart. I consider this repo as a witness of the pleasant time we spent together. May this repo also bring my regards to Ling, Bolin, Haihang, Yi, Fanny, Frank, Qing, Yiren, Kim, Rui, Lankai, Lei, Prof Luy, the whole Stuttgart Reliability team, and Beijing QFS team.
53 |
--------------------------------------------------------------------------------
/docs/source/_static/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3 |
4 | name: Test
5 |
6 | on:
7 | push:
8 | branches: [master, dev]
9 | pull_request:
10 | branches: [master, dev]
11 |
12 | jobs:
13 | build:
14 | runs-on: ${{ matrix.os }}
15 | strategy:
16 | matrix:
17 | os: [ubuntu-latest, macOS-latest] # add windows-2019 when poetry allows installation with `-f` flag
18 | python-version: [3.8, 3.9] # python 3.9 is not supported by all dependencies yet
19 |
20 | steps:
21 | - uses: actions/checkout@v2
22 |
23 | - name: Set up Python ${{ matrix.python-version }}
24 | uses: actions/setup-python@v2
25 | with:
26 | python-version: ${{ matrix.python-version }}
27 |
28 | - name: Get full Python version
29 | id: full-python-version
30 | shell: bash
31 | run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
32 |
33 | - name: Install poetry
34 | shell: bash
35 | run: |
36 | curl -sSL https://install.python-poetry.org | python3 -
37 | - name: Set poetry path variable
38 | run: echo "/Users/runner/.local/bin" >> $GITHUB_PATH
39 |
40 | - name: Configure poetry
41 | shell: bash
42 | run: poetry config virtualenvs.in-project true
43 |
44 | - name: Set up cache
45 | uses: actions/cache@v2
46 | id: cache
47 | with:
48 | path: .venv
49 | key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
50 |
51 | - name: Ensure cache is healthy
52 | if: steps.cache.outputs.cache-hit == 'true'
53 | shell: bash
54 | run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
55 |
56 | - name: Upgrade pip
57 | shell: bash
58 | run: poetry run python -m pip install pip -U
59 |
60 | - name: Install dependencies
61 | shell: bash
62 | run: poetry install --no-interaction --no-root
63 |
64 | - name: Run unittest
65 | shell: bash
66 | run: poetry run coverage run -m unittest discover -s ./tests -p 'test_*.py'
67 |
68 | - name: Statistics
69 | if: success()
70 | run: |
71 | poetry run coverage report -i
72 | poetry run coverage xml -i
73 |
74 | - name: Upload coverage to Codecov
75 | uses: codecov/codecov-action@v3
76 | if: always()
77 | continue-on-error: true
78 | with:
79 | token: ${{ secrets.CODECOV_TOKEN }}
80 | file: coverage.xml
81 | flags: cpu, unittest
82 | name: CPU-coverage
83 | fail_ci_if_error: false
84 |
85 | docs:
86 | name: Test docs build
87 | runs-on: ubuntu-latest
88 |
89 | steps:
90 | - name: Check out Git repository
91 | uses: actions/checkout@v2
92 |
93 | - name: Set up Python
94 | uses: actions/setup-python@v1
95 | with:
96 | python-version: 3.8
97 |
98 | - name: Cache pip
99 | uses: actions/cache@v2
100 | with:
101 | path: ~/.cache/pip
102 | key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements_docs.txt') }}
103 | restore-keys: |
104 | ${{ runner.os }}-pip-
105 |
106 | - name: Install dependencies
107 | run: |
108 | sudo apt-get update && sudo apt-get install -y pandoc
109 | python -m pip install --upgrade pip
110 | pip install -r docs/requirements_docs.txt
111 | shell: bash
112 |
113 | - name: Build sphinx documentation
114 | run: |
115 | cd docs
116 | make clean
117 | make html --debug --jobs 2 SPHINXOPTS="-W"
118 |
119 | - name: Upload built docs
120 | uses: actions/upload-artifact@v2
121 | with:
122 | name: docs-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}
123 | path: docs/build/html/
124 | # Use always() to always run this step to publish test results when there are test failures
125 | if: success()
126 |
--------------------------------------------------------------------------------