├── .gitignore ├── .readthedocs.yaml ├── HereWeGo.ipynb ├── LICENSE ├── README.md ├── docs ├── Makefile ├── environment.yml ├── make.bat └── source │ ├── _static │ ├── custom.css │ └── images │ │ └── logo.png │ ├── conf.py │ ├── help │ ├── faq.rst │ └── how_to_get_support.rst │ ├── index.rst │ ├── installation.rst │ ├── quant │ └── quant.ipynb │ ├── quickstart.rst │ ├── release_notes.rst │ ├── tutorials │ ├── tutorials_assess.ipynb │ ├── tutorials_model.ipynb │ ├── tutorials_modify.ipynb │ ├── tutorials_sample-Copy1.ipynb │ ├── tutorials_sample.ipynb │ └── tutorials_version.ipynb │ └── utils │ └── utils.ipynb ├── environment.yml ├── pyproject.toml ├── static ├── auc_ks.png ├── corr.png ├── cut_woe_iv.png ├── feature_selection.png ├── get_lift.png ├── get_psi.png ├── get_scorecard.png ├── gitee.png ├── github.png ├── iv_distribution.png ├── logo.png ├── logo2.png ├── plot_ks.png ├── predict_score.png ├── pyminer.png ├── pypi.png ├── qcut_woe_iv.png ├── tree_iv.png └── view_woe_iv.png └── westat ├── __init__.py ├── assess ├── __init__.py ├── get_auc.py ├── get_auc_by_card.py ├── get_data_psi.py ├── get_ks.py ├── get_ks_by_card.py ├── get_psi.py ├── get_score_distribution.py ├── get_vif.py ├── plot_ks.py ├── plot_lift.py └── plot_roc_ks.py ├── core ├── Scorecard.py ├── __init__.py ├── column.py └── table.py ├── data ├── CreditCard.xls ├── GiveMeSomeCredit │ ├── Data Dictionary.xls │ ├── cs-test.csv │ ├── cs-training.csv │ └── sampleEntry.csv └── UCI_Credit_Card.csv ├── dataframe_to_table.py ├── dataset.py ├── explore ├── __init__.py ├── check_data_target.py ├── get_data_check.py ├── get_data_describe.py ├── get_data_distribution.py ├── plot_counts.py └── proc_means.py ├── logger.py ├── model ├── __init__.py ├── feature_selection.py ├── finance.py ├── get_bins.py ├── get_chi2.py ├── get_data_bins.py ├── get_data_discrete.py ├── get_data_iv.py ├── get_data_type.py ├── get_data_woe.py ├── get_entropy.py ├── get_model_iv.py ├── get_predict_score.py ├── get_scorecard.py ├── get_tree_bins.py ├── get_woe_iv.py ├── get_woe_transform.py ├── gini_impurity.py ├── logistic.py ├── plot_corr.py ├── plot_iv.py ├── plot_woe.py ├── statistic.py ├── stepwise_forward.py ├── stepwise_lr.py └── tree │ ├── __init__.py │ ├── graphviz │ ├── __init__.py │ ├── _compat.py │ ├── _defaults.py │ ├── _tools.py │ ├── backend │ │ ├── __init__.py │ │ ├── dot_command.py │ │ ├── execute.py │ │ ├── mixins.py │ │ ├── piping.py │ │ ├── rendering.py │ │ ├── unflattening.py │ │ ├── upstream_version.py │ │ └── viewing.py │ ├── base.py │ ├── copying.py │ ├── dot.py │ ├── encoding.py │ ├── exceptions.py │ ├── graphs.py │ ├── jupyter_integration.py │ ├── parameters │ │ ├── __init__.py │ │ ├── base.py │ │ ├── engines.py │ │ ├── formats.py │ │ ├── formatters.py │ │ ├── mixins.py │ │ └── renderers.py │ ├── piping.py │ ├── quoting.py │ ├── rendering.py │ ├── saving.py │ ├── sources.py │ └── unflattening.py │ ├── plot_tree.py │ ├── tree_to_img.py │ └── tree_to_pdf.py ├── modify ├── __init__.py ├── processes │ └── __init__.py └── set_update_bins.py ├── plugins └── win │ └── Graphviz │ ├── Uninstall.exe │ ├── bin │ ├── acyclic.exe │ ├── bcomps.exe │ ├── cairo.dll │ ├── ccomps.exe │ ├── cdt.dll │ ├── cgraph++.dll │ ├── cgraph.dll │ ├── circo.exe │ ├── concrt140.dll │ ├── config6 │ ├── dijkstra.exe │ ├── dot.exe │ ├── dot2gxl.exe │ ├── edgepaint.exe │ ├── expat.dll │ ├── fdp.exe │ ├── fontconfig.dll │ ├── gc.exe │ ├── getopt.dll │ ├── glib-2.dll │ ├── gml2gv.exe │ ├── gobject-2.dll │ ├── graphml2gv.exe │ ├── gv2gml.exe │ ├── gvc++.dll │ ├── gvc.dll │ ├── gvcolor.exe │ ├── gvgen.exe │ ├── gvmap.exe │ ├── gvmap.sh │ ├── gvpack.exe │ ├── gvplugin_core.dll │ ├── gvplugin_dot_layout.dll │ ├── gvplugin_gdiplus.dll │ ├── gvplugin_neato_layout.dll │ ├── gvplugin_pango.dll │ ├── gvplugin_visio.dll │ ├── gvpr.exe │ ├── gxl2gv.exe │ ├── libharfbuzz-0.dll │ ├── mm2gv.exe │ ├── msvcp140.dll │ ├── msvcp140_1.dll │ ├── msvcp140_2.dll │ ├── msvcp140_codecvt_ids.dll │ ├── neato.exe │ ├── nop.exe │ ├── osage.exe │ ├── pango-1.dll │ ├── pangocairo-1.dll │ ├── pangoft2-1.dll │ ├── pangowin32-1.dll │ ├── patchwork.exe │ ├── pathplan.dll │ ├── pixman-1.dll │ ├── sccmap.exe │ ├── sfdp.exe │ ├── tred.exe │ ├── twopi.exe │ ├── unflatten.exe │ ├── vcruntime140.dll │ ├── vcruntime140_1.dll │ └── xdot.dll │ ├── include │ └── graphviz │ │ ├── AGraph.h │ │ ├── GVContext.h │ │ ├── GVLayout.h │ │ ├── GVRenderData.h │ │ ├── arith.h │ │ ├── cdt.h │ │ ├── cgraph.h │ │ ├── color.h │ │ ├── geom.h │ │ ├── graphviz_version.h │ │ ├── gvc.h │ │ ├── gvcext.h │ │ ├── gvcjob.h │ │ ├── gvcommon.h │ │ ├── gvconfig.h │ │ ├── gvplugin.h │ │ ├── gvplugin_device.h │ │ ├── gvplugin_layout.h │ │ ├── gvplugin_loadimage.h │ │ ├── gvplugin_render.h │ │ ├── gvplugin_textlayout.h │ │ ├── pack.h │ │ ├── pathgeom.h │ │ ├── pathplan.h │ │ ├── textspan.h │ │ ├── types.h │ │ ├── usershape.h │ │ └── xdot.h │ └── share │ ├── graphviz │ └── graphs │ │ ├── directed │ │ ├── KW91.gv │ │ ├── Latin1.gv │ │ ├── NaN.gv │ │ ├── abstract.gv │ │ ├── alf.gv │ │ ├── arrows.gv │ │ ├── awilliams.gv │ │ ├── biological.gv │ │ ├── clust.gv │ │ ├── clust1.gv │ │ ├── clust2.gv │ │ ├── clust3.gv │ │ ├── clust4.gv │ │ ├── clust5.gv │ │ ├── crazy.gv │ │ ├── ctext.gv │ │ ├── dfa.gv │ │ ├── fig6.gv │ │ ├── fsm.gv │ │ ├── grammar.gv │ │ ├── hashtable.gv │ │ ├── honda-tokoro.gv │ │ ├── japanese.gv │ │ ├── jcctree.gv │ │ ├── jsort.gv │ │ ├── ldbxtried.gv │ │ ├── longflat.gv │ │ ├── mike.gv │ │ ├── nhg.gv │ │ ├── oldarrows.gv │ │ ├── pgram.gv │ │ ├── pm2way.gv │ │ ├── pmpipe.gv │ │ ├── polypoly.gv │ │ ├── proc3d.gv │ │ ├── psfonttest.gv │ │ ├── record2.gv │ │ ├── records.gv │ │ ├── rowe.gv │ │ ├── russian.gv │ │ ├── sdh.gv │ │ ├── shells.gv │ │ ├── states.gv │ │ ├── structs.gv │ │ ├── switch.gv │ │ ├── table.gv │ │ ├── train11.gv │ │ ├── trapeziumlr.gv │ │ ├── tree.gv │ │ ├── triedds.gv │ │ ├── try.gv │ │ ├── unix.gv │ │ ├── unix2.gv │ │ ├── viewfile.gv │ │ └── world.gv │ │ └── undirected │ │ ├── ER.gv │ │ ├── Heawood.gv │ │ ├── Petersen.gv │ │ ├── ngk10_4.gv │ │ └── process.gv │ └── man │ ├── man1 │ ├── acyclic.1 │ ├── bcomps.1 │ ├── ccomps.1 │ ├── dijkstra.1 │ ├── dot.1 │ ├── edgepaint.1 │ ├── gc.1 │ ├── gml2gv.1 │ ├── graphml2gv.1 │ ├── gvcolor.1 │ ├── gvgen.1 │ ├── gvmap.1 │ ├── gvpack.1 │ ├── gvpr.1 │ ├── gxl2gv.1 │ ├── mm2gv.1 │ ├── nop.1 │ ├── osage.1 │ ├── patchwork.1 │ ├── sccmap.1 │ ├── tred.1 │ └── unflatten.1 │ └── man3 │ ├── cdt.3 │ ├── cgraph.3 │ ├── gvc.3 │ ├── pack.3 │ ├── pathplan.3 │ └── xdot.3 ├── quant ├── __init__.py ├── get_stock.py ├── get_stock_i.py ├── get_stock_index.py ├── get_stock_m.py └── get_stock_pk.py ├── sample ├── __init__.py └── get_data_partition.py └── utils ├── __init__.py ├── datetime.py ├── device.py ├── export └── to_csv.py ├── get_max_continue.py ├── get_over_continue.py ├── growth_rate.py ├── math.py ├── nvl.py ├── path.py ├── rate.py ├── regexp_like.py ├── regexp_replace.py ├── set_precision.py ├── to_multi_byte.py └── to_single_byte.py /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 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 | # Set the OS, Python version and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "miniconda3-4.7" 13 | # You can also specify other tool versions: 14 | # nodejs: "19" 15 | # rust: "1.64" 16 | # golang: "1.19" 17 | 18 | # Build documentation in the "docs/" directory with Sphinx 19 | sphinx: 20 | configuration: docs/source/conf.py 21 | 22 | # Optionally build your docs in additional formats such as PDF and ePub 23 | # formats: 24 | # - pdf 25 | # - epub 26 | 27 | conda: 28 | environment: docs/environment.yml 29 | 30 | # Optional but recommended, declare the Python requirements required 31 | # to build your documentation 32 | # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 33 | #python: 34 | # install: 35 | # - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/environment.yml: -------------------------------------------------------------------------------- 1 | name: westat-doc 2 | channels: 3 | - conda-forge 4 | - defaults 5 | dependencies: 6 | 7 | # documentation 8 | - nbsphinx 9 | - pandoc 10 | - ipykernel 11 | 12 | - pip: 13 | - sphinx-rtd-theme 14 | - readthedocs-sphinx-search -------------------------------------------------------------------------------- /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 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 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 | -------------------------------------------------------------------------------- /docs/source/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* Navigator and sidebar colors */ 2 | .wy-side-nav-search, .wy-nav-top { 3 | background: #326d62; 4 | } 5 | 6 | .wy-menu-vertical a:active { 7 | background: #30bba3; 8 | } 9 | 10 | .wy-side-nav-search>div.version { 11 | color: #d8d8d8; 12 | } 13 | 14 | .wy-side-nav-search>a img.logo, .wy-side-nav-search .wy-dropdown>a img.logo { 15 | display: block; 16 | margin: 0 auto; 17 | height: 20%; 18 | width: 20%; 19 | border-radius: 0; 20 | max-width: 100%; 21 | background: transparent; 22 | } 23 | 24 | .wy-menu-vertical header, .wy-menu-vertical p.caption { 25 | color: #30bba3; 26 | } 27 | 28 | /* Class/function declaration colors */ 29 | .rst-content dl:not(.docutils) dt { 30 | background: #daf2ee; 31 | color: #326d62; 32 | border-top: solid 3px #30bba3; 33 | } 34 | 35 | 36 | /* Links colors */ 37 | a { 38 | color: #30bba3; 39 | } 40 | 41 | .wy-nav-content a:hover { 42 | color: #326d62; 43 | } 44 | 45 | .wy-nav-content a:visited:hover { 46 | color: #9B59B6; 47 | } 48 | -------------------------------------------------------------------------------- /docs/source/_static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/docs/source/_static/images/logo.png -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # For the full list of built-in configuration values, see the documentation: 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 5 | 6 | # -- Project information ----------------------------------------------------- 7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. 11 | import pathlib 12 | import sys 13 | sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix()) 14 | 15 | 16 | project = 'westat' 17 | copyright = '2023, westat team' 18 | author = 'westat team' 19 | release = '0.2.3' 20 | version = '0.2.3' 21 | # -- General configuration --------------------------------------------------- 22 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 23 | 24 | extensions = [ 25 | 'sphinx.ext.duration', 26 | 'sphinx.ext.doctest', 27 | 'sphinx.ext.autodoc', 28 | 'sphinx.ext.autosummary', 29 | 'sphinx.ext.napoleon', 30 | 'sphinx.ext.mathjax', 31 | 'sphinx.ext.autosectionlabel', 32 | 'nbsphinx', 33 | ] 34 | 35 | templates_path = ['_templates'] 36 | exclude_patterns = [] 37 | 38 | language = 'zh_CN' 39 | 40 | # -- Options for HTML output ------------------------------------------------- 41 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 42 | 43 | html_theme = "sphinx_rtd_theme" # pydata_sphinx_theme press,sphinx_rtd_theme 44 | 45 | html_theme_options = { 46 | 'logo_only': True 47 | } 48 | html_show_sourcelink = False 49 | html_static_path = ['_static'] 50 | html_logo = '_static/images/logo.png' 51 | html_favicon = '_static/images/logo.png' 52 | html_css_files = [ 53 | 'custom.css', 54 | ] 55 | 56 | 57 | 58 | # EPUB options 59 | epub_show_urls = 'footnote' 60 | 61 | source_suffix = { 62 | '.rst': 'restructuredtext', 63 | '.txt': 'restructuredtext', 64 | '.md': 'markdown', 65 | } 66 | 67 | # ext sphinxcontrib.bibtex options 68 | bibtex_bibfiles = ['refs.bib'] 69 | -------------------------------------------------------------------------------- /docs/source/help/faq.rst: -------------------------------------------------------------------------------- 1 | 常见问题 2 | ===== 3 | 4 | .. _faq: 5 | 6 | 决策树绘制图形不显示 7 | ------------ 8 | 9 | .. note:: 10 | 11 | 在westat 内部已经集成了Graphviz插件,但是当前仅支持windows系统进行决策树绘图,如果您需要在其他系统环境使用,请安装相关系统环境对应的了Graphviz插件 12 | 13 | -------------------------------------------------------------------------------- /docs/source/help/how_to_get_support.rst: -------------------------------------------------------------------------------- 1 | 如何获取帮助 2 | ===== 3 | 4 | .. _how_to_get_support: 5 | 6 | 邮件反馈 7 | ------------ 8 | 9 | 在使用westat过程中,如果遇到任何问题,您都可以通过以下邮箱进行反馈: 10 | 11 | .. note:: 12 | 13 | westat@foxmail.com 14 | 15 | 16 | QQ群反馈 17 | ---------------- 18 | 19 | 如果您也可以通过下列QQ群号加入开发组QQ群,直接反馈相关问题,开发人员看到后可以立即与您沟通 20 | 21 | .. note:: 22 | 23 | QQ群号: 945391275 24 | 25 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | westat: 金融统计工具箱 2 | =================================== 3 | 4 | **westat** 是一个用于金融行业信用风险模型开发的python库,其中严格遵循 ``SEMMA`` 数据分析方法论,此外,我们在westat中也增加了一些常用的数据分析、统计、量化等相关内容。 `westat `_ 致力于提供 *简单* 且 5 | *高效* 的统计工具箱. 6 | 7 | .. note:: 8 | 9 | westat 致力于更好的金融统计! 10 | 11 | 目录 12 | -------- 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | :caption: 安装 17 | 18 | installation 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :caption: 快速开始 23 | 24 | tutorials/tutorials_version 25 | 26 | .. toctree:: 27 | :maxdepth: 1 28 | :caption: 数据准备 29 | 30 | tutorials/tutorials_sample 31 | 32 | .. toctree:: 33 | :maxdepth: 1 34 | :caption: 数据探索 35 | 36 | tutorials/tutorials_explore 37 | 38 | .. toctree:: 39 | :maxdepth: 1 40 | :caption: 数据处理 41 | 42 | tutorials/tutorials_modify 43 | 44 | .. toctree:: 45 | :maxdepth: 1 46 | :caption: 模型开发 47 | 48 | tutorials/tutorials_model 49 | 50 | .. toctree:: 51 | :maxdepth: 1 52 | :caption: 模型评估 53 | 54 | tutorials/tutorials_assess 55 | 56 | .. toctree:: 57 | :maxdepth: 1 58 | :caption: 量化分析 59 | 60 | quant/quant 61 | 62 | .. toctree:: 63 | :maxdepth: 1 64 | :caption: 工具函数 65 | 66 | utils/utils 67 | 68 | .. toctree:: 69 | :maxdepth: 1 70 | :caption: 获取帮助 71 | 72 | help/faq 73 | help/how_to_get_support 74 | 75 | .. toctree:: 76 | :maxdepth: 1 77 | :caption: 发布日志 78 | 79 | release_notes 80 | -------------------------------------------------------------------------------- /docs/source/installation.rst: -------------------------------------------------------------------------------- 1 | 安装 2 | ===== 3 | 4 | .. _installation: 5 | 6 | 一、使用pip在线安装 7 | ------------ 8 | 9 | 如果你正在 ``pip`` ,你可以使用如下命令,通过 ``pip`` 联网下载最新版本并进行安装: 10 | 11 | 12 | .. code-block:: console 13 | 14 | $ pip install westat 15 | 16 | 17 | 二、使用pip离线安装 18 | ------------ 19 | 20 | 如果你正在 ``pip`` ,你可以使用如下命令,通过 ``pip`` 联网下载最新版本,打包后,在离线环境内进行安装: 21 | 22 | 1、联网下载 westat 和相关依赖包 23 | 24 | 保存到当前目录下的westat文件夹: 25 | 26 | 27 | .. code-block:: console 28 | 29 | $ pip download -d ./westat westat 30 | 31 | 32 | 2、离线安装 westat 和相关依赖包 33 | 34 | 将 westat 存放到指定的离线环境,在目录下执行如下命令 35 | 36 | 37 | .. code-block:: console 38 | 39 | $ pip install --no-index --find-links=.westat/ westat 40 | 41 | 42 | 三、使用conda在线安装 43 | ------------ 44 | 45 | 如果你正在 ``conda`` ,你可以使用如下命令,通过 conda 联网下载最新版本并进行安装: 46 | 47 | 48 | .. code-block:: console 49 | 50 | $ conda install westat 51 | 52 | -------------------------------------------------------------------------------- /docs/source/quickstart.rst: -------------------------------------------------------------------------------- 1 | 快速入门 2 | ===== 3 | 4 | .. _quickstart: 5 | 6 | 一、方法论 7 | ------------ 8 | 9 | westat的整体方法论和代码框架基于 ``SEMMA`` ,它是由SAS研究院开发的一款非常著名的数据挖掘与分析方法, ``SEMMA`` 分别是抽样(Sample)、探索(Explore)、修订(Modify)、建模(Model)和评估(Assess)的英文首字母缩写。 10 | 11 | 12 | 二、示例代码 13 | ---------------- 14 | 15 | 在westat的源码仓库和安装后 ``examples`` 文件夹内,我们增加了一个名为 ``HereWeGo.ipynb`` 的代码示例文件,该文件是 ``jupyter-notebook`` 格式的Python脚本,你可以将该文件复制到jupyter的工作目录进行查看。 16 | 17 | 18 | 三、快速开始 19 | ---------------- 20 | 21 | .. code-block:: console 22 | 23 | $ import westat as we 24 | $ we.version -------------------------------------------------------------------------------- /docs/source/release_notes.rst: -------------------------------------------------------------------------------- 1 | 发布日志 2 | ===== 3 | 4 | .. _release_notes: 5 | 6 | Version 0.2.3 (2023-06-29) 7 | ------------ 8 | 9 | 修改: 10 | 11 | 1、woe_iv 函数新增optbinning 分箱,可选设置最大分箱数,并设置分箱单调性 12 | 13 | 14 | Version 0.2.2 (2023-06-28) 15 | ------------ 16 | 17 | 修改: 18 | 19 | 1、根据sphinx构建并完善产品文档 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/source/tutorials/tutorials_modify.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "2a25c5b8", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "from westat import *\n", 11 | "\n", 12 | "# 导入 UCI_Credit_Card\n", 13 | "data = credit_card()\n", 14 | "\n", 15 | "# 将目标变量重命名为“y”\n", 16 | "data.rename(columns={'target':'y'},inplace=True)" 17 | ] 18 | }, 19 | { 20 | "cell_type": "markdown", 21 | "id": "92e9f950", 22 | "metadata": {}, 23 | "source": [ 24 | "## 数据分区" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 2, 30 | "id": "bd2dfdc5", 31 | "metadata": { 32 | "scrolled": true 33 | }, 34 | "outputs": [], 35 | "source": [ 36 | "# 使用 data_split 函数进行数据分区,或者使用别名函数 get_data_partition,按随机测试集25%进行数据分区\n", 37 | "data_train,data_test = data_split(data,0.25)" 38 | ] 39 | } 40 | ], 41 | "metadata": { 42 | "kernelspec": { 43 | "display_name": "Python 3 (ipykernel)", 44 | "language": "python", 45 | "name": "python3" 46 | }, 47 | "language_info": { 48 | "codemirror_mode": { 49 | "name": "ipython", 50 | "version": 3 51 | }, 52 | "file_extension": ".py", 53 | "mimetype": "text/x-python", 54 | "name": "python", 55 | "nbconvert_exporter": "python", 56 | "pygments_lexer": "ipython3", 57 | "version": "3.10.9" 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 5 62 | } 63 | -------------------------------------------------------------------------------- /docs/source/tutorials/tutorials_version.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "6b5a5d08", 6 | "metadata": {}, 7 | "source": [ 8 | "## 查看westat版本号和安装路径" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 1, 14 | "id": "b5995cd6", 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "name": "stdout", 19 | "output_type": "stream", 20 | "text": [ 21 | "version: 0.2.1\n", 22 | "path: ['C:\\\\Users\\\\about\\\\anaconda3\\\\lib\\\\site-packages\\\\westat']\n" 23 | ] 24 | } 25 | ], 26 | "source": [ 27 | "import westat as we\n", 28 | "\n", 29 | "print('version:',we.version)\n", 30 | "print('path:',we.__path__)" 31 | ] 32 | } 33 | ], 34 | "metadata": { 35 | "kernelspec": { 36 | "display_name": "Python 3 (ipykernel)", 37 | "language": "python", 38 | "name": "python3" 39 | }, 40 | "language_info": { 41 | "codemirror_mode": { 42 | "name": "ipython", 43 | "version": 3 44 | }, 45 | "file_extension": ".py", 46 | "mimetype": "text/x-python", 47 | "name": "python", 48 | "nbconvert_exporter": "python", 49 | "pygments_lexer": "ipython3", 50 | "version": "3.10.9" 51 | } 52 | }, 53 | "nbformat": 4, 54 | "nbformat_minor": 5 55 | } 56 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: westat-dev 2 | channels: 3 | - conda-forge 4 | - defaults 5 | dependencies: 6 | - python=3.10 7 | - pip 8 | # 依赖 9 | - numpy 10 | - pandas 11 | - matplotlib 12 | - seaborn 13 | - scikit-learn 14 | - scipy 15 | - statsmodels 16 | - tqdm 17 | - openpyxl 18 | - ipywidgetscon 19 | 20 | # 测试 21 | - notebook 22 | 23 | 24 | - pip: 25 | # 构建python包 26 | - build 27 | - twine 28 | 29 | # 开发 30 | - optbinning 31 | - toml 32 | 33 | # 文档 34 | - sphinx 35 | - furo 36 | - sphinx-rtd-theme 37 | - readthedocs-sphinx-search 38 | - myst-parser -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [tool.hatch.build] 6 | ignore-vcs = true 7 | 8 | [tool.hatch.build.targets.sdist] 9 | exclude = [ 10 | "/.idea", 11 | "/.github", 12 | "/.ipynb_checkpoints", 13 | "/__pycache__", 14 | "/docs", 15 | "/dist", 16 | ] 17 | 18 | [tool.hatch.build.targets.wheel] 19 | packages = ["westat"] 20 | 21 | 22 | [project] 23 | name = "westat" 24 | version = "0.2.8" 25 | authors = [ 26 | { name = 'westat', email='westat@foxmail.com' }, 27 | ] 28 | description = "A package for stat and data miner,calculate woe and iv,and plot woe ,plot iv,calculate ks ,plot ks and auc,plot roc" 29 | readme = "README.md" 30 | requires-python = ">=3.7" 31 | dependencies = [ 32 | "numpy", 33 | "pandas", 34 | "scipy", 35 | "matplotlib", 36 | "scikit-learn", 37 | "statsmodels", 38 | "tqdm", 39 | "seaborn", 40 | "openpyxl", 41 | "optbinning", 42 | "ipywidgets", 43 | ] 44 | keywords = ["scorecard","woe","iv","roc","ks","auc","psi","lift"] 45 | classifiers = [ 46 | "Programming Language :: Python :: 3", 47 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", 48 | "Operating System :: OS Independent", 49 | 'Topic :: Scientific/Engineering', 50 | 'Intended Audience :: Science/Research', 51 | 'Environment :: Console', 52 | 'Development Status :: 3 - Alpha', 53 | ] 54 | 55 | [project.urls] 56 | homepage = 'http://www.pyminer.com' 57 | documentation = 'https://westat.readthedocs.io' 58 | repository = 'https://gitee.com/westat/westat' 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /static/auc_ks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/auc_ks.png -------------------------------------------------------------------------------- /static/corr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/corr.png -------------------------------------------------------------------------------- /static/cut_woe_iv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/cut_woe_iv.png -------------------------------------------------------------------------------- /static/feature_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/feature_selection.png -------------------------------------------------------------------------------- /static/get_lift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/get_lift.png -------------------------------------------------------------------------------- /static/get_psi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/get_psi.png -------------------------------------------------------------------------------- /static/get_scorecard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/get_scorecard.png -------------------------------------------------------------------------------- /static/gitee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/gitee.png -------------------------------------------------------------------------------- /static/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/github.png -------------------------------------------------------------------------------- /static/iv_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/iv_distribution.png -------------------------------------------------------------------------------- /static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/logo.png -------------------------------------------------------------------------------- /static/logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/logo2.png -------------------------------------------------------------------------------- /static/plot_ks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/plot_ks.png -------------------------------------------------------------------------------- /static/predict_score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/predict_score.png -------------------------------------------------------------------------------- /static/pyminer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/pyminer.png -------------------------------------------------------------------------------- /static/pypi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/pypi.png -------------------------------------------------------------------------------- /static/qcut_woe_iv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/qcut_woe_iv.png -------------------------------------------------------------------------------- /static/tree_iv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/tree_iv.png -------------------------------------------------------------------------------- /static/view_woe_iv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/static/view_woe_iv.png -------------------------------------------------------------------------------- /westat/assess/__init__.py: -------------------------------------------------------------------------------- 1 | # 模型评估 access 2 | from .get_auc import get_auc 3 | from .get_auc_by_card import get_auc_by_card 4 | from .get_data_psi import get_data_psi 5 | from .get_ks import get_ks 6 | from .get_ks_by_card import get_ks_by_card 7 | from .get_psi import get_psi, view_psi 8 | from .get_score_distribution import get_score_distribution, view_score_distribution 9 | from .get_vif import get_vif 10 | from .plot_roc_ks import plot_roc_ks 11 | from .plot_lift import plot_lift 12 | from.plot_ks import plot_ks 13 | -------------------------------------------------------------------------------- /westat/assess/get_auc.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | 4 | 5 | def get_auc(data: pd.DataFrame, 6 | col: str = 'Proba', 7 | target: str = 'y', 8 | return_data: bool = False, 9 | precision: int = 2): 10 | """ 11 | 根据评分卡内容,对目标数据集的评分结果计算auc 12 | Args: 13 | data:pd.DataFrame,目标数据集 14 | col:str,正例的概率估计字段名 15 | target:tr,目标变量名称,默认为'y' 16 | return_data:是否返回结果数据 17 | precision:int,数据精度,小数点位数,默认为2 18 | 19 | Returns: 20 | 计算roc_auc的值,或根据要求返回结果数据 21 | """ 22 | from sklearn.metrics import roc_curve, auc 23 | 24 | fpr, tpr, thresholds = roc_curve(data[target], data[col], drop_intermediate=False) 25 | result = pd.DataFrame([fpr, tpr, thresholds]).T 26 | result.columns = ['fpr', 'tpr', 'thresholds'] 27 | 28 | auc = round(auc(fpr, tpr), precision) 29 | if return_data: 30 | return auc, result 31 | else: 32 | return auc 33 | -------------------------------------------------------------------------------- /westat/assess/get_auc_by_card.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import sys 4 | from ..model.get_predict_score import get_predict_score 5 | 6 | 7 | def get_auc_by_card(data: pd.DataFrame, 8 | score_card: pd.DataFrame, 9 | init_score: int = 600, 10 | pdo: int = 50, 11 | target: str = 'y', 12 | return_data: bool = False, 13 | precision: int = 2): 14 | """ 15 | 根据评分卡内容,对目标数据集的评分结果计算auc 16 | Args: 17 | data:pd.DataFrame,目标数据集 18 | score_card:pd.DataFrame,评分卡规则表 19 | init_score:int,初始模型分,默认为600 20 | pdo:int,坏件率每上升一倍,增加的分数,默认为50 21 | target:tr,目标变量名称,默认为'y' 22 | return_data:是否返回结果数据 23 | precision:int,数据精度,小数点位数,默认为2 24 | 25 | Returns: 26 | 计算roc_auc的值,或根据要求返回结果数据 27 | """ 28 | from sklearn.metrics import roc_curve, auc 29 | 30 | data_score_proba = get_predict_score(data, score_card, init_score=init_score, pdo=pdo, target=target, 31 | precision=precision) 32 | fpr, tpr, thresholds = roc_curve(data['y'], data_score_proba['Proba'], drop_intermediate=False) 33 | result = pd.DataFrame([fpr, tpr, thresholds]).T 34 | result.columns = ['fpr', 'tpr', 'thresholds'] 35 | 36 | auc = round(auc(fpr, tpr), precision) 37 | if return_data: 38 | return auc, result 39 | else: 40 | return auc 41 | -------------------------------------------------------------------------------- /westat/assess/get_data_psi.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from numpy import inf 3 | import pandas as pd 4 | 5 | from .get_psi import get_psi 6 | 7 | 8 | def get_data_psi(data_actual: pd.DataFrame, 9 | data_expected: str, 10 | qcut=10, 11 | missing: list = [np.nan, None, 'nan','null','NULL'], 12 | target='y', 13 | precision=6) -> pd.DataFrame: 14 | """ 15 | 计算数据集PSI 16 | Args: 17 | data_actual: DataFrame,实际数据集 18 | data_expected: DataFrame,预期数据集 19 | col:str,需要计算PSI的列名 20 | bins:list,计算PSI的分箱 21 | qcut: int,等额分箱的分组数 22 | missing: list,缺失值列表 23 | target: str,目标变量名称,默认为'y' 24 | precision:数据精度,小数点位数,默认为2 25 | language: str,数据结果标题列显示语言,默认为 'en',可手动修改为'cn' 26 | 27 | Returns: 28 | 结果数据集保存数据集对应的PSI 29 | """ 30 | col_psi = [] 31 | for col in [i for i in data_actual.columns if i != target]: 32 | df_psi = get_psi(data_actual, 33 | data_expected, 34 | col, 35 | qcut=qcut, 36 | target=target, 37 | missing=missing, 38 | precision=precision) 39 | col_psi.append([col, float(df_psi['PSI'].iloc[-1])]) 40 | 41 | result = pd.DataFrame(col_psi, columns=["Name", "PSI"]) 42 | result.sort_values(by='PSI', ascending=False, inplace=True) 43 | return result 44 | -------------------------------------------------------------------------------- /westat/assess/get_vif.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def get_vif(data, 5 | col, 6 | target='y', 7 | return_data=False, 8 | precision=2): 9 | """ 10 | 根据指定的特征清单,计算数据集中每个特征的方差膨胀因子 VIF 11 | Args: 12 | data:pd.DataFrame,目标数据集 13 | col:str,需要计算VIF的特征列表 14 | target:str,目标变量名称,默认为'y' 15 | return_data:是否返回结果数据 16 | precision:int,数据精度,小数点位数,默认为2 17 | 18 | Returns: 19 | 计算 VIF 的值,或根据要求返回结果数据 20 | """ 21 | from statsmodels.stats.outliers_influence import variance_inflation_factor 22 | 23 | X = data[[i for i in col if i != target]] 24 | 25 | # 计算VIF 26 | vif = pd.DataFrame() 27 | vif["variables"] = X.columns 28 | vif["VIF"] = [variance_inflation_factor(X.values, i) for i in range(X.shape[1])] 29 | vif_max = round(vif['VIF'].max(), precision) 30 | vif["VIF"] = vif["VIF"].apply(lambda x: round(x, precision)) 31 | if return_data: 32 | return vif_max, vif 33 | else: 34 | return vif_max 35 | -------------------------------------------------------------------------------- /westat/core/__init__.py: -------------------------------------------------------------------------------- 1 | from .table import Table 2 | from .column import Column 3 | from .Scorecard import Scorecard -------------------------------------------------------------------------------- /westat/core/column.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | class Column(pd.Series): 5 | def __init__(self): 6 | super().__init__() 7 | 8 | def __str__(self): 9 | return 'column for westat' 10 | -------------------------------------------------------------------------------- /westat/core/table.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | class Table(pd.DataFrame): 5 | def __init__(self): 6 | super().__init__() 7 | 8 | def __str__(self): 9 | return 'table for westat' 10 | 11 | 12 | -------------------------------------------------------------------------------- /westat/data/CreditCard.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/data/CreditCard.xls -------------------------------------------------------------------------------- /westat/data/GiveMeSomeCredit/Data Dictionary.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/data/GiveMeSomeCredit/Data Dictionary.xls -------------------------------------------------------------------------------- /westat/dataframe_to_table.py: -------------------------------------------------------------------------------- 1 | from prettytable import PrettyTable 2 | from westat.logger import logger 3 | 4 | 5 | def dataframe_to_table(data): 6 | """ 7 | 将pandas DataFrame 转换为 PrettyTable 8 | Args: 9 | data:将要转换的DataFrame 10 | 11 | Returns: 12 | 13 | """ 14 | if data.empty: 15 | logger.warning('输入的数据集为空') 16 | return 17 | else: 18 | table = PrettyTable(list(data.columns)) 19 | for row in range(len(data)): 20 | table.add_row(list(data.iloc[row,:])) 21 | print(table) 22 | return 23 | -------------------------------------------------------------------------------- /westat/dataset.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import os 3 | from .utils import current_path 4 | 5 | 6 | # 设置自带数据集 7 | def uci_credit_card() -> pd.DataFrame(): 8 | """ 9 | 获取自带数据集 uci_credit_card 10 | Returns: 11 | 返回dataframe格式化的 uci_credit_card 数据集 12 | """ 13 | 14 | file_path = os.path.join(current_path, 'data/UCI_Credit_Card.csv') 15 | data = pd.read_csv(file_path) 16 | return data 17 | 18 | 19 | class GiveMeSomeCredit(): 20 | 21 | def __init__(self): 22 | """ 23 | 获取自带数据集 GiveMeSomeCredit 24 | Returns: 25 | 返回dataframe格式化的 GiveMeSomeCredit 数据集 26 | """ 27 | train_path = os.path.join(current_path, 'data', 'GiveMeSomeCredit', 'cs-training.csv') 28 | self.train = pd.read_csv(train_path) 29 | 30 | test_path = os.path.join(current_path, 'data', 'GiveMeSomeCredit', 'cs-test.csv') 31 | self.test = pd.read_csv(test_path) 32 | -------------------------------------------------------------------------------- /westat/explore/__init__.py: -------------------------------------------------------------------------------- 1 | # 数据探索 2 | from .check_data_target import check_data_target 3 | from .get_data_describe import get_data_describe 4 | from .get_data_distribution import get_data_distribution 5 | from .proc_means import proc_means 6 | from .plot_counts import plot_counts 7 | from .get_data_check import get_data_check -------------------------------------------------------------------------------- /westat/explore/check_data_target.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def check_data_target(data: pd.DataFrame) -> bool: 5 | """ 6 | 检查数据集中是否有列名为"y" 或 "target"的目标变量 7 | Args: 8 | data: 需要检查的数据集 9 | 10 | Returns: 11 | bool:返回一个布尔变量 12 | 返回 True,表示数据集中有名为"y" 或 "target"的目标变量 13 | 返回 False,表示数据集中有没有名为"y" 或 "target"的目标变量 14 | """ 15 | col_list = [x.lower() for x in data.columns] 16 | if 'y' not in col_list and 'target' not in col_list: 17 | return False 18 | else: 19 | return True 20 | -------------------------------------------------------------------------------- /westat/explore/get_data_distribution.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def get_data_distribution(data: pd.DataFrame, 5 | col='y', 6 | by=['#Count', 'Name'], 7 | ascending=[False, False], 8 | precision=2, 9 | language='en') -> pd.DataFrame: 10 | """ 11 | 查看数据集data中col列的数据分布情况 12 | Args: 13 | data:DataFrame,需要检查数据分布的数据集 14 | by:list,根据指定列进行排序,默认根据数量(降序)、名称(升序)排序 15 | ascending:list,指定列对应的排序列表 16 | col:需要检查数据分布的列,默认为'y' 17 | display:bool,是否显示详细信息 18 | precision:数据精度,默认为2位小数 19 | language:显示语言,en:显示为英文,cn:显示为中文 20 | Returns: 21 | 返回包含数据量、数据占比的数据集 22 | """ 23 | result = pd.DataFrame(data=data[col].value_counts()) 24 | result.columns = ['count'] 25 | result['%Ratio'] = result['count'] / len(data) 26 | result['Value'] = result.index 27 | result['Name'] = col 28 | result = result.rename(columns={'count': '#Count'}) 29 | result = result[['Name', 'Value', '#Count', '%Ratio']] 30 | 31 | # 排序 32 | result.sort_values(by=by, ascending=ascending, inplace=True) 33 | 34 | # 添加汇总行 35 | total = result.iloc[:, 1:].apply(lambda x: x.sum()) 36 | row = pd.DataFrame([''] + total.to_list()).T 37 | row.columns = result.columns 38 | result = pd.concat([result, row], ignore_index=True) 39 | 40 | result.reset_index(drop=True, inplace=True) 41 | result['No.'] = result.index + 1 42 | 43 | # 数据精度设置 44 | result['#Count'] = result['#Count'].apply(lambda x: format(x, '.' + str(precision) + 'f')) 45 | result['%Ratio'] = result['%Ratio'].apply(lambda x: format(x, '.' + str(precision) + '%')) 46 | 47 | result = result[['No.', 'Name', 'Value', '#Count', '%Ratio']] 48 | result.iat[-1,0] = 'Total' 49 | result.iat[-1,1] = '' 50 | result.iat[-1,2] = '' 51 | 52 | # 标题栏语言设置 53 | if language == 'cn': 54 | result.rename(columns={'No.': '序号', 'Name': '名称', 'Value': '值', '#Count': '#数量', '%Ratio': '%占比'}, 55 | inplace=True) 56 | 57 | 58 | return result 59 | -------------------------------------------------------------------------------- /westat/explore/proc_means.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from numpy import inf 3 | import pandas as pd 4 | 5 | 6 | def proc_means(data: pd.DataFrame, 7 | var: list, 8 | precision: int = 2, 9 | language: str = 'en') -> pd.DataFrame: 10 | """ 11 | 获取目标数据集的描述统计信息 12 | Args: 13 | data:DataFrame,需要进行统计分析的数据集 14 | var:list,需要统计的变量 15 | precision:数据精度,小数点位数,默认为2 16 | language:str,数据结果标题列显示语言,默认为 'en',可手动修改为'cn' 17 | 18 | Returns: 19 | 描述统计结果数据集 20 | """ 21 | 22 | result = [] 23 | for v in var: 24 | # 数据类型 25 | col_dtype = str(data[v].dtype) 26 | 27 | # 如果列是数值型,并且不是全为空,则计算统计量 28 | if col_dtype in ('int64', 'float64', 'float32') and len(data[data[v].notnull()]): 29 | v_n = data[v].count() 30 | v_mean = data[v].mean() 31 | v_std = data[v].std() 32 | v_min = data[v].min() 33 | v_max = data[v].max() 34 | result.append([v, v_n, v_mean, v_std, v_min, v_max]) 35 | 36 | result = pd.DataFrame(result, columns=['Variable', 'N', 'Mean', 'Std Dev', 'Minimum', 'Maximum']) 37 | 38 | # 设置显示格式 39 | result['N'] = result['N'].apply(lambda x: round(x, precision)) 40 | result['Mean'] = result['Mean'].apply(lambda x: round(x, precision)) 41 | result['Std Dev'] = result['Std Dev'].apply(lambda x: round(x, precision)) 42 | result['Minimum'] = result['Minimum'].apply(lambda x: round(x, precision)) 43 | result['Maximum'] = result['Maximum'].apply(lambda x: round(x, precision)) 44 | 45 | return result 46 | -------------------------------------------------------------------------------- /westat/logger.py: -------------------------------------------------------------------------------- 1 | 2 | import logging 3 | 4 | # 日志设置 5 | logging.getLogger().setLevel(logging.INFO) 6 | FORMAT = '%(asctime)s [%(levelname)s] %(process)d %(module)s %(message)s' 7 | logging.basicConfig(format = FORMAT ) 8 | 9 | logger = logging.getLogger(__name__) -------------------------------------------------------------------------------- /westat/model/__init__.py: -------------------------------------------------------------------------------- 1 | # 模型开发 2 | from .feature_selection import get_feature_by_ivcorr 3 | from .get_data_type import get_data_type 4 | from .get_data_bins import get_data_bins 5 | from .get_data_discrete import get_data_discrete 6 | from .get_data_iv import get_data_iv 7 | from .get_data_woe import get_data_woe 8 | from .get_woe_transform import get_woe_transform 9 | from .get_model_iv import get_model_iv,view_model_iv 10 | from .get_predict_score import get_predict_score 11 | from .get_scorecard import get_scorecard 12 | from .get_tree_bins import get_tree_bins 13 | from .get_woe_iv import get_woe_iv, view_woe_iv 14 | from .stepwise_forward import stepwise_forward 15 | from .stepwise_lr import stepwise_lr 16 | from .plot_iv import plot_iv 17 | from .plot_woe import plot_woe 18 | from .plot_corr import plot_corr 19 | from .gini_impurity import gini_impurity 20 | from .get_entropy import get_entropy 21 | from .get_chi2 import get_chi2 22 | from .get_bins import get_bins 23 | from .finance import debx,debj 24 | 25 | from .logistic import logistic 26 | 27 | # 决策树 28 | from .tree import tree_to_img, tree_to_pdf, graphviz, plot_tree 29 | -------------------------------------------------------------------------------- /westat/model/finance.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def debx(amount: float = 1000000, rate: float = 0.043, period: int = 360, precision=2, return_data=False): 5 | """ 6 | 计算等额本息还款方式下贷款还款每月金额,月还款本金、月利息金额 7 | Args: 8 | amount:float,贷款金额 9 | rate:float,贷款年利率 10 | period:int,贷款期限 11 | precision:int,数据精度,小数点位数,默认为2 12 | return_data:bool,是否返回还款计划数据 13 | Returns: 14 | 默认返回月还款金额,指定返回数据时,可以返回还款计划数据 15 | """ 16 | period_rate = rate / 12 17 | repay = (amount * period_rate * (1 + period_rate) ** period) / ((1 + period_rate) ** period - 1) 18 | repay = round(repay, precision) 19 | 20 | i_amount = 0 21 | i_interest = 0 22 | i_remain = amount 23 | data_list = [] 24 | for i in range(period): 25 | i_interest = round(i_remain * period_rate, precision) 26 | i_amount = round(repay - i_interest, precision) 27 | i_remain = round(i_remain - i_amount, precision) 28 | data_list.append([i + 1, repay, i_amount, i_interest, i_remain]) 29 | 30 | data = pd.DataFrame(data_list, columns=['期数', '每月还款', '本期本金', '本期利息', '本期剩余']) 31 | 32 | if return_data: 33 | return {'repay': repay, 'data': data} 34 | else: 35 | return repay 36 | 37 | 38 | def debj(amount: float = 1000000, rate: float = 0.043, period: int = 360, precision=2, return_data=False): 39 | """ 40 | 计算等额本金还款方式下贷款每月还款金额,月还款本金、月利息金额 41 | Args: 42 | amount:float,贷款金额 43 | rate:float,贷款年利率 44 | period:int,贷款期限 45 | precision:int,数据精度,小数点位数,默认为2 46 | return_data:bool,是否返回还款计划数据 47 | Returns: 48 | 默认返回月还款金额,指定返回数据时,可以返回还款计划数据 49 | """ 50 | period_rate = rate / 12 51 | 52 | i_amount = 0 53 | i_interest = 0 54 | i_remain = amount 55 | data_list = [] 56 | for i in range(period): 57 | repay = round(amount / period + i_remain * period_rate, precision) 58 | i_amount = round(amount / period, precision) 59 | i_interest = round(repay - amount / period, precision) 60 | i_remain = round(i_remain - amount / period, precision) 61 | 62 | data_list.append([i + 1, i_amount + i_interest, i_amount, i_interest, i_remain]) 63 | 64 | data = pd.DataFrame(data_list, columns=['期数', '每月还款', '本期本金', '本期利息', '本期剩余']) 65 | 66 | if return_data: 67 | return {'repay': repay, 'data': data} 68 | else: 69 | return repay 70 | -------------------------------------------------------------------------------- /westat/model/get_chi2.py: -------------------------------------------------------------------------------- 1 | def get_chi2(data, precision: int = 4): 2 | """ 3 | 计算指定数据的信息熵 4 | Args: 5 | data: 需要计算卡方的数据列表,支持 pd.crosstab 格式的数据表 6 | precision: 数据精度,小数点位数,默认为2 7 | 8 | Returns: 9 | 返回计算后的卡方 10 | """ 11 | import pandas as pd 12 | from scipy.stats import chi2_contingency 13 | 14 | if isinstance(data, pd.DataFrame): 15 | chi2 = chi2_contingency(data, correction=False).statistic 16 | else: 17 | chi2 = 0 18 | 19 | # 数据精度处理 20 | result = round(chi2, precision) 21 | 22 | return result 23 | -------------------------------------------------------------------------------- /westat/model/get_data_bins.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | from .get_bins import get_bins 4 | from .get_data_type import get_data_type 5 | 6 | 7 | def get_data_bins(data: pd.DataFrame, 8 | missing: list = [np.nan, None, 'nan','null','NULL'], 9 | max_bins: int = 5, 10 | target: str = 'y', 11 | method: str = 'optb', 12 | trend: str = 'auto', 13 | precision: int = 4, 14 | max_depth=None, 15 | min_samples_leaf: float = 0.05, 16 | ) -> pd.DataFrame: 17 | """ 18 | 将数据集中所有列,根据决策树进行分箱 19 | 连续变量的分箱,按小于等于,大于切分,空值单独归位一类,例如:['age', [-inf, 22, 35, 50, 60, inf]] 20 | Args: 21 | data: DataFrame,目标数据集 22 | missing: list,缺失值列表 23 | max_bins:int,最大分箱数,默认分为5箱 24 | target: str,目标变量名称,默认为'y' 25 | method: str,分箱方法, 26 | 默认为'tree'表示使用决策树分箱 27 | 当取值为 'optb'时,表示使用OptimalBinning进行分箱,此时启用trend参数设置分箱单调性 28 | trend:str,设置分箱单调趋势,一般使用的有:ascending,descending,auto_asc_desc,peak,valley 29 | ascending:单调递增; 30 | descending:单调递减 31 | auto_asc_desc:自动增减: 32 | peak:先增后减 33 | valley:先减后增 34 | precision:数据精度,小数点位数,默认为2 35 | max_depth:int,树的深度 36 | min_samples_leaf:叶子节点样本数量最小占比,默认为0.05 37 | 38 | Returns: 39 | 返回数据集,包含列名,分箱结果两列,分箱结果使用list保存 40 | """ 41 | col_types = get_data_type(data) 42 | col_continuous_bins = [] 43 | for i in range(len(col_types)): 44 | col = col_types.iloc[i, 0] 45 | col_type = col_types.iloc[i, 1] 46 | if col_type == 'continuous' and col in data.columns and col != target: 47 | bins = get_bins(data=data[[col, target]], 48 | col=col, 49 | target=target, 50 | max_depth=max_depth, 51 | max_bins=max_bins, 52 | min_samples_leaf=min_samples_leaf, 53 | missing=missing, 54 | precision=precision) 55 | if bins: 56 | col_continuous_bins.append([col, bins]) 57 | result = pd.DataFrame(col_continuous_bins, columns=['Name', 'Bins']) 58 | return result 59 | -------------------------------------------------------------------------------- /westat/model/get_data_iv.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | from tqdm.notebook import tqdm 4 | from .get_woe_iv import get_woe_iv 5 | 6 | 7 | def get_data_iv(data: pd.DataFrame, 8 | target='y', 9 | method='optb', 10 | bins=[], 11 | qcut=0, 12 | missing: list = [np.nan, None, 'nan','null','NULL'], 13 | max_bins: int = None, 14 | trend: str = 'auto', 15 | precision=4): 16 | """ 17 | 批量获取变量IV值 18 | Args: 19 | data: DataFrame,目标数据集 20 | target: str,目标变量名称,默认为'y' 21 | method: str,分箱方法, 22 | 默认为'tree'表示使用决策树分箱 23 | 当取值为 'discrete'时,表示数据集已经离散化,直接计算WoE和IV 24 | 当取值为 'optb'时,表示使用OptimalBinning进行分箱,此时启用trend参数设置分箱单调性 25 | bins: list,手动指定的分箱列表 26 | qcut: int,等额分箱的分组数 27 | missing: list,缺失值列表 28 | max_bins:int,最大分箱数,默认分为5箱,仅决策树分箱时可用 29 | trend:str,设置分箱单调趋势,一般使用的有:ascending,descending,auto_asc_desc,peak,valley 30 | ascending:单调递增; 31 | descending:单调递减 32 | auto_asc_desc:自动增减: 33 | peak:先增后减 34 | valley:先减后增 35 | precision: 数据精度,小数点位数,默认为2 36 | 37 | Returns: 38 | 返回包含特征名称,IV值两列的数据集 39 | """ 40 | col_iv = [] 41 | for col in tqdm([i for i in data.columns if i != target]): 42 | if data[col].dtypes in ('int64', 'float64', 'float32'): 43 | new_method = method 44 | else: 45 | new_method = 'discrete' 46 | col_woe_iv = get_woe_iv(data=data, 47 | col=col, 48 | target=target, 49 | method=new_method, 50 | bins=bins, 51 | qcut=qcut, 52 | missing=missing, 53 | max_bins=max_bins, 54 | trend=trend, 55 | precision=precision) 56 | col_woe_iv['IV'] = pd.to_numeric(col_woe_iv['IV']) 57 | col_iv.append([col, col_woe_iv['IV'].iloc[-1]]) 58 | result = pd.DataFrame(col_iv, columns=["Name", "IV"]) 59 | result.sort_values(by='IV', ascending=False, inplace=True) 60 | result['IV'] = result['IV'].apply(lambda x: format(x, '.' + str(precision) + 'f')) 61 | return result 62 | -------------------------------------------------------------------------------- /westat/model/get_data_type.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def get_data_type(data: pd.DataFrame) -> pd.DataFrame: 5 | """ 6 | 划分离散和连续变量 (连续变量:int64,float64,float32;离散变量:其他) 7 | Args: 8 | data:需要划分离散和连续变量的数据集 9 | 10 | Returns: 11 | 返回 DataFrame ,存放列名和列的类型(连续、离散) 12 | """ 13 | col_all = data.columns 14 | col_all_type = data.dtypes 15 | col_type = [] 16 | for i in range(len(col_all)): 17 | if col_all[i] != 'y': 18 | if str(col_all_type[i]) in ('int64', 'float64', 'float32'): 19 | col_type.append([col_all[i], 'continuous']) 20 | else: 21 | col_type.append([col_all[i], 'discrete']) 22 | df = pd.DataFrame(col_type, columns=['Name', 'Type']) 23 | return df 24 | -------------------------------------------------------------------------------- /westat/model/get_data_woe.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | from tqdm.notebook import tqdm 4 | from .get_woe_iv import get_woe_iv 5 | 6 | 7 | def get_data_woe(data: pd.DataFrame, 8 | target='y', 9 | method='optb', 10 | bins=[], 11 | qcut=0, 12 | missing: list = [np.nan, None, 'nan','null','NULL'], 13 | max_bins: int = None, 14 | trend: str = 'auto', 15 | precision=4): 16 | """ 17 | 批量获取变量WoE值 18 | Args: 19 | data: DataFrame,目标数据集 20 | target: str,目标变量名称,默认为'y' 21 | method: str,分箱方法, 22 | 默认为'tree'表示使用决策树分箱 23 | 当取值为 'discrete'时,表示数据集已经离散化,直接计算WoE和IV 24 | 当取值为 'optb'时,表示使用OptimalBinning进行分箱,此时启用trend参数设置分箱单调性 25 | bins: list,手动指定的分箱列表 26 | qcut: int,等额分箱的分组数 27 | missing: list,缺失值列表 28 | max_bins:int,最大分箱数,默认分为5箱,仅决策树分箱时可用 29 | trend:str,设置分箱单调趋势,一般使用的有:ascending,descending,auto_asc_desc,peak,valley 30 | ascending:单调递增; 31 | descending:单调递减 32 | auto_asc_desc:自动增减: 33 | peak:先增后减 34 | valley:先减后增 35 | precision: 数据精度,小数点位数,默认为2 36 | 37 | Returns: 38 | 返回包含特征名称Name,WoE值两列的数据集 39 | """ 40 | col_iv = [] 41 | for col in tqdm([i for i in data.columns if i != target]): 42 | if data[col].dtypes in ('int64', 'float64', 'float32'): 43 | new_method = method 44 | else: 45 | new_method = 'discrete' 46 | col_woe_iv = get_woe_iv(data=data, 47 | col=col, 48 | target=target, 49 | method=new_method, 50 | bins=bins, 51 | qcut=qcut, 52 | missing=missing, 53 | max_bins=max_bins, 54 | trend=trend, 55 | precision=precision) 56 | col_woe_iv['WoE'] = pd.to_numeric(col_woe_iv['WoE']) 57 | col_iv.append([col, col_woe_iv['WoE'].iloc[-1]]) 58 | result = pd.DataFrame(col_iv, columns=["Name", "WoE"]) 59 | result.sort_values(by='WoE', ascending=False, inplace=True) 60 | result['WoE'] = result['WoE'].apply(lambda x: format(x, '.' + str(precision) + 'f')) 61 | return result 62 | -------------------------------------------------------------------------------- /westat/model/get_entropy.py: -------------------------------------------------------------------------------- 1 | def get_entropy(l=None, c=None, precision: int = 4): 2 | """ 3 | 计算指定数据的信息熵 4 | Args: 5 | l: 需要计算信息熵的数据列表,支持pandas.Series和python列表、元组格式 6 | c: 已统计的数值结果列表 7 | precision: 数据精度,小数点位数,默认为2 8 | 9 | Returns: 10 | 返回计算后的信息熵 11 | """ 12 | import math 13 | import pandas as pd 14 | 15 | if not isinstance(l, pd.Series): 16 | s = pd.Series(l, dtype='object') 17 | else: 18 | s = l 19 | 20 | if not isinstance(c, pd.Series): 21 | c = pd.Series(c, dtype='object') 22 | 23 | if l: 24 | df = pd.DataFrame(s.value_counts()) 25 | df.columns = ['count'] 26 | df['ratio'] = df['count'] / len(l) 27 | else: 28 | df = pd.DataFrame({'count': c}, index=range(len(c))) 29 | df['ratio'] = df['count'] / sum(c) 30 | 31 | entropy = sum(- proba * math.log2(proba) for proba in df['ratio'] if proba != 0) 32 | 33 | # 数据精度处理 34 | result = round(entropy, precision) 35 | 36 | return result 37 | -------------------------------------------------------------------------------- /westat/model/get_tree_bins.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from numpy import inf 3 | import pandas as pd 4 | from sklearn.tree import DecisionTreeClassifier 5 | 6 | 7 | def get_tree_bins(data: pd.DataFrame, 8 | col: str, 9 | target: str = 'y', 10 | max_depth=None, 11 | max_leaf_nodes: int = 4, 12 | min_samples_leaf: float = 0.05, 13 | missing: list = [np.nan, None, 'nan','null','NULL'], 14 | precision: int = 2) -> list: 15 | """ 16 | 根据决策树对数据集进行特征分箱,默认最大分为5箱 17 | Args: 18 | data: DataFrame,将要根据决策树进行分箱的数据集 19 | col: str,将要分箱的列名 20 | target: str,目标变量名称,默认为'y' 21 | max_depth: int,树的深度 22 | max_leaf_nodes: int,最大叶子节点数,默认为 4 23 | min_samples_leaf: float,叶子节点样本数量最小占比,默认为0.05 24 | missing: list,缺失值列表 25 | precision:int,数据精度,小数点位数,默认为2 26 | 27 | Returns: 28 | 根据决策树结果得到的分箱列表,例如:[-inf,30,40,50,inf] 29 | """ 30 | df = data.copy() 31 | df[col].replace(missing, np.nan, inplace=True) 32 | 33 | data_notnull = df[[col, target]][df[col].notnull()] # 删除空值 34 | result = [] 35 | if len(np.unique(data_notnull[col])) > 1: 36 | x = data_notnull[col].values.reshape(-1, 1) 37 | y = data_notnull[target].values 38 | 39 | clf = DecisionTreeClassifier(criterion='entropy', # “信息熵”最小化准则划分 40 | max_depth=max_depth, # 树的深度 41 | max_leaf_nodes=max_leaf_nodes, # 最大叶子节点数 42 | min_samples_leaf=min_samples_leaf) # 叶子节点样本数量最小占比 43 | clf.fit(x, y) 44 | 45 | threshold = np.unique(clf.tree_.threshold) 46 | x_num = np.unique(x) 47 | 48 | for i in threshold: 49 | if i != -2: 50 | point = np.round(max(x_num[x_num < i]), precision) # 取切分点左边的数 51 | result.extend([point]) 52 | result = [float(str(i)) for i in list(np.unique(result))] 53 | result = [-inf] + result + [inf] 54 | return result 55 | -------------------------------------------------------------------------------- /westat/model/get_woe_transform.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | from tqdm.notebook import tqdm 4 | from .get_woe_iv import get_woe_iv 5 | 6 | 7 | def get_woe_transform(data_discrete: pd.DataFrame(), 8 | fit_transform=pd.DataFrame(), 9 | target='y', 10 | method='discrete', 11 | missing: list = [np.nan, None, 'nan','null','NULL'], 12 | precision=2): 13 | """ 14 | 根据离散化数据集,进行WoE转换 15 | Args: 16 | data_discrete: DataFrame,目标数据集 17 | fit_transform:DataFrame,已经离散化的训练集,用于根据训练好的transform,转化test/OOT数据 18 | target: str,目标变量名称,默认为'y' 19 | method: str,分箱方法,默认为'discrete',表示使用已经离散化的数据计算WoE 20 | missing: list,缺失值列表 21 | precision: 数据精度,小数点位数,默认为2 22 | 23 | Returns: 24 | 返回经过WoE转换后的数据集 25 | """ 26 | data_woe = pd.DataFrame() 27 | 28 | if fit_transform.empty: 29 | for col in tqdm([i for i in data_discrete.columns if i != target]): 30 | col_woe = get_woe_iv(data_discrete, col=col, target=target, method=method, missing=missing, 31 | precision=precision) 32 | col_woe = col_woe.iloc[:-1, :] 33 | woe_content = pd.to_numeric(col_woe['WoE']) 34 | s = data_discrete[col].replace(list(col_woe['Bin']), list(woe_content)) 35 | data_woe = pd.concat([data_woe, s], axis=1) 36 | else: 37 | for col in tqdm([i for i in data_discrete.columns if i != target]): 38 | col_woe = get_woe_iv(fit_transform, col=col, target=target, method=method, missing=missing, 39 | precision=precision) 40 | col_woe = col_woe.iloc[:-1, :] 41 | woe_content = pd.to_numeric(col_woe['WoE']) 42 | s = data_discrete[col].replace(list(col_woe['Bin']), list(woe_content)) 43 | data_woe = pd.concat([data_woe, s], axis=1) 44 | data_woe[target] = data_discrete[target] 45 | return data_woe 46 | -------------------------------------------------------------------------------- /westat/model/gini_impurity.py: -------------------------------------------------------------------------------- 1 | def gini_impurity(l=None, c=None, precision: int = 2): 2 | """ 3 | 根据传入的数据列表,计算基尼不纯度 4 | Args: 5 | l: 需要计算不纯度的数据列表,支持pandas.Series和python列表、元组格式 6 | c: 已统计的数值结果列表 7 | precision:数据精度,小数点位数,默认为2 8 | Returns: 9 | 基尼不纯度 gini impurity 10 | """ 11 | import pandas as pd 12 | 13 | if not isinstance(l, pd.Series): 14 | s = pd.Series(l, dtype='object') 15 | else: 16 | s = l 17 | 18 | if not isinstance(c, pd.Series): 19 | c = pd.Series(c, dtype='object') 20 | 21 | if l: 22 | df = pd.DataFrame(s.value_counts()) 23 | df.columns = ['count'] 24 | df['ratio'] = df['count'] / len(l) 25 | else: 26 | df = pd.DataFrame({'count': c}, index=range(len(c))) 27 | df['ratio'] = df['count'] / sum(c) 28 | 29 | gini = 1 - sum([p ** 2 for p in df['ratio']]) 30 | 31 | # 数据精度处理 32 | result = round(gini, precision) 33 | 34 | return result 35 | -------------------------------------------------------------------------------- /westat/model/logistic.py: -------------------------------------------------------------------------------- 1 | def logistic(data, target='y', return_model=False): 2 | """ 3 | 根据数据集中的x,y 构建逻辑回归模型 4 | Args: 5 | data:pd.DataFrame,目标数据集 6 | target:str,目标变量名称,默认为'y' 7 | return_model:是否返回模型 8 | 9 | Returns: 10 | return_model=True返回逻辑回归模型 11 | 否则返回逻辑回归模型汇总信息 12 | """ 13 | import statsmodels.api as sm 14 | 15 | y = data['y'] 16 | x = data[[col for col in data.columns if col != 'y']] 17 | x = sm.add_constant(x) 18 | 19 | lr = sm.Logit(y, x).fit(disp=0) 20 | 21 | if return_model: 22 | return lr 23 | else: 24 | return lr.summary() 25 | -------------------------------------------------------------------------------- /westat/model/plot_corr.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def plot_corr(data: pd.DataFrame, 5 | data_dict: pd.DataFrame = pd.DataFrame(), 6 | rotation: list = [0, 0], 7 | figsize: tuple = (10, 6)): 8 | """ 9 | 绘制目标数据集中指定特征的相关性表 10 | Args: 11 | data: 目标数据集 12 | data_dict: 特征的数据字典,包含Name,Label两列 13 | rotation:list,x和y坐标轴文字方向,默认为[0,0] 即x轴文字和y轴文字均为水平 14 | figsize:tuple,图片大小 15 | Returns: 16 | 返回相关性图表 17 | """ 18 | import matplotlib.pyplot as plt 19 | plt.rcParams['font.sans-serif'] = 'SimHei' # 设置中文字体 20 | plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 21 | 22 | import seaborn as sns 23 | if data_dict.empty: 24 | corr = data.corr() # 计算各变量的相关性系数 25 | else: 26 | result = data.copy() 27 | for col in result.columns: 28 | if col in data_dict['Name'].to_list(): 29 | label = data_dict[data_dict['Name'] == col].iat[0, -1] 30 | result.rename(columns={col: label}, inplace=True) 31 | 32 | corr = result.corr() # 计算各变量的相关性系数 33 | 34 | fig = plt.figure(figsize=figsize) 35 | ax = sns.heatmap(corr, annot=True, cbar=True) 36 | ax.set_xticklabels(corr.columns, rotation=rotation[0]) 37 | ax.set_yticklabels(corr.columns, rotation=rotation[1]) 38 | plt.show() 39 | -------------------------------------------------------------------------------- /westat/model/stepwise_forward.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import statsmodels.api as sm 4 | 5 | 6 | def stepwise_forward(X, y, initial_list=[], threshold_in=0.01, threshold_out=0.05, verbose=True): 7 | """ 8 | 使用逐步向前法实现逻辑回归特征选择。 9 | 10 | 参数: 11 | X: 特征变量数据,DataFrame或二维数组 12 | y: 目标变量数据,Series或一维数组 13 | initial_list: 初始特征列表,默认为空 14 | threshold_in: 添加特征的p值阈值,默认为0.01 15 | threshold_out: 移除特征的p值阈值,默认为0.05 16 | verbose: 是否输出详细的调试信息,默认为True 17 | 18 | 返回值: 19 | selected_features: 选中的特征列表 20 | """ 21 | 22 | included = list(initial_list) 23 | while True: 24 | changed = False 25 | excluded = list(set(X.columns) - set(included)) 26 | 27 | # 添加特征 28 | new_pval = pd.Series(index=excluded, dtype=np.float64) 29 | for new_column in excluded: 30 | model = sm.Logit(y, sm.add_constant(X[included + [new_column]])).fit(disp=0) 31 | new_pval[new_column] = model.pvalues[new_column] 32 | best_pval = new_pval.min() 33 | if best_pval < threshold_in: 34 | best_feature = new_pval.idxmin() 35 | included.append(best_feature) 36 | changed = True 37 | if verbose: 38 | print(f'Add {best_feature} with p-value {best_pval}') 39 | 40 | # 移除特征 41 | model = sm.Logit(y, sm.add_constant(X[included])).fit(disp=0) 42 | p_values = model.pvalues.iloc[1:] 43 | worst_pval = p_values.max() 44 | if worst_pval > threshold_out: 45 | changed = True 46 | worst_feature = p_values.idxmax() 47 | included.remove(worst_feature) 48 | if verbose: 49 | print(f'Drop {worst_feature} with p-value {worst_pval}') 50 | 51 | if not changed: 52 | break 53 | 54 | return included 55 | -------------------------------------------------------------------------------- /westat/model/tree/__init__.py: -------------------------------------------------------------------------------- 1 | # 模型开发-决策树 2 | from .tree_to_img import tree_to_img 3 | from .tree_to_pdf import tree_to_pdf 4 | from . import graphviz 5 | from .plot_tree import plot_tree 6 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/_compat.py: -------------------------------------------------------------------------------- 1 | """Python 3.7 to 3.8 compatibility and platform compatibility.""" 2 | 3 | import os 4 | import platform 5 | import sys 6 | import typing 7 | 8 | PY38 = (sys.version_info < (3, 9)) 9 | 10 | 11 | Literal: typing.Any 12 | 13 | 14 | if PY38: # pragma: no cover 15 | # pytype not supported 16 | import unittest.mock 17 | 18 | Literal = unittest.mock.MagicMock(name='Literal') 19 | else: # pragma: no cover 20 | from typing import Literal 21 | 22 | Literal = Literal # CAVEAT: use None instead of Literal[None] 23 | 24 | 25 | def get_startupinfo() -> None: 26 | """Return None for startupinfo argument of ``subprocess.Popen``.""" 27 | return None 28 | 29 | 30 | assert get_startupinfo() is None, 'get_startupinfo() defaults to a no-op' 31 | 32 | 33 | if platform.system() == 'Windows': # pragma: no cover 34 | import subprocess 35 | 36 | def get_startupinfo() -> subprocess.STARTUPINFO: # pytype: disable=module-attr 37 | """Return subprocess.STARTUPINFO instance hiding the console window.""" 38 | startupinfo = subprocess.STARTUPINFO() # pytype: disable=module-attr 39 | startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr 40 | startupinfo.wShowWindow = subprocess.SW_HIDE # pytype: disable=module-attr 41 | return startupinfo 42 | 43 | 44 | def make_subprocess_arg(arg: typing.Union[str, os.PathLike]) -> typing.Union[str, os.PathLike]: 45 | """Return subprocess argument as is (default no-op).""" 46 | return arg 47 | 48 | 49 | if platform.system() == 'Windows' and sys.version_info < (3, 8): # pragma: no cover 50 | def make_subprocess_arg(arg: typing.Union[str, os.PathLike]) -> str: # noqa: F811 51 | """Workaround https://bugs.python.org/issue41649 (not backported).""" 52 | return os.fspath(arg) 53 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/backend/__init__.py: -------------------------------------------------------------------------------- 1 | """Execute rendering and unflattening subprocesses, open files in viewer.""" 2 | 3 | from .dot_command import DOT_BINARY 4 | from .execute import ExecutableNotFound, CalledProcessError 5 | from .mixins import Render, Pipe, Unflatten, View 6 | from .piping import pipe, pipe_string, pipe_lines, pipe_lines_string 7 | from .rendering import render 8 | from .unflattening import UNFLATTEN_BINARY, unflatten 9 | from .upstream_version import version 10 | from .viewing import view 11 | 12 | __all__ = ['DOT_BINARY', 'UNFLATTEN_BINARY', 13 | 'render', 14 | 'pipe', 'pipe_string', 15 | 'pipe_lines', 'pipe_lines_string', 16 | 'unflatten', 17 | 'version', 18 | 'view', 19 | 'ExecutableNotFound', 'CalledProcessError', 20 | 'Render', 'Pipe', 'Unflatten', 'View'] 21 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/backend/dot_command.py: -------------------------------------------------------------------------------- 1 | """Check and assemble commands for running Graphviz ``dot``.""" 2 | 3 | import os 4 | import pathlib 5 | import typing 6 | 7 | from .. import exceptions 8 | from .. import parameters 9 | 10 | __all__ = ['DOT_BINARY', 'command'] 11 | 12 | DOT_BINARY = pathlib.Path('dot') 13 | 14 | 15 | def command(engine: str, format_: str, *, 16 | renderer: typing.Optional[str] = None, 17 | formatter: typing.Optional[str] = None, 18 | neato_no_op: typing.Union[bool, int, None] = None 19 | ) -> typing.List[typing.Union[os.PathLike, str]]: 20 | """Return ``subprocess.Popen`` argument list for rendering. 21 | 22 | See also: 23 | Upstream documentation: 24 | - https://www.graphviz.org/doc/info/command.html#-K 25 | - https://www.graphviz.org/doc/info/command.html#-T 26 | - https://www.graphviz.org/doc/info/command.html#-n 27 | """ 28 | if formatter is not None and renderer is None: 29 | raise exceptions.RequiredArgumentError('formatter given without renderer') 30 | 31 | parameters.verify_engine(engine, required=True) 32 | parameters.verify_format(format_, required=True) 33 | parameters.verify_renderer(renderer, required=False) 34 | parameters.verify_formatter(formatter, required=False) 35 | 36 | output_format = [f for f in (format_, renderer, formatter) if f is not None] 37 | output_format_flag = ':'.join(output_format) 38 | 39 | cmd = [DOT_BINARY, f'-K{engine}', f'-T{output_format_flag}'] 40 | 41 | if neato_no_op: 42 | cmd.append(f'-n{neato_no_op:d}') 43 | 44 | return cmd 45 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/backend/unflattening.py: -------------------------------------------------------------------------------- 1 | """Pipe DOT source code through ``unflatten``.""" 2 | 3 | import pathlib 4 | import typing 5 | 6 | from ..encoding import DEFAULT_ENCODING 7 | from .. import _tools 8 | from .. import exceptions 9 | 10 | from . import execute 11 | 12 | __all__ = ['UNFLATTEN_BINARY', 'unflatten'] 13 | 14 | UNFLATTEN_BINARY = pathlib.Path('unflatten') 15 | 16 | 17 | @_tools.deprecate_positional_args(supported_number=1) 18 | def unflatten(source: str, 19 | stagger: typing.Optional[int] = None, 20 | fanout: bool = False, 21 | chain: typing.Optional[int] = None, 22 | encoding: str = DEFAULT_ENCODING) -> str: 23 | """Return DOT ``source`` piped through ``unflatten`` preprocessor as string. 24 | 25 | Args: 26 | source: DOT source to process 27 | (improve layout aspect ratio). 28 | stagger: Stagger the minimum length of leaf edges 29 | between 1 and this small integer. 30 | fanout: Fanout nodes with indegree = outdegree = 1 31 | when staggering (requires ``stagger``). 32 | chain: Form disconnected nodes into chains of up to this many nodes. 33 | encoding: Encoding to encode unflatten stdin and decode its stdout. 34 | 35 | Returns: 36 | Decoded stdout of the Graphviz unflatten command. 37 | 38 | Raises: 39 | graphviz.RequiredArgumentError: If ``fanout`` is given 40 | but no ``stagger``. 41 | graphviz.ExecutableNotFound: If the Graphviz 'unflatten' executable 42 | is not found. 43 | graphviz.CalledProcessError: If the returncode (exit status) 44 | of the unflattening 'unflatten' subprocess is non-zero. 45 | 46 | See also: 47 | Upstream documentation: 48 | https://www.graphviz.org/pdf/unflatten.1.pdf 49 | """ 50 | if fanout and stagger is None: 51 | raise exceptions.RequiredArgumentError('fanout given without stagger') 52 | 53 | cmd = [UNFLATTEN_BINARY] 54 | if stagger is not None: 55 | cmd += ['-l', str(stagger)] 56 | if fanout: 57 | cmd.append('-f') 58 | if chain is not None: 59 | cmd += ['-c', str(chain)] 60 | 61 | proc = execute.run_check(cmd, input=source, encoding=encoding, 62 | capture_output=True) 63 | return proc.stdout 64 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/backend/upstream_version.py: -------------------------------------------------------------------------------- 1 | """Return the version number from running ``dot -V``.""" 2 | 3 | import logging 4 | import re 5 | import subprocess 6 | import typing 7 | 8 | from . import dot_command 9 | from . import execute 10 | 11 | VERSION_PATTERN = re.compile(r''' 12 | graphviz[ ] 13 | version[ ] 14 | (\d+)\.(\d+) 15 | (?:\.(\d+) 16 | (?: 17 | ~dev\.\d{8}\.\d{4} 18 | | 19 | \.(\d+) 20 | )? 21 | )? 22 | [ ] 23 | ''', re.VERBOSE) 24 | 25 | 26 | log = logging.getLogger(__name__) 27 | 28 | 29 | def version() -> typing.Tuple[int, ...]: 30 | """Return the upstream version number tuple from ``stderr`` of ``dot -V``. 31 | 32 | Returns: 33 | Two, three, or four ``int`` version ``tuple``. 34 | 35 | Raises: 36 | graphviz.ExecutableNotFound: If the Graphviz executable is not found. 37 | graphviz.CalledProcessError: If the exit status is non-zero. 38 | RuntimeError: If the output cannot be parsed into a version number. 39 | 40 | Example: 41 | >>> doctest_mark_exe() 42 | >>> import graphviz 43 | >>> graphviz.version() # doctest: +ELLIPSIS 44 | (...) 45 | 46 | Note: 47 | Ignores the ``~dev.`` portion of development versions. 48 | 49 | See also: 50 | Upstream release version entry format: 51 | https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20 52 | """ 53 | cmd = [dot_command.DOT_BINARY, '-V'] 54 | proc = execute.run_check(cmd, 55 | stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 56 | encoding='ascii') 57 | 58 | ma = VERSION_PATTERN.search(proc.stdout) 59 | if ma is None: 60 | raise RuntimeError(f'cannot parse {cmd!r} output: {proc.stdout!r}') 61 | 62 | return tuple(int(d) for d in ma.groups() if d is not None) 63 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/base.py: -------------------------------------------------------------------------------- 1 | """Iterables of DOT source code lines (including final newline).""" 2 | 3 | import typing 4 | 5 | from . import copying 6 | 7 | __all__ = ['Base'] 8 | 9 | 10 | class LineIterable: 11 | """Iterable of DOT Source code lines 12 | (mimics ``file`` objects in text mode).""" 13 | 14 | def __iter__(self) -> typing.Iterator[str]: # pragma: no cover 15 | r"""Yield the generated DOT source line by line. 16 | 17 | Yields: Line ending with a newline (``'\n'``). 18 | """ 19 | raise NotImplementedError('to be implemented by concrete subclasses') 20 | 21 | 22 | # Common base interface for all exposed classes 23 | class Base(LineIterable, copying.CopyBase): 24 | """LineIterator with ``.source`` attribute, that it returns for ``str()``.""" 25 | 26 | @property 27 | def source(self) -> str: # pragma: no cover 28 | raise NotImplementedError('to be implemented by concrete subclasses') 29 | 30 | def __str__(self) -> str: 31 | """The DOT source code as string.""" 32 | return self.source 33 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/copying.py: -------------------------------------------------------------------------------- 1 | """Create new instance copies with cooperative ``super()`` calls.""" 2 | 3 | __all__ = ['CopyBase'] 4 | 5 | 6 | class CopyBase: 7 | """Create new instance copies with cooperative ``super()`` calls.""" 8 | 9 | def copy(self): 10 | """Return a copied instance of the object. 11 | 12 | Returns: 13 | An independent copy of the current object. 14 | """ 15 | kwargs = self._copy_kwargs() 16 | return self.__class__(**kwargs) 17 | 18 | def _copy_kwargs(self, **kwargs): 19 | """Return the kwargs to create a copy of the instance.""" 20 | return kwargs 21 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/encoding.py: -------------------------------------------------------------------------------- 1 | """Encoding parameter handling and default.""" 2 | 3 | import typing 4 | 5 | import codecs 6 | import locale 7 | 8 | from . import copying 9 | 10 | __all__ = ['DEFAULT_ENCODING', 'Encoding'] 11 | 12 | DEFAULT_ENCODING = 'utf-8' 13 | 14 | 15 | class Encoding(copying.CopyBase): 16 | """Encoding used for input and output with ``'utf-8'`` default.""" 17 | 18 | _encoding = DEFAULT_ENCODING 19 | 20 | def __init__(self, *, encoding: typing.Optional[str] = DEFAULT_ENCODING, 21 | **kwargs) -> None: 22 | super().__init__(**kwargs) 23 | 24 | self.encoding = encoding 25 | 26 | def _copy_kwargs(self, **kwargs): 27 | """Return the kwargs to create a copy of the instance.""" 28 | return super()._copy_kwargs(encoding=self._encoding, **kwargs) 29 | 30 | @property 31 | def encoding(self) -> str: 32 | """The encoding for the saved source file.""" 33 | return self._encoding 34 | 35 | @encoding.setter 36 | def encoding(self, encoding: typing.Optional[str]) -> None: 37 | if encoding is None: 38 | encoding = locale.getpreferredencoding() 39 | 40 | codecs.lookup(encoding) # raise early 41 | self._encoding = encoding 42 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/exceptions.py: -------------------------------------------------------------------------------- 1 | """Commonly used exception classes.""" 2 | 3 | from .backend.execute import ExecutableNotFound, CalledProcessError 4 | 5 | __all__ = ['ExecutableNotFound', 'CalledProcessError', 6 | 'RequiredArgumentError', 'FileExistsError', 7 | 'UnknownSuffixWarning', 'FormatSuffixMismatchWarning', 8 | 'DotSyntaxWarning'] 9 | 10 | 11 | class RequiredArgumentError(TypeError): 12 | """:exc:`TypeError` raised if a required argument is missing.""" 13 | 14 | 15 | class FileExistsError(FileExistsError): 16 | """:exc:`FileExistsError` raised with ``raise_if_exists=True``.""" 17 | 18 | 19 | class UnknownSuffixWarning(RuntimeWarning): 20 | """:exc:`RuntimeWarning` raised if the suffix of ``outfile`` is unknown 21 | and the given ``format`` is used instead.""" 22 | 23 | 24 | class FormatSuffixMismatchWarning(UserWarning): 25 | """:exc:`UserWarning` raised if the suffix ``outfile`` 26 | does not match the given ``format``.""" 27 | 28 | 29 | class DotSyntaxWarning(RuntimeWarning): 30 | """:exc:`RuntimeWarning` raised if a quoted string 31 | is expected to cause a ``CalledProcessError`` from rendering.""" 32 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/parameters/__init__.py: -------------------------------------------------------------------------------- 1 | """Hold and verify parameters for running Graphviz ``dot``.""" 2 | 3 | from .engines import ENGINES, verify_engine 4 | from .formats import FORMATS, verify_format 5 | from .renderers import RENDERERS, verify_renderer 6 | from .formatters import FORMATTERS, verify_formatter 7 | 8 | from . mixins import Parameters 9 | 10 | __all__ = ['ENGINES', 'FORMATS', 'RENDERERS', 'FORMATTERS', 11 | 'verify_engine', 'verify_format', 12 | 'verify_renderer', 'verify_formatter', 13 | 'Parameters'] 14 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/parameters/base.py: -------------------------------------------------------------------------------- 1 | """Rendering parameter handling.""" 2 | 3 | from .. import copying 4 | 5 | __all__ = ['ParameterBase'] 6 | 7 | 8 | class ParameterBase(copying.CopyBase): 9 | """Rendering parameter.""" 10 | 11 | def _getattr_from_dict(self, attrname: str, *, default=None): 12 | """Return self.attrname if attrname is in the instance dictionary 13 | (as oposed to on the type).""" 14 | if attrname in self.__dict__: 15 | return getattr(self, attrname) 16 | return default 17 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/parameters/engines.py: -------------------------------------------------------------------------------- 1 | """Rendering engine parameter handling.""" 2 | 3 | import typing 4 | 5 | from . import base 6 | 7 | __all__ = ['ENGINES', 'verify_engine', 'Engine'] 8 | 9 | ENGINES = {'dot', # https://www.graphviz.org/pdf/dot.1.pdf 10 | 'neato', 11 | 'twopi', 12 | 'circo', 13 | 'fdp', 14 | 'sfdp', 15 | 'patchwork', 16 | 'osage'} 17 | 18 | DEFAULT_ENGINE = 'dot' 19 | 20 | REQUIRED = True 21 | 22 | 23 | def verify_engine(engine: str, *, required: bool = REQUIRED) -> None: 24 | if engine is None: 25 | if required: 26 | raise ValueError('missing engine') 27 | elif engine.lower() not in ENGINES: 28 | raise ValueError(f'unknown engine: {engine!r}' 29 | f' (must be one of {sorted(ENGINES)})') 30 | 31 | 32 | class Engine(base.ParameterBase): 33 | """Rendering engine parameter with ``'dot''`` default.""" 34 | 35 | _engine = DEFAULT_ENGINE 36 | 37 | _verify_engine = staticmethod(verify_engine) 38 | 39 | def __init__(self, *, engine: typing.Optional[str] = None, **kwargs) -> None: 40 | super().__init__(**kwargs) 41 | 42 | if engine is not None: 43 | self.engine = engine 44 | 45 | def _copy_kwargs(self, **kwargs): 46 | """Return the kwargs to create a copy of the instance.""" 47 | engine = self._getattr_from_dict('_engine') 48 | if engine is not None: 49 | kwargs['engine'] = engine 50 | return super()._copy_kwargs(**kwargs) 51 | 52 | @property 53 | def engine(self) -> str: 54 | """The layout engine used for rendering 55 | (``'dot'``, ``'neato'``, ...).""" 56 | return self._engine 57 | 58 | @engine.setter 59 | def engine(self, engine: str) -> None: 60 | engine = engine.lower() 61 | self._verify_engine(engine) 62 | self._engine = engine 63 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/parameters/formatters.py: -------------------------------------------------------------------------------- 1 | """Rendering formatter parameter handling.""" 2 | 3 | import typing 4 | 5 | from . import base 6 | 7 | __all__ = ['FORMATTERS', 'verify_formatter', 'Formatter'] 8 | 9 | FORMATTERS = {'cairo', 10 | 'core', 11 | 'gd', 12 | 'gdiplus', 13 | 'gdwbmp', 14 | 'xlib'} 15 | 16 | REQUIRED = False 17 | 18 | 19 | def verify_formatter(formatter: typing.Optional[str], *, 20 | required: bool = REQUIRED) -> None: 21 | if formatter is None: 22 | if required: 23 | raise ValueError('missing formatter') 24 | elif formatter.lower() not in FORMATTERS: 25 | raise ValueError(f'unknown formatter: {formatter!r}' 26 | f' (must be None or one of {sorted(FORMATTERS)})') 27 | 28 | 29 | class Formatter(base.ParameterBase): 30 | """Rendering engine parameter (no default).""" 31 | 32 | _formatter = None 33 | 34 | _verify_formatter = staticmethod(verify_formatter) 35 | 36 | def __init__(self, *, formatter: typing.Optional[str] = None, **kwargs) -> None: 37 | super().__init__(**kwargs) 38 | 39 | self.formatter = formatter 40 | 41 | def _copy_kwargs(self, **kwargs): 42 | """Return the kwargs to create a copy of the instance.""" 43 | formatter = self._getattr_from_dict('_formatter') 44 | if formatter is not None: 45 | kwargs['formatter'] = formatter 46 | return super()._copy_kwargs(**kwargs) 47 | 48 | @property 49 | def formatter(self) -> typing.Optional[str]: 50 | """The output formatter used for rendering 51 | (``'cairo'``, ``'gd'``, ...).""" 52 | return self._formatter 53 | 54 | @formatter.setter 55 | def formatter(self, formatter: typing.Optional[str]) -> None: 56 | if formatter is None: 57 | self.__dict__.pop('_formatter', None) 58 | else: 59 | formatter = formatter.lower() 60 | self._verify_formatter(formatter) 61 | self._formatter = formatter 62 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/parameters/mixins.py: -------------------------------------------------------------------------------- 1 | """Mixin classes used to inherit parameter functionality.""" 2 | 3 | import typing 4 | 5 | from . import engines 6 | from . import formats 7 | from . import renderers 8 | from . import formatters 9 | 10 | __all__ = ['Parameters'] 11 | 12 | 13 | class Parameters(engines.Engine, formats.Format, 14 | renderers.Renderer, formatters.Formatter): 15 | """Parameters for calling ``graphviz.render()`` and ``graphviz.pipe()``.""" 16 | 17 | def _get_parameters(self, *, 18 | engine: typing.Optional[str] = None, 19 | format: typing.Optional[str] = None, 20 | renderer: typing.Optional[str] = None, 21 | formatter: typing.Optional[str] = None, 22 | verify: bool = False, 23 | **kwargs): 24 | if engine is None: 25 | engine = self.engine 26 | elif verify: 27 | self._verify_engine(engine) 28 | 29 | if format is None: 30 | format = self.format 31 | elif verify: 32 | self._verify_format(format) 33 | 34 | if renderer is None: 35 | renderer = self.renderer 36 | elif verify: 37 | self._verify_renderer(renderer) 38 | 39 | if formatter is None: 40 | formatter = self.formatter 41 | elif verify: 42 | self._verify_formatter(formatter) 43 | 44 | kwargs.update(engine=engine, format=format, 45 | renderer=renderer, formatter=formatter) 46 | return kwargs 47 | -------------------------------------------------------------------------------- /westat/model/tree/graphviz/parameters/renderers.py: -------------------------------------------------------------------------------- 1 | """Rendering renderer parameter handling.""" 2 | 3 | import typing 4 | 5 | from . import base 6 | 7 | __all__ = ['RENDERERS', 'verify_renderer', 'Renderer'] 8 | 9 | RENDERERS = {'cairo', # $ dot -T: 10 | 'dot', 11 | 'fig', 12 | 'gd', 13 | 'gdiplus', 14 | 'map', 15 | 'pic', 16 | 'pov', 17 | 'ps', 18 | 'svg', 19 | 'tk', 20 | 'vml', 21 | 'vrml', 22 | 'xdot'} 23 | 24 | 25 | REQUIRED = False 26 | 27 | 28 | def verify_renderer(renderer: typing.Optional[str], *, 29 | required: bool = REQUIRED) -> None: 30 | if renderer is None: 31 | if required: 32 | raise ValueError('missing renderer') 33 | elif renderer.lower() not in RENDERERS: 34 | raise ValueError(f'unknown renderer: {renderer!r}' 35 | f' (must be None or one of {sorted(RENDERERS)})') 36 | 37 | 38 | class Renderer(base.ParameterBase): 39 | """Rendering renderer parameter (no default).""" 40 | 41 | _renderer = None 42 | 43 | _verify_renderer = staticmethod(verify_renderer) 44 | 45 | def __init__(self, *, renderer: typing.Optional[str] = None, **kwargs) -> None: 46 | super().__init__(**kwargs) 47 | 48 | self.renderer = renderer 49 | 50 | def _copy_kwargs(self, **kwargs): 51 | """Return the kwargs to create a copy of the instance.""" 52 | renderer = self._getattr_from_dict('_renderer') 53 | if renderer is not None: 54 | kwargs['renderer'] = renderer 55 | return super()._copy_kwargs(**kwargs) 56 | 57 | @property 58 | def renderer(self) -> typing.Optional[str]: 59 | """The output renderer used for rendering 60 | (``'cairo'``, ``'gd'``, ...).""" 61 | return self._renderer 62 | 63 | @renderer.setter 64 | def renderer(self, renderer: typing.Optional[str]) -> None: 65 | if renderer is None: 66 | self.__dict__.pop('_renderer', None) 67 | else: 68 | renderer = renderer.lower() 69 | self._verify_renderer(renderer) 70 | self._renderer = renderer 71 | -------------------------------------------------------------------------------- /westat/model/tree/tree_to_img.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | def tree_to_img(file_name, path='', dtype='svg'): 5 | """ 6 | 转换决策树到图片 7 | 8 | Args: 9 | file_name: 决策树文件路径 10 | path: 目标图片的存放路径 11 | dtype: 图片格式 12 | 13 | Returns: 14 | 决策树转换到图片的结果 15 | """ 16 | # 修改字体为中文 17 | file_txt = '' 18 | with open(file_name, 'r', encoding='utf-8') as f: 19 | for line in f: 20 | line = line.replace('helvetica', 'SimHei') 21 | file_txt = file_txt + line 22 | 23 | with open(file_name, 'w', encoding='utf-8') as f: 24 | f.write(file_txt) 25 | 26 | # 转换决策树到图片 27 | if path: 28 | file_path = path 29 | else: 30 | file_path = os.path.splitext(file_name)[0] + '.' + dtype 31 | 32 | str_exec = 'dot -T' + dtype + ' ' + file_name + ' -o ' + file_path # 决策树转图片命令 33 | # print(str_exec) 34 | result = os.popen(str_exec) 35 | return result 36 | -------------------------------------------------------------------------------- /westat/model/tree/tree_to_pdf.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | def tree_to_pdf(file_name, path=''): 5 | """ 6 | 转换决策树到pdf文件 7 | 8 | Args: 9 | file_name: 决策树文件路径 10 | path: 目标pdf文件的存放路径 11 | 12 | Returns: 13 | 决策树转换到pdf文件的结果 14 | """ 15 | # 修改字体为中文 16 | file_txt = '' 17 | with open(file_name, 'r', encoding='utf-8') as f: 18 | for line in f: 19 | line = line.replace('helvetica', 'SimHei') 20 | file_txt = file_txt + line 21 | 22 | with open(file_name, 'w', encoding='utf-8') as f: 23 | f.write(file_txt) 24 | 25 | # 转换决策树到图片 pdf文件 26 | if path: 27 | file_path = path 28 | else: 29 | file_path = os.path.splitext(file_name)[0] + '.pdf' 30 | 31 | str_exec = 'dot -Tpdf ' + file_name + ' -o ' + file_path # 决策树转pdf命令 32 | # print(str_exec) 33 | result = os.popen(str_exec) 34 | return result 35 | -------------------------------------------------------------------------------- /westat/modify/__init__.py: -------------------------------------------------------------------------------- 1 | # 数据修改 2 | from .set_update_bins import set_update_bins 3 | -------------------------------------------------------------------------------- /westat/modify/processes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/modify/processes/__init__.py -------------------------------------------------------------------------------- /westat/modify/set_update_bins.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | 4 | 5 | def set_update_bins(col_bins: pd.DataFrame, 6 | modify_list: list): 7 | """ 8 | 根据手动调整后的分箱,修改自动化生成的分箱结果 9 | Args: 10 | col_bins: 自动化生成的分箱结果 11 | modify_list: 手动调整后的分箱 12 | 13 | Returns: 14 | 返回合并后的分箱结果 15 | 如果手动有调整分箱,则按照调整后的分箱执行,否则按照自动化分箱结果执行 16 | """ 17 | col_bins_adjust = pd.DataFrame(modify_list, columns=['Name', 'NewBins']) 18 | 19 | result = col_bins.merge(col_bins_adjust, on='Name', how='left') 20 | result = result.rename(columns={'Bins': 'OldBins', 'NewBins': 'Bins'}) 21 | result['Bins'][result['Bins'].isnull()] = result['OldBins'] 22 | return result[['Name', 'Bins']] 23 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/Uninstall.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/Uninstall.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/acyclic.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/acyclic.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/bcomps.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/bcomps.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/cairo.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/cairo.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/ccomps.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/ccomps.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/cdt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/cdt.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/cgraph++.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/cgraph++.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/cgraph.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/cgraph.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/circo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/circo.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/concrt140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/concrt140.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/dijkstra.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/dijkstra.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/dot.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/dot.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/dot2gxl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/dot2gxl.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/edgepaint.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/edgepaint.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/expat.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/expat.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/fdp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/fdp.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/fontconfig.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/fontconfig.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gc.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/getopt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/getopt.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/glib-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/glib-2.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gml2gv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gml2gv.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gobject-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gobject-2.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/graphml2gv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/graphml2gv.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gv2gml.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gv2gml.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvc++.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvc++.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvc.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvcolor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvcolor.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvgen.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvgen.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvmap.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvmap.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvpack.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvpack.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvplugin_core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvplugin_core.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvplugin_dot_layout.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvplugin_dot_layout.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvplugin_gdiplus.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvplugin_gdiplus.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvplugin_neato_layout.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvplugin_neato_layout.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvplugin_pango.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvplugin_pango.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvplugin_visio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvplugin_visio.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gvpr.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gvpr.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/gxl2gv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/gxl2gv.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/libharfbuzz-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/libharfbuzz-0.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/mm2gv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/mm2gv.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/msvcp140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/msvcp140.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/msvcp140_1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/msvcp140_1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/msvcp140_2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/msvcp140_2.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/msvcp140_codecvt_ids.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/msvcp140_codecvt_ids.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/neato.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/neato.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/nop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/nop.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/osage.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/osage.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/pango-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/pango-1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/pangocairo-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/pangocairo-1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/pangoft2-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/pangoft2-1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/pangowin32-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/pangowin32-1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/patchwork.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/patchwork.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/pathplan.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/pathplan.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/pixman-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/pixman-1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/sccmap.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/sccmap.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/sfdp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/sfdp.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/tred.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/tred.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/twopi.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/twopi.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/unflatten.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/unflatten.exe -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/vcruntime140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/vcruntime140.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/vcruntime140_1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/vcruntime140_1.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/bin/xdot.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/bin/xdot.dll -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/AGraph.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "cgraph.h" 7 | 8 | #ifdef GVDLL 9 | #if cgraph___EXPORTS // CMake's substitution of cgraph++_EXPORTS 10 | #define AGRAPH_API __declspec(dllexport) 11 | #else 12 | #define AGRAPH_API __declspec(dllimport) 13 | #endif 14 | #endif 15 | 16 | #ifndef AGRAPH_API 17 | #define AGRAPH_API /* nothing */ 18 | #endif 19 | 20 | namespace CGraph { 21 | 22 | /** 23 | * @brief The AGraph class represents an abstract graph 24 | */ 25 | 26 | class AGRAPH_API AGraph { 27 | public: 28 | explicit AGraph(const std::string &dot); 29 | ~AGraph(); 30 | 31 | // delete copy since we manage a C struct using a raw pointer and the struct 32 | // cannot be easily copied since it contains even more raw pointers 33 | AGraph(const AGraph &) = delete; 34 | AGraph &operator=(const AGraph &) = delete; 35 | 36 | // implement move since we manage a C struct using a raw pointer 37 | AGraph(AGraph &&other) noexcept : m_g(std::exchange(other.m_g, nullptr)) {} 38 | AGraph &operator=(AGraph &&other) noexcept { 39 | using std::swap; 40 | swap(m_g, other.m_g); 41 | return *this; 42 | } 43 | 44 | // get a non-owning pointer to the underlying C data structure 45 | Agraph_t *c_struct() const { return m_g; }; 46 | 47 | private: 48 | // the underlying C data structure 49 | Agraph_t *m_g = nullptr; 50 | }; 51 | 52 | } // namespace CGraph 53 | 54 | #undef AGRAPH_API 55 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/GVContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "gvc.h" 7 | 8 | #ifdef GVDLL 9 | #if gvc___EXPORTS // CMake's substitution of gvc++_EXPORTS 10 | #define GVCONTEXT_API __declspec(dllexport) 11 | #else 12 | #define GVCONTEXT_API __declspec(dllimport) 13 | #endif 14 | #endif 15 | 16 | #ifndef GVCONTEXT_API 17 | #define GVCONTEXT_API /* nothing */ 18 | #endif 19 | 20 | namespace GVC { 21 | 22 | /** 23 | * @brief The GVContext class represents a Graphviz context 24 | */ 25 | 26 | class GVCONTEXT_API GVContext { 27 | public: 28 | GVContext(); 29 | /** 30 | * @brief GVContext Create a graph context with built-in plugins and 31 | * optionally load dynamic plugins on demand. 32 | * @param builtins Array of structs, each containing a pointer to 33 | * the name and the address of a plugin to load. The end of the array is 34 | * designated by a struct whose name pointer is NULL. 35 | * @param demand_loading Enables loading plugins dynamically on 36 | * demand when true. 37 | */ 38 | GVContext(const lt_symlist_t *builtins, bool demand_loading); 39 | ~GVContext(); 40 | 41 | // delete copy since we manage a C struct using a raw pointer and the struct 42 | // cannot be easily copied since it contains even more raw pointers 43 | GVContext(GVContext &) = delete; 44 | GVContext &operator=(GVContext &) = delete; 45 | 46 | // implement move since we manage a C struct using a raw pointer 47 | GVContext(GVContext &&other) noexcept 48 | : m_gvc(std::exchange(other.m_gvc, nullptr)) {} 49 | GVContext &operator=(GVContext &&other) noexcept { 50 | using std::swap; 51 | swap(m_gvc, other.m_gvc); 52 | return *this; 53 | } 54 | 55 | // get a non-owning pointer to the underlying C data structure 56 | GVC_t *c_struct() const { return m_gvc; } 57 | 58 | std::string_view buildDate() const; 59 | std::string_view version() const; 60 | 61 | private: 62 | // the underlying C data structure 63 | GVC_t *m_gvc = nullptr; 64 | }; 65 | 66 | } // namespace GVC 67 | 68 | #undef GVCONTEXT_API 69 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/GVLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "AGraph.h" 6 | #include "GVContext.h" 7 | #include "GVRenderData.h" 8 | 9 | #ifdef GVDLL 10 | #if gvc___EXPORTS // CMake's substitution of gvc++_EXPORTS 11 | #define GVLAYOUT_API __declspec(dllexport) 12 | #else 13 | #define GVLAYOUT_API __declspec(dllimport) 14 | #endif 15 | #endif 16 | 17 | #ifndef GVLAYOUT_API 18 | #define GVLAYOUT_API /* nothing */ 19 | #endif 20 | 21 | namespace GVC { 22 | 23 | /** 24 | * @brief The GVLayout class represents a graph layout 25 | */ 26 | 27 | class GVLAYOUT_API GVLayout { 28 | public: 29 | GVLayout(const std::shared_ptr &gvc, 30 | const std::shared_ptr &g, const std::string &engine); 31 | GVLayout(GVContext &&gvc, CGraph::AGraph &&g, const std::string &engine); 32 | GVLayout(std::shared_ptr gvc, CGraph::AGraph &&g, 33 | const std::string &engine); 34 | GVLayout(GVContext &&gvc, std::shared_ptr g, 35 | const std::string &engine); 36 | ~GVLayout(); 37 | 38 | // default copy since we manage resources through movable types 39 | GVLayout(const GVLayout &) = default; 40 | GVLayout &operator=(const GVLayout &) = default; 41 | 42 | // default move since we manage resources through movable types 43 | GVLayout(GVLayout &&) = default; 44 | GVLayout &operator=(GVLayout &&) = default; 45 | 46 | // render the layout in the specified format 47 | GVRenderData render(const std::string &format) const; 48 | 49 | private: 50 | std::shared_ptr m_gvc; 51 | std::shared_ptr m_g; 52 | }; 53 | 54 | } // namespace GVC 55 | 56 | #undef GVLAYOUT_API 57 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/GVRenderData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #ifdef GVDLL 7 | #if gvc___EXPORTS // CMake's substitution of gvc++_EXPORTS 8 | #define GVRENDER_API __declspec(dllexport) 9 | #else 10 | #define GVRENDER_API __declspec(dllimport) 11 | #endif 12 | #endif 13 | 14 | #ifndef GVRENDER_API 15 | #define GVRENDER_API /* nothing */ 16 | #endif 17 | 18 | namespace GVC { 19 | 20 | class GVLayout; 21 | 22 | /** 23 | * @brief The GVRenderData class represents a rendered layout in a specific text 24 | * format 25 | */ 26 | 27 | class GVRENDER_API GVRenderData { 28 | public: 29 | ~GVRenderData(); 30 | 31 | // delete copy for now since we cannot use default because we manage a C 32 | // string using a raw pointer 33 | GVRenderData(GVRenderData &) = delete; 34 | GVRenderData &operator=(GVRenderData &) = delete; 35 | 36 | // delete move for now since we cannot use default because we manage a C 37 | // string using a raw pointer 38 | GVRenderData(GVRenderData &&) = delete; 39 | GVRenderData &operator=(GVRenderData &&) = delete; 40 | 41 | // get the rendered string as a C string. The string is null terminated, but 42 | // that is not useful for binary formats. Combine with the length method for 43 | // that case. 44 | char *c_str() const { return m_data; } 45 | 46 | // get the length of the rendered string 47 | std::size_t length() const { return m_length; } 48 | 49 | // get the rendered string as a string view 50 | std::string_view string_view() const { 51 | return std::string_view{m_data, m_length}; 52 | } 53 | 54 | friend GVLayout; 55 | 56 | private: 57 | // use GVLayout::render to constuct a GVRenderData object 58 | GVRenderData(char *rendered_data, std::size_t length); 59 | 60 | // the underlying C data structure 61 | char *m_data = nullptr; 62 | std::size_t m_length = 0; 63 | }; 64 | 65 | } // namespace GVC 66 | 67 | #undef GVRENDER_API 68 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/arith.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | /* geometric functions (e.g. on points and boxes) with application to, but 12 | * no specific dependence on graphs */ 13 | 14 | #pragma once 15 | 16 | /* for sincos */ 17 | #ifndef _GNU_SOURCE 18 | #define _GNU_SOURCE 1 19 | #endif 20 | 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #ifdef MIN 29 | #undef MIN 30 | #endif 31 | #define MIN(a,b) ((a)<(b)?(a):(b)) 32 | 33 | #ifdef MAX 34 | #undef MAX 35 | #endif 36 | #define MAX(a,b) ((a)>(b)?(a):(b)) 37 | 38 | #define AVG(a,b) ((a + b) / 2) 39 | #define SGN(a) (((a)<0)? -1 : 1) 40 | #define CMP(a,b) (((a)<(b)) ? -1 : (((a)>(b)) ? 1 : 0)) 41 | 42 | #ifndef MAXDOUBLE 43 | #define MAXDOUBLE 1.7976931348623157e+308 44 | #endif 45 | 46 | #ifdef BETWEEN 47 | #undef BETWEEN 48 | #endif 49 | #define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c))) 50 | 51 | #ifndef M_PI 52 | #define M_PI 3.14159265358979323846 53 | #endif 54 | 55 | #ifndef SQRT2 56 | #define SQRT2 1.41421356237309504880 57 | #endif 58 | 59 | #define ROUND(f) ((f>=0)?(int)(f + .5):(int)(f - .5)) 60 | #define RADIANS(deg) ((deg)/180.0 * M_PI) 61 | #define DEGREES(rad) ((rad)/M_PI * 180.0) 62 | 63 | #define SQR(a) ((a) * (a)) 64 | 65 | #ifdef HAVE_SINCOS 66 | extern void sincos(double x, double *s, double *c); 67 | #else 68 | # define sincos(x,s,c) *s = sin(x); *c = cos(x) 69 | #endif 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/color.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef struct hsvrgbacolor_t { 18 | char *name; 19 | unsigned char h, s, v; 20 | unsigned char r, g, b, a; 21 | } hsvrgbacolor_t; 22 | 23 | /* possible representations of color in gvcolor_t */ 24 | typedef enum { HSVA_DOUBLE, RGBA_BYTE, RGBA_WORD, CMYK_BYTE, 25 | RGBA_DOUBLE, COLOR_STRING, COLOR_INDEX } color_type_t; 26 | 27 | /* gvcolor_t can hold a color spec in a choice or representations */ 28 | typedef struct color_s { 29 | union { 30 | double RGBA[4]; 31 | double HSVA[4]; 32 | unsigned char rgba[4]; 33 | unsigned char cmyk[4]; 34 | int rrggbbaa[4]; 35 | char *string; 36 | int index; 37 | } u; 38 | color_type_t type; 39 | } gvcolor_t; 40 | 41 | #define COLOR_MALLOC_FAIL -1 42 | #define COLOR_UNKNOWN 1 43 | #define COLOR_OK 0 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/graphviz_version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define GVPLUGIN_CONFIG_FILE "config6" 3 | #define GVPLUGIN_VERSION 6 4 | #define PACKAGE_BUGREPORT "http://www.graphviz.org/" 5 | #define PACKAGE_NAME "graphviz" 6 | #define PACKAGE_STRING "graphviz 6.0.2" 7 | #define PACKAGE_TARNAME "graphviz" 8 | #define PACKAGE_URL "" 9 | #define PACKAGE_VERSION "6.0.2" 10 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvcext.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | /* Common header used by both clients and plugins */ 12 | 13 | #pragma once 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* 20 | * Define an apis array of name strings using an enumerated api_t as index. 21 | * The enumerated type is defined here. The apis array is 22 | * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS. 23 | */ 24 | #define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage) 25 | 26 | /* 27 | * Define api_t using names based on the plugin names with API_ prefixed. 28 | */ 29 | #define ELEM(x) API_##x, 30 | typedef enum { APIS } api_t; /* API_render, API_layout, ... */ 31 | #undef ELEM 32 | 33 | typedef struct GVJ_s GVJ_t; 34 | typedef struct GVG_s GVG_t; 35 | typedef struct GVC_s GVC_t; 36 | 37 | typedef struct { 38 | const char *name; 39 | void* address; 40 | } lt_symlist_t; 41 | 42 | typedef struct gvplugin_available_s gvplugin_available_t; 43 | 44 | #if !defined(LTDL_H) 45 | extern lt_symlist_t lt_preloaded_symbols[]; 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvcommon.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef struct GVCOMMON_s { 18 | char **info; 19 | char *cmdname; 20 | int verbose; 21 | bool config, auto_outfile_names; 22 | void (*errorfn) (const char *fmt, ...); 23 | const char **show_boxes; /* emit code for correct box coordinates */ 24 | const char **lib; 25 | 26 | /* rendering state */ 27 | int viewNum; /* current view - 1 based count of views, 28 | all pages in all layers */ 29 | const lt_symlist_t *builtins; 30 | int demand_loading; 31 | } GVCOMMON_t; 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvconfig.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | /* Header used by plugins */ 12 | 13 | #pragma once 14 | 15 | #include "gvplugin.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | extern void gvconfig_plugin_install_from_library(GVC_t * gvc, 22 | char *package_path, 23 | gvplugin_library_t *library); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvplugin.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | /* Header used by plugins */ 12 | 13 | #pragma once 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #include "gvcext.h" 20 | 21 | /* 22 | * Terminology: 23 | * 24 | * package - e.g. libgvplugin_cairo.so 25 | * api - e.g. render 26 | * type - e.g. "png", "ps" 27 | */ 28 | 29 | typedef struct { 30 | int id; /* an id that is only unique within a package 31 | of plugins of the same api. 32 | A renderer-type such as "png" in the cairo package 33 | has an id that is different from the "ps" type 34 | in the same package */ 35 | const char *type; /* a string name, such as "png" or "ps" that 36 | distinguishes different types within the same 37 | (renderer in this case) */ 38 | int quality; /* an arbitrary integer used for ordering plugins of 39 | the same type from different packages */ 40 | void *engine; /* pointer to the jump table for the plugin */ 41 | void *features; /* pointer to the feature description 42 | void* because type varies by api */ 43 | } gvplugin_installed_t; 44 | 45 | typedef struct { 46 | api_t api; 47 | gvplugin_installed_t *types; 48 | } gvplugin_api_t; 49 | 50 | typedef struct { 51 | char *packagename; /* used when this plugin is builtin and has 52 | no pathname */ 53 | gvplugin_api_t *apis; 54 | } gvplugin_library_t; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvplugin_device.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #include "types.h" 14 | #include "gvplugin.h" 15 | #include "gvcjob.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | struct gvdevice_engine_s { 22 | void (*initialize) (GVJ_t * firstjob); 23 | void (*format) (GVJ_t * firstjob); 24 | void (*finalize) (GVJ_t * firstjob); 25 | }; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvplugin_layout.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #include "types.h" 14 | #include "gvplugin.h" 15 | #include "gvcjob.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | struct gvlayout_engine_s { 22 | void (*layout) (graph_t * g); 23 | void (*cleanup) (graph_t * g); 24 | }; 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvplugin_loadimage.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #include "types.h" 14 | #include "gvplugin.h" 15 | #include "gvcjob.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #ifdef GVDLL 23 | #ifdef GVC_EXPORTS 24 | #define GVPLUGIN_LOADIMAGE_API __declspec(dllexport) 25 | #else 26 | #define GVPLUGIN_LOADIMAGE_API __declspec(dllimport) 27 | #endif 28 | #endif 29 | 30 | #ifndef GVPLUGIN_LOADIMAGE_API 31 | #define GVPLUGIN_LOADIMAGE_API /* nothing */ 32 | #endif 33 | 34 | GVPLUGIN_LOADIMAGE_API bool gvusershape_file_access(usershape_t *us); 35 | GVPLUGIN_LOADIMAGE_API void gvusershape_file_release(usershape_t *us); 36 | 37 | struct gvloadimage_engine_s { 38 | void (*loadimage) (GVJ_t *job, usershape_t *us, boxf b, bool filled); 39 | }; 40 | 41 | #undef GVPLUGIN_LOADIMAGE_API 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvplugin_render.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #include "types.h" 14 | #include "gvplugin.h" 15 | #include "gvcjob.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | struct gvrender_engine_s { 22 | void (*begin_job) (GVJ_t * job); 23 | void (*end_job) (GVJ_t * job); 24 | void (*begin_graph) (GVJ_t * job); 25 | void (*end_graph) (GVJ_t * job); 26 | void (*begin_layer) (GVJ_t * job, char *layername, 27 | int layerNum, int numLayers); 28 | void (*end_layer) (GVJ_t * job); 29 | void (*begin_page) (GVJ_t * job); 30 | void (*end_page) (GVJ_t * job); 31 | void (*begin_cluster) (GVJ_t * job); 32 | void (*end_cluster) (GVJ_t * job); 33 | void (*begin_nodes) (GVJ_t * job); 34 | void (*end_nodes) (GVJ_t * job); 35 | void (*begin_edges) (GVJ_t * job); 36 | void (*end_edges) (GVJ_t * job); 37 | void (*begin_node) (GVJ_t * job); 38 | void (*end_node) (GVJ_t * job); 39 | void (*begin_edge) (GVJ_t * job); 40 | void (*end_edge) (GVJ_t * job); 41 | void (*begin_anchor) (GVJ_t * job, 42 | char *href, char *tooltip, char *target, char *id); 43 | void (*end_anchor) (GVJ_t * job); 44 | void (*begin_label) (GVJ_t * job, label_type type); 45 | void (*end_label) (GVJ_t * job); 46 | void (*textspan) (GVJ_t * job, pointf p, textspan_t * span); 47 | void (*resolve_color) (GVJ_t * job, gvcolor_t * color); 48 | void (*ellipse) (GVJ_t * job, pointf * A, int filled); 49 | void (*polygon) (GVJ_t * job, pointf * A, int n, int filled); 50 | void (*beziercurve) (GVJ_t * job, pointf * A, int n, 51 | int arrow_at_start, int arrow_at_end, int); 52 | void (*polyline) (GVJ_t * job, pointf * A, int n); 53 | void (*comment) (GVJ_t * job, char *comment); 54 | void (*library_shape) (GVJ_t * job, char *name, pointf * A, int n, int filled); 55 | }; 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/gvplugin_textlayout.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #include "types.h" 14 | #include "gvplugin.h" 15 | #include "gvcjob.h" 16 | #include "gvcommon.h" 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | struct gvtextlayout_engine_s { 24 | bool (*textlayout) (textspan_t *span, char** fontpath); 25 | }; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/pathgeom.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifdef GVDLL 18 | #ifdef PATHPLAN_EXPORTS 19 | #define PATHGEOM_API __declspec(dllexport) 20 | #else 21 | #define PATHGEOM_API __declspec(dllimport) 22 | #endif 23 | #endif 24 | 25 | #ifndef PATHGEOM_API 26 | #define PATHGEOM_API /* nothing */ 27 | #endif 28 | 29 | #ifdef HAVE_POINTF_S 30 | typedef struct pointf_s Ppoint_t; 31 | typedef struct pointf_s Pvector_t; 32 | #else 33 | typedef struct Pxy_t { 34 | double x, y; 35 | } Pxy_t; 36 | 37 | typedef struct Pxy_t Ppoint_t; 38 | typedef struct Pxy_t Pvector_t; 39 | #endif 40 | 41 | typedef struct Ppoly_t { 42 | Ppoint_t *ps; 43 | int pn; 44 | } Ppoly_t; 45 | 46 | typedef Ppoly_t Ppolyline_t; 47 | 48 | typedef struct Pedge_t { 49 | Ppoint_t a, b; 50 | } Pedge_t; 51 | 52 | /* opaque state handle for visibility graph operations */ 53 | typedef struct vconfig_s vconfig_t; 54 | 55 | PATHGEOM_API void freePath(Ppolyline_t* p); 56 | 57 | #undef PATHGEOM_API 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/pathplan.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief finds and smooths shortest paths 4 | */ 5 | 6 | /************************************************************************* 7 | * Copyright (c) 2011 AT&T Intellectual Property 8 | * All rights reserved. This program and the accompanying materials 9 | * are made available under the terms of the Eclipse Public License v1.0 10 | * which accompanies this distribution, and is available at 11 | * http://www.eclipse.org/legal/epl-v10.html 12 | * 13 | * Contributors: Details at https://graphviz.org 14 | *************************************************************************/ 15 | 16 | #pragma once 17 | 18 | #include "pathgeom.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #ifdef GVDLL 25 | #ifdef PATHPLAN_EXPORTS 26 | #define PATHPLAN_API __declspec(dllexport) 27 | #else 28 | #define PATHPLAN_API __declspec(dllimport) 29 | #endif 30 | #endif 31 | 32 | #ifndef PATHPLAN_API 33 | #define PATHPLAN_API /* nothing */ 34 | #endif 35 | 36 | /* find shortest euclidean path within a simple polygon */ 37 | PATHPLAN_API int Pshortestpath(Ppoly_t * boundary, Ppoint_t endpoints[2], 38 | Ppolyline_t * output_route); 39 | 40 | /* fit a spline to an input polyline, without touching barrier segments */ 41 | PATHPLAN_API int Proutespline(Pedge_t * barriers, int n_barriers, 42 | Ppolyline_t input_route, 43 | Pvector_t endpoint_slopes[2], 44 | Ppolyline_t * output_route); 45 | 46 | /* utility function to convert from a set of polygonal obstacles to barriers */ 47 | PATHPLAN_API int Ppolybarriers(Ppoly_t ** polys, int npolys, 48 | Pedge_t ** barriers, int *n_barriers); 49 | 50 | /* function to convert a polyline into a spline representation */ 51 | PATHPLAN_API void make_polyline(Ppolyline_t line, Ppolyline_t* sline); 52 | 53 | #undef PATHPLAN_API 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/textspan.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief @ref textspan_t, @ref textfont_t, @ref PostscriptAlias 4 | */ 5 | 6 | /************************************************************************* 7 | * Copyright (c) 2011 AT&T Intellectual Property 8 | * All rights reserved. This program and the accompanying materials 9 | * are made available under the terms of the Eclipse Public License v1.0 10 | * which accompanies this distribution, and is available at 11 | * http://www.eclipse.org/legal/epl-v10.html 12 | * 13 | * Contributors: Details at https://graphviz.org 14 | *************************************************************************/ 15 | 16 | #pragma once 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #define GV_TEXTFONT_FLAGS_WIDTH 7 23 | 24 | /* Bold, Italic, Underline, Sup, Sub, Strike */ 25 | /* Stored in textfont_t.flags, which is GV_TEXTFONT_FLAGS_WIDTH bits, so full */ 26 | /* Probably should be moved to textspan_t */ 27 | #define HTML_BF (1 << 0) 28 | #define HTML_IF (1 << 1) 29 | #define HTML_UL (1 << 2) 30 | #define HTML_SUP (1 << 3) 31 | #define HTML_SUB (1 << 4) 32 | #define HTML_S (1 << 5) 33 | #define HTML_OL (1 << 6) 34 | 35 | typedef struct _PostscriptAlias { 36 | char* name; 37 | char* family; 38 | char* weight; 39 | char* stretch; 40 | char* style; 41 | int xfig_code; 42 | char* svg_font_family; 43 | char* svg_font_weight; 44 | char* svg_font_style; 45 | } PostscriptAlias; 46 | 47 | /* font information 48 | * If name or color is NULL, or size < 0, that attribute 49 | * is unspecified. 50 | */ 51 | typedef struct { 52 | char* name; 53 | char* color; 54 | PostscriptAlias *postscript_alias; 55 | double size; 56 | unsigned int flags:GV_TEXTFONT_FLAGS_WIDTH; // HTML_UL, HTML_IF, HTML_BF, etc. 57 | unsigned int cnt:(sizeof(unsigned int) * 8 - GV_TEXTFONT_FLAGS_WIDTH); 58 | ///< reference count 59 | } textfont_t; 60 | 61 | /* atomic unit of text emitted using a single htmlfont_t */ 62 | typedef struct { 63 | char *str; /* stored in utf-8 */ 64 | textfont_t *font; 65 | void *layout; 66 | void (*free_layout) (void *layout); /* FIXME - this is ugly */ 67 | double yoffset_layout, yoffset_centerline; 68 | pointf size; 69 | char just; /* 'l' 'n' 'r' */ /* FIXME */ 70 | } textspan_t; 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/include/graphviz/usershape.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * Copyright (c) 2011 AT&T Intellectual Property 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: Details at https://graphviz.org 9 | *************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #include "cdt.h" 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | typedef enum { FT_NULL, 21 | FT_BMP, FT_GIF, FT_PNG, FT_JPEG, 22 | FT_PDF, FT_PS, FT_EPS, FT_SVG, FT_XML, 23 | FT_RIFF, FT_WEBP, FT_ICO, FT_TIFF 24 | } imagetype_t; 25 | 26 | typedef enum { 27 | IMAGESCALE_FALSE, /* no image scaling */ 28 | IMAGESCALE_TRUE, /* scale image to fit but keep aspect ratio */ 29 | IMAGESCALE_WIDTH, /* scale image width to fit, keep height fixed */ 30 | IMAGESCALE_HEIGHT, /* scale image height to fit, keep width fixed */ 31 | IMAGESCALE_BOTH /* scale image to fit without regard for aspect ratio */ 32 | } imagescale_t; 33 | 34 | typedef enum { 35 | IMAGEPOS_TOP_LEFT, /* top left */ 36 | IMAGEPOS_TOP_CENTER, /* top center */ 37 | IMAGEPOS_TOP_RIGHT, /* top right */ 38 | IMAGEPOS_MIDDLE_LEFT, /* middle left */ 39 | IMAGEPOS_MIDDLE_CENTER, /* middle center (true center, the default)*/ 40 | IMAGEPOS_MIDDLE_RIGHT, /* middle right */ 41 | IMAGEPOS_BOTTOM_LEFT, /* bottom left */ 42 | IMAGEPOS_BOTTOM_CENTER, /* bottom center */ 43 | IMAGEPOS_BOTTOM_RIGHT /* bottom right */ 44 | } imagepos_t; 45 | 46 | typedef struct usershape_s usershape_t; 47 | 48 | struct usershape_s { 49 | Dtlink_t link; 50 | const char *name; 51 | int macro_id; 52 | bool must_inline; 53 | bool nocache; 54 | FILE *f; 55 | imagetype_t type; 56 | char *stringtype; 57 | int x, y, w, h, dpi; 58 | void *data; /* data loaded by a renderer */ 59 | size_t datasize; /* size of data (if mmap'ed) */ 60 | void (*datafree)(usershape_t *us); /* renderer's function for freeing data */ 61 | }; 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/KW91.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | style=bold; 3 | subgraph cluster_outer { 4 | Act_1 -> Act_21; 5 | Act_1 -> Act_23; 6 | Act_25 -> Act_3; 7 | subgraph cluster_inner { 8 | label = " Act_2"; 9 | {Act_21 -> Act_22 [minlen=2]; rank=same;} 10 | Act_22 -> Act_23; 11 | Act_22 -> Act_24; 12 | {Act_23 -> Act_24 [minlen=2]; rank=same;} 13 | Act_23 -> Act_25; 14 | Act_24 -> Act_25; 15 | } 16 | } 17 | Ext_1 -> Act_1; 18 | Act_3 -> Ext_2; 19 | Ext_3 -> Act_24; 20 | } 21 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/Latin1.gv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stat-fit/westat/46275298411d866efa82465467f50b4890238c98/westat/plugins/win/Graphviz/share/graphviz/graphs/directed/Latin1.gv -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/abstract.gv: -------------------------------------------------------------------------------- 1 | digraph abstract { 2 | size="6,6"; 3 | S24 -> 27; 4 | S24 -> 25; 5 | S1 -> 10; 6 | S1 -> 2; 7 | S35 -> 36; 8 | S35 -> 43; 9 | S30 -> 31; 10 | S30 -> 33; 11 | 9 -> 42; 12 | 9 -> T1; 13 | 25 -> T1; 14 | 25 -> 26; 15 | 27 -> T24; 16 | 2 -> 3; 17 | 2 -> 16; 18 | 2 -> 17; 19 | 2 -> T1; 20 | 2 -> 18; 21 | 10 -> 11; 22 | 10 -> 14; 23 | 10 -> T1; 24 | 10 -> 13; 25 | 10 -> 12; 26 | 31 -> T1; 27 | 31 -> 32; 28 | 33 -> T30; 29 | 33 -> 34; 30 | 42 -> 4; 31 | 26 -> 4; 32 | 3 -> 4; 33 | 16 -> 15; 34 | 17 -> 19; 35 | 18 -> 29; 36 | 11 -> 4; 37 | 14 -> 15; 38 | 37 -> 39; 39 | 37 -> 41; 40 | 37 -> 38; 41 | 37 -> 40; 42 | 13 -> 19; 43 | 12 -> 29; 44 | 43 -> 38; 45 | 43 -> 40; 46 | 36 -> 19; 47 | 32 -> 23; 48 | 34 -> 29; 49 | 39 -> 15; 50 | 41 -> 29; 51 | 38 -> 4; 52 | 40 -> 19; 53 | 4 -> 5; 54 | 19 -> 21; 55 | 19 -> 20; 56 | 19 -> 28; 57 | 5 -> 6; 58 | 5 -> T35; 59 | 5 -> 23; 60 | 21 -> 22; 61 | 20 -> 15; 62 | 28 -> 29; 63 | 6 -> 7; 64 | 15 -> T1; 65 | 22 -> 23; 66 | 22 -> T35; 67 | 29 -> T30; 68 | 7 -> T8; 69 | 23 -> T24; 70 | 23 -> T1; 71 | } 72 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/alf.gv: -------------------------------------------------------------------------------- 1 | digraph Alf { 2 | size = "6,9"; 3 | node [ shape = record ]; 4 | Decl [ label = "\n\nDecl|{name|access|decl_flags|extern_c_linkage}"]; 5 | Nontype_decl [ label = "Nontype_decl|{type}"]; 6 | Defined_decl [ label = "Defined_decl|{linkage}"]; 7 | Data_decl [ label = "Data_decl|{storage_class}"]; 8 | Function_decl [ label = "Function_decl|{formals|defaults}"]; 9 | Data [ label = "Data|{initializer}"]; 10 | Function [ label = "Function|{body}"]; 11 | Constructor [ label = "Constructor|{member_initializers}"]; 12 | Aggregate -> Type_decl ; 13 | Class -> Aggregate; 14 | Union -> Aggregate; 15 | Data -> Data_decl; 16 | Data -> Defn; 17 | Data_decl -> Defined_decl; 18 | Data_member -> Nontype_decl ; 19 | Defined_decl -> Nontype_decl; 20 | Defn -> Defined_decl; 21 | Enum -> Type_decl ; 22 | Enumerator -> Nontype_decl ; 23 | Function -> Defn; 24 | Function -> Function_decl; 25 | Constructor -> Function; 26 | Destructor -> Function; 27 | Function_decl -> Defined_decl; 28 | Nontype_decl -> Decl ; 29 | Template_type_arg -> Type_decl ; 30 | Type_decl -> Decl ; 31 | Typedef -> Type_decl ; 32 | } 33 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/biological.gv: -------------------------------------------------------------------------------- 1 | digraph g { 2 | rankdir=LR; 3 | 4 | node [shape=rpromoter colorscheme=rdbu5 color=1 style=filled fontcolor=3]; Hef1a; TRE; UAS; Hef1aLacOid; 5 | Hef1aLacOid [label="Hef1a-LacOid"]; 6 | node [shape=rarrow colorscheme=rdbu5 color=5 style=filled fontcolor=3]; Gal4VP16; LacI; rtTA3; DeltamCherry; 7 | Gal4VP16 [label="Gal4-VP16"]; 8 | product [shape=oval style=filled colorscheme=rdbu5 color=2 label=""]; 9 | repression [shape=oval label="LacI repression" fontcolor=black style=dotted]; 10 | node [shape=oval style=filled colorscheme=rdbu5 color=4 fontcolor=5]; 11 | combination [label="rtTA3 + Doxycycline"]; 12 | LacIprotein [label="LacI"]; 13 | rtTA3protein [label="rtTA3"]; 14 | Gal4VP16protein [label="Gal4-VP16"]; 15 | 16 | 17 | subgraph cluster_0 { 18 | colorscheme=rdbu5; 19 | color=3; 20 | node [colorscheme=rdbu5 fontcolor=3]; 21 | Hef1a -> Gal4VP16 [arrowhead=none]; 22 | Gal4VP16 -> UAS [arrowhead=none]; 23 | UAS -> LacI [arrowhead=none]; 24 | LacI -> Hef1aLacOid [arrowhead=none]; 25 | Hef1aLacOid -> rtTA3 [arrowhead=none]; 26 | rtTA3 -> TRE [arrowhead=none]; 27 | TRE -> DeltamCherry [arrowhead=none] 28 | } 29 | 30 | Gal4VP16 -> Gal4VP16protein; 31 | Gal4VP16protein -> UAS; 32 | LacI -> LacIprotein; 33 | LacIprotein -> repression; 34 | repression -> Hef1aLacOid [arrowhead=tee]; 35 | IPTG -> repression [arrowhead=tee]; 36 | rtTA3 -> rtTA3protein; 37 | rtTA3protein -> combination; 38 | combination -> TRE; 39 | Doxycycline -> combination; 40 | DeltamCherry -> product; 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/clust.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | subgraph cluster_0 { 3 | label = "hello world"; 4 | a -> b; 5 | a -> c; 6 | color = hotpink; 7 | } 8 | 9 | subgraph cluster_1 { 10 | label = "MSDOT"; 11 | style= "dashed"; 12 | color=purple; 13 | x -> y; 14 | x -> z; 15 | y -> z; 16 | y -> q; 17 | } 18 | 19 | top -> a; 20 | top -> y; 21 | y -> b; 22 | } 23 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/clust1.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | subgraph cluster_c0 {a0 -> a1 -> a2 -> a3;} 3 | subgraph cluster_c1 {b0 -> b1 -> b2 -> b3;} 4 | x -> a0; 5 | x -> b0; 6 | a1 -> a3; 7 | a3 -> a0; 8 | } 9 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/clust2.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | subgraph cluster_c0 {a0 -> a1 -> a2 -> a3;} 3 | subgraph cluster_c1 {b0 -> b1 -> b2 -> b3;} 4 | x -> a0; 5 | x -> b0; 6 | a1 -> b3; 7 | b3 -> a1; 8 | } 9 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/clust3.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | subgraph cluster_c0 {a0 -> a1 -> a2 -> a3;} 3 | subgraph cluster_c1 {b0 -> b1 -> b2 -> b3;} 4 | x -> a0; 5 | x -> b0; 6 | a1 -> b3; 7 | b1 -> a3; 8 | } 9 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/clust4.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | 3 | subgraph cluster_0 { 4 | style=filled; 5 | color=lightgrey; 6 | node [style=filled,color=white]; 7 | a0 -> a1 -> a2 -> a3; 8 | label = "process #1"; 9 | } 10 | 11 | subgraph cluster_1 { 12 | node [style=filled]; 13 | b0 -> b1 -> b2 -> b3; 14 | label = "process #2"; 15 | color=blue 16 | } 17 | start -> a0; 18 | start -> b0; 19 | a1 -> b3; 20 | b2 -> a3; 21 | a3 -> a0; 22 | a3 -> end; 23 | b3 -> end; 24 | 25 | start [shape=Mdiamond]; 26 | end [shape=Msquare]; 27 | } 28 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/clust5.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | size="6,6"; 3 | a -> b -> c; 4 | 5 | subgraph cluster0 { 6 | x0 -> y0; 7 | x0 -> z0; 8 | } 9 | 10 | subgraph cluster1 { 11 | x1 -> y1; 12 | x1 -> z1; 13 | } 14 | 15 | subgraph cluster2 { 16 | x2 -> y2; 17 | x2 -> z2; 18 | } 19 | 20 | a -> x0; 21 | b -> x1; 22 | b -> x2; 23 | a -> z2; 24 | c -> z1; 25 | } 26 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/ctext.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | xyz [label = "hello\nworld",color="slateblue",fontsize=24,fontname="Palatino-Italic",style=filled,fontcolor="hotpink"]; 3 | node [style=filled]; 4 | red [color=red]; 5 | green [color=green]; 6 | blue [color=blue,fontcolor=black]; 7 | cyan [color=cyan]; 8 | magenta [color=magenta]; 9 | yellow [color=yellow]; 10 | orange [color=orange]; 11 | red -> green; 12 | red -> blue; 13 | blue -> cyan; 14 | blue -> magenta; 15 | green -> yellow; 16 | green -> orange; 17 | } 18 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/dfa.gv: -------------------------------------------------------------------------------- 1 | digraph g { 2 | "start" [ label = "MWGC-" ]; 3 | "n1" [ label = "WC-MG" ]; 4 | "n2" [ label = "MWC-G" ]; 5 | "n3" [ label = "C-MWG" ]; 6 | "n4" [ label = "W-MGC" ]; 7 | "n5" [ label = "MGC-W" ]; 8 | "n6" [ label = "MWG-C" ]; 9 | "n7" [ label = "G-MWC" ]; 10 | "n8" [ label = "MG-WC" ]; 11 | "n9" [ label = "-MWGC" ]; 12 | "start" -> "n1" [ label = "g" ]; 13 | "n1" -> "start" [ label = "g" ]; 14 | subgraph l { rank = same; "n3" "n4" } 15 | subgraph r { rank = same; "n5" "n6" } 16 | "n1" -> "n2" [ label = "m" ]; 17 | "n2" -> "n1" [ label = "m" ]; 18 | "n2" -> "n3" [ label = "w" ]; 19 | "n3" -> "n2" [ label = "w" ]; 20 | "n2" -> "n4" [ label = "c" ]; 21 | "n4" -> "n2" [ label = "c" ]; 22 | "n3" -> "n5" [ label = "g" ]; 23 | "n5" -> "n3" [ label = "g" ]; 24 | "n4" -> "n6" [ label = "g" ]; 25 | "n6" -> "n4" [ label = "g" ]; 26 | "n5" -> "n7" [ label = "c" ]; 27 | "n7" -> "n5" [ label = "c" ]; 28 | "n6" -> "n7" [ label = "w" ]; 29 | "n7" -> "n6" [ label = "w" ]; 30 | "n7" -> "n8" [ label = "m" ]; 31 | "n8" -> "n7" [ label = "m" ]; 32 | "n8" -> "n9" [ label = "g" ]; 33 | "n9" -> "n8" [ label = "g" ]; 34 | } 35 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/fig6.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | size = "8,8"; 3 | {rank=min S8 S24 S1 S35 S30} 4 | {rank=max T8 T24 T1 T35 T30} 5 | S8 -> 9; 6 | S24 -> 27; 7 | S24 -> 25; 8 | S1 -> 10; 9 | S1 -> 2; 10 | S35 -> 36; 11 | S35 -> 43; 12 | S30 -> 31; 13 | S30 -> 33; 14 | 9 -> 42; 15 | 9 -> T1; 16 | 25 -> T1; 17 | 25 -> 26; 18 | 27 -> T24; 19 | 2 -> 3; 20 | 2 -> 16; 21 | 2 -> 17; 22 | 2 -> T1; 23 | 2 -> 18; 24 | 10 -> 11; 25 | 10 -> 14; 26 | 10 -> T1; 27 | 10 -> 13; 28 | 10 -> 12; 29 | 31 -> T1; 30 | 31 -> 32; 31 | 33 -> T30; 32 | 33 -> 34; 33 | 42 -> 4; 34 | 26 -> 4; 35 | 3 -> 4; 36 | 16 -> 15; 37 | 17 -> 19; 38 | 18 -> 29; 39 | 11 -> 4; 40 | 14 -> 15; 41 | 37 -> 39; 42 | 37 -> 41; 43 | 37 -> 38; 44 | 37 -> 40; 45 | 13 -> 19; 46 | 12 -> 29; 47 | 43 -> 38; 48 | 43 -> 40; 49 | 36 -> 19; 50 | 32 -> 23; 51 | 34 -> 29; 52 | 39 -> 15; 53 | 41 -> 29; 54 | 38 -> 4; 55 | 40 -> 19; 56 | 4 -> 5; 57 | 19 -> 21; 58 | 19 -> 20; 59 | 19 -> 28; 60 | 5 -> 6; 61 | 5 -> T35; 62 | 5 -> 23; 63 | 21 -> 22; 64 | 20 -> 15; 65 | 28 -> 29; 66 | 6 -> 7; 67 | 15 -> T1; 68 | 22 -> 23; 69 | 22 -> T35; 70 | 29 -> T30; 71 | 7 -> T8; 72 | 23 -> T24; 73 | 23 -> T1; 74 | } 75 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/fsm.gv: -------------------------------------------------------------------------------- 1 | digraph finite_state_machine { 2 | 3 | node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8; 4 | node [shape = circle]; 5 | rankdir=LR; 6 | LR_0 -> LR_2 [ label = "SS(B)" ]; 7 | LR_0 -> LR_1 [ label = "SS(S)" ]; 8 | LR_1 -> LR_3 [ label = "S($end)" ]; 9 | LR_2 -> LR_6 [ label = "SS(b)" ]; 10 | LR_2 -> LR_5 [ label = "SS(a)" ]; 11 | LR_2 -> LR_4 [ label = "S(A)" ]; 12 | LR_5 -> LR_7 [ label = "S(b)" ]; 13 | LR_5 -> LR_5 [ label = "S(a)" ]; 14 | LR_6 -> LR_6 [ label = "S(b)" ]; 15 | LR_6 -> LR_5 [ label = "S(a)" ]; 16 | LR_7 -> LR_8 [ label = "S(b)" ]; 17 | LR_7 -> LR_5 [ label = "S(a)" ]; 18 | LR_8 -> LR_6 [ label = "S(b)" ]; 19 | LR_8 -> LR_5 [ label = "S(a)" ]; 20 | } 21 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/grammar.gv: -------------------------------------------------------------------------------- 1 | digraph L0 { 2 | size = "8,8"; 3 | ordering=out; 4 | node [shape = box]; 5 | 6 | n0 [label="E"]; 7 | n1 [label="T"]; 8 | n2 [label="F"]; 9 | n3 [label="IDENT : a "]; 10 | n4 [label="+"]; 11 | n5 [label="T"]; 12 | n6 [label="F"]; 13 | n7 [label="("]; 14 | n8 [label="E"]; 15 | n9 [label="T"]; 16 | n10 [label="F"]; 17 | n11 [label="IDENT : b "]; 18 | n12 [label="*"]; 19 | n13 [label="F"]; 20 | n14 [label="IDENT : c "]; 21 | n15 [label=")"]; 22 | n16 [label="*"]; 23 | n17 [label="F"]; 24 | n18 [label="("]; 25 | n19 [label="E"]; 26 | n20 [label="T"]; 27 | n21 [label="F"]; 28 | n22 [label="IDENT : d "]; 29 | n23 [label="*"]; 30 | n24 [label="F"]; 31 | n25 [label="IDENT : e "]; 32 | n26 [label="+"]; 33 | n27 [label="T"]; 34 | n28 [label="F"]; 35 | n29 [label="("]; 36 | n30 [label="E"]; 37 | n31 [label="T"]; 38 | n32 [label="F"]; 39 | n33 [label="IDENT : a "]; 40 | n34 [label="*"]; 41 | n35 [label="F"]; 42 | n36 [label="IDENT : b "]; 43 | n37 [label=")"]; 44 | n38 [label=")"]; 45 | n39 [label="+"]; 46 | n40 [label="T"]; 47 | n41 [label="F"]; 48 | n42 [label="IDENT : q "]; 49 | n0 -> { n1 n4 n5 n39 n40 }; 50 | n1 -> n2 ; 51 | n2 -> n3 ; 52 | n5 -> { n6 n16 n17 }; 53 | n6 -> { n7 n8 n15 }; 54 | n8 -> n9 ; 55 | n9 -> { n10 n12 n13 }; 56 | n10 -> n11 ; 57 | n13 -> n14 ; 58 | n17 -> { n18 n19 n38 }; 59 | n19 -> { n20 n26 n27 }; 60 | n20 -> { n21 n23 n24 }; 61 | n21 -> n22 ; 62 | n24 -> n25 ; 63 | n27 -> n28 ; 64 | n28 -> { n29 n30 n37 }; 65 | n30 -> n31 ; 66 | n31 -> { n32 n34 n35 }; 67 | n32 -> n33 ; 68 | n35 -> n36 ; 69 | n40 -> n41 ; 70 | n41 -> n42 ; 71 | } 72 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/hashtable.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | nodesep=.05; 3 | rankdir=LR; 4 | node [shape=record,width=.1,height=.1]; 5 | 6 | node0 [label = " | | | | | | | ",height=2.0]; 7 | node [width = 1.5]; 8 | node1 [label = "{ n14 | 719 |

}"]; 9 | node2 [label = "{ a1 | 805 |

}"]; 10 | node3 [label = "{ i9 | 718 |

}"]; 11 | node4 [label = "{ e5 | 989 |

}"]; 12 | node5 [label = "{ t20 | 959 |

}"] ; 13 | node6 [label = "{ o15 | 794 |

}"] ; 14 | node7 [label = "{ s19 | 659 |

}"] ; 15 | 16 | node0:f0 -> node1:n; 17 | node0:f1 -> node2:n; 18 | node0:f2 -> node3:n; 19 | node0:f5 -> node4:n; 20 | node0:f6 -> node5:n; 21 | node2:p -> node6:n; 22 | node4:p -> node7:n; 23 | } 24 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/japanese.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | graph [label="下駄配列の派生図"] 3 | 4 | getas [label = "下駄配列"]; 5 | new_getas [label = "新下駄配列"]; 6 | getas_in_fine_weather [label = "日和下駄配列"]; 7 | black_lacquered_getas [label = "黒塗り下駄配列"]; 8 | black_lacquered_getas_made_of_paulownia [label = "黒塗り桐下駄配列"]; 9 | lacquered_getas [label = "塗り下駄配列"]; 10 | new_JIS_getas [label = "新JIS下駄配列"]; 11 | 12 | getas -> { 13 | getas_in_fine_weather 14 | lacquered_getas 15 | new_JIS_getas new_getas 16 | lacquered_getas 17 | }; 18 | 19 | lacquered_getas -> black_lacquered_getas; 20 | black_lacquered_getas -> black_lacquered_getas_made_of_paulownia; 21 | black_lacquered_getas_made_of_paulownia -> black_lacquered_getas; 22 | 23 | black_lacquered_getas -> getas_in_fine_weather [style = dotted]; 24 | } 25 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/jcctree.gv: -------------------------------------------------------------------------------- 1 | digraph "tree" { 2 | // The problem disappeared when I removed the "ELEM3 -> ID5;" line! 3 | //size="4,5"; 4 | ordering=out; 5 | node [shape=plaintext]; 6 | SPEC -> DEF2; 7 | SPEC -> DEF1; 8 | DEF1 -> ID1; 9 | DEF1 -> SET1; 10 | DEF1 -> SC1; 11 | DEF2 -> ID2; 12 | DEF2 -> SET2; 13 | DEF2 -> SC2; 14 | SET1 -> OPEN1; 15 | SET1 -> ELEM1; 16 | SET1 -> SC3; 17 | SET1 -> ELEM2; 18 | SET1 -> CLOSE1; 19 | ELEM1 -> ID3; 20 | SET2 -> OPEN2; 21 | SET2 -> ELEM3; 22 | SET2 -> CLOSE2; 23 | ELEM2 -> ID4; 24 | ELEM3 -> ID5; 25 | DEF1 [label=DEF]; 26 | DEF2 [label=DEF]; 27 | SET1 [label=SET]; 28 | SC1 [label=";"]; 29 | SC3 [label=";"]; 30 | SET2 [label=SET]; 31 | SC2 [label=";"]; 32 | OPEN1 [label="{"]; 33 | OPEN2 [label="{"]; 34 | CLOSE1 [label="}"]; 35 | CLOSE2 [label="}"]; 36 | ELEM1 [label=ELEMENT]; 37 | ELEM2 [label=ELEMENT]; 38 | ELEM3 [label=ELEMENT]; 39 | ID1 [label=cities]; 40 | ID2 [label=insects]; 41 | ID3 [label=andover]; 42 | ID4 [label=boston]; 43 | ID5 [label=fly]; 44 | } 45 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/longflat.gv: -------------------------------------------------------------------------------- 1 | digraph if 2 | { 3 | rankdir=LR; 4 | {rank=same;b;c;} 5 | a->b; 6 | c->b[label="long long long"]; 7 | } 8 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/mike.gv: -------------------------------------------------------------------------------- 1 | digraph mike{ 2 | size = "8,8"; 3 | a -> A; 4 | a -> m; 5 | a -> E; 6 | t -> O; 7 | r -> V; 8 | r -> Q; 9 | p -> B; 10 | m -> R; 11 | l -> C; 12 | c -> C; 13 | W -> X; 14 | W -> D; 15 | V -> W; 16 | T -> U; 17 | Q -> T; 18 | Q -> H; 19 | Q -> A; 20 | O -> K; 21 | L -> U; 22 | K -> L; 23 | K -> J; 24 | K -> E; 25 | J -> I; 26 | R -> B; 27 | P -> F; 28 | H -> R; 29 | H -> P; 30 | U -> H; 31 | G -> U; 32 | E -> G; 33 | C -> Z; 34 | C -> D; 35 | S -> D; 36 | B -> N; 37 | B -> D; 38 | B -> S; 39 | M -> B; 40 | A -> M; 41 | N -> Y; 42 | } 43 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/nhg.gv: -------------------------------------------------------------------------------- 1 | digraph automata_0 { 2 | size ="8.5, 11"; 3 | node [shape = circle]; 4 | 0 [ style = filled, color=lightgrey ]; 5 | 2 [ shape = doublecircle ]; 6 | 0 -> 2 [ label = "a " ]; 7 | 0 -> 1 [ label = "other " ]; 8 | 1 -> 2 [ label = "a " ]; 9 | 1 -> 1 [ label = "other " ]; 10 | 2 -> 2 [ label = "a " ]; 11 | 2 -> 1 [ label = "other " ]; 12 | "Machine: a" [ shape = plaintext ]; 13 | } 14 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/oldarrows.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | // leave some space for the head/taillabels 3 | graph [ranksep=1.5 splines=true overlap=false] 4 | 5 | // to avoid confusion, remember this: 6 | // it's spelt tail/head, but it's read start/end 7 | 8 | // put head/tail labels farther from the node 9 | edge [labeldistance=3] 10 | 11 | // not interested in node labels 12 | node [shape=circle width=0.5 label=""] 13 | 14 | { 15 | edge [dir=back samehead=ahead samearrowhead=1] 16 | a->Z [arrowtail=none taillabel=none] 17 | b->Z [arrowtail=normal taillabel=normal] 18 | c->Z [arrowtail=inv taillabel=inv] 19 | d->Z [arrowtail=dot taillabel=dot] 20 | e->Z [arrowtail=odot taillabel=odot] 21 | f->Z [arrowtail=invdot taillabel=invdot] 22 | g->Z [arrowtail=invodot taillabel=invodot] 23 | h->Z [arrowtail=open taillabel=open] 24 | i->Z [arrowtail=halfopen taillabel=halfopen arrowhead=inv headlabel=samehead] 25 | j->Z [arrowtail=empty taillabel=empty] 26 | k->Z [arrowtail=invempty taillabel=invempty] 27 | l->Z [arrowtail=diamond taillabel=diamond] 28 | m->Z [arrowtail=odiamond taillabel=odiamond] 29 | n->Z [arrowtail=box taillabel=box] 30 | o->Z [arrowtail=obox taillabel=obox] 31 | p->Z [arrowtail=tee taillabel=tee] 32 | q->Z [arrowtail=crow taillabel=crow] 33 | } 34 | { 35 | edge [sametail=atail samearrowtail=1] 36 | Z->A [arrowhead=none headlabel=none] 37 | Z->B [arrowhead=normal headlabel=normal] 38 | Z->C [arrowhead=inv headlabel=inv] 39 | Z->D [arrowhead=dot headlabel=dot] 40 | Z->E [arrowhead=odot headlabel=odot] 41 | Z->F [arrowhead=invdot headlabel=invdot] 42 | Z->G [arrowhead=invodot headlabel=invodot] 43 | Z->H [arrowhead=open headlabel=open] 44 | Z->I [arrowhead=halfopen headlabel=halfopen arrowtail=inv taillabel=sametail] 45 | Z->J [arrowhead=empty headlabel=empty] 46 | Z->K [arrowhead=invempty headlabel=invempty] 47 | Z->L [arrowhead=diamond headlabel=diamond] 48 | Z->M [arrowhead=odiamond headlabel=odiamond] 49 | Z->N [arrowhead=box headlabel=box] 50 | Z->O [arrowhead=obox headlabel=obox] 51 | Z->P [arrowhead=tee headlabel=tee] 52 | Z->Q [arrowhead=crow headlabel=crow] 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/record2.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | node [shape=record]; 3 | a [label = " foo | x | bar"]; 4 | b [label = "a | { foo | x | bar } | b"]; 5 | a:f0 -> b:f1 6 | } 7 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/records.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | rankdir=LR; 3 | node [shape=record]; 4 | a [ label =" Graphs can\lbe fun\l| mid| right\r"]; 5 | b [ label =" | b | " ]; 6 | c [ label =" | c | " ]; 7 | x [ label =" | x | " ]; 8 | y [ label =" | y | " ]; 9 | z [ label =" | z | " ]; 10 | a:bala -> b:left; 11 | a:f1 -> d; 12 | a:f2 -> y:"p1"; 13 | c:"p1" -> d; 14 | b:mid -> x:"p1"; 15 | c:"p2" -> y:"p2"; 16 | b:left -> z:"p2"; 17 | } 18 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/rowe.gv: -------------------------------------------------------------------------------- 1 | digraph rowe { 2 | node [shape = box]; 3 | size = "6,6"; 4 | 1 -> 2; 5 | 1 -> 10; 6 | 10 -> 14; 7 | 10 -> 12; 8 | 10 -> 13; 9 | 10 -> 11; 10 | 2 -> 18; 11 | 2 -> 17; 12 | 2 -> 16; 13 | 2 -> 3; 14 | 11 -> 4; 15 | 16 -> 4; 16 | 3 -> 4; 17 | 4 -> 5; 18 | 13 -> 19; 19 | 17 -> 19; 20 | 5 -> 23; 21 | 5 -> 35; 22 | 5 -> 6; 23 | 37 -> 39; 24 | 37 -> 41; 25 | 37 -> 40; 26 | 37 -> 38; 27 | 19 -> 20; 28 | 19 -> 28; 29 | 19 -> 21; 30 | 12 -> 29; 31 | 18 -> 29; 32 | 41 -> 29; 33 | 28 -> 29; 34 | 29 -> 30; 35 | 30 -> 31; 36 | 30 -> 33; 37 | 31 -> 32; 38 | 21 -> 22; 39 | 32 -> 23; 40 | 22 -> 23; 41 | 6 -> 7; 42 | 23 -> 24; 43 | 7 -> 8; 44 | 24 -> 25; 45 | 24 -> 27; 46 | 35 -> 43; 47 | 35 -> 36; 48 | 8 -> 9; 49 | 14 -> 15; 50 | 39 -> 15; 51 | 20 -> 15; 52 | 33 -> 34; 53 | 43 -> 40; 54 | 43 -> 38; 55 | 25 -> 26; 56 | 9 -> 42; 57 | 10 -> 1; 58 | 15 -> 1; 59 | 23 -> 1; 60 | 31 -> 1; 61 | 2 -> 1; 62 | 25 -> 1; 63 | 9 -> 1; 64 | 38 -> 4; 65 | 26 -> 4; 66 | 42 -> 4; 67 | 40 -> 19; 68 | 36 -> 19; 69 | 34 -> 29; 70 | 33 -> 30; 71 | 27 -> 24; 72 | } 73 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/russian.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | Контрагенты -> БанковскиеСчета; 3 | Организации -> БанковскиеСчета; 4 | ВопросыДляАнкетирования -> ВариантыОтветовОпросов; 5 | Контрагенты -> ДоговорыВзаиморасчетов; 6 | Номенклатура -> ЕдиницыИзмерения; 7 | НоменклатурныеГруппы -> ЕдиницыИзмерения; 8 | СвойстваОбектов -> ЗначенияСвойствОбектов; 9 | } -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/shells.gv: -------------------------------------------------------------------------------- 1 | digraph shells { 2 | size="7,8"; 3 | node [fontsize=24, shape = plaintext]; 4 | 5 | 1972 -> 1976; 6 | 1976 -> 1978; 7 | 1978 -> 1980; 8 | 1980 -> 1982; 9 | 1982 -> 1984; 10 | 1984 -> 1986; 11 | 1986 -> 1988; 12 | 1988 -> 1990; 13 | 1990 -> future; 14 | 15 | node [fontsize=20, shape = box]; 16 | { rank=same; 1976 Mashey Bourne; } 17 | { rank=same; 1978 Formshell csh; } 18 | { rank=same; 1980 esh vsh; } 19 | { rank=same; 1982 ksh "System-V"; } 20 | { rank=same; 1984 v9sh tcsh; } 21 | { rank=same; 1986 "ksh-i"; } 22 | { rank=same; 1988 KornShell Perl rc; } 23 | { rank=same; 1990 tcl Bash; } 24 | { rank=same; "future" POSIX "ksh-POSIX"; } 25 | 26 | Thompson -> Mashey; 27 | Thompson -> Bourne; 28 | Thompson -> csh; 29 | csh -> tcsh; 30 | Bourne -> ksh; 31 | Bourne -> esh; 32 | Bourne -> vsh; 33 | Bourne -> "System-V"; 34 | Bourne -> v9sh; 35 | v9sh -> rc; 36 | Bourne -> Bash; 37 | "ksh-i" -> Bash; 38 | KornShell -> Bash; 39 | esh -> ksh; 40 | vsh -> ksh; 41 | Formshell -> ksh; 42 | csh -> ksh; 43 | KornShell -> POSIX; 44 | "System-V" -> POSIX; 45 | ksh -> "ksh-i"; 46 | "ksh-i" -> KornShell; 47 | KornShell -> "ksh-POSIX"; 48 | Bourne -> Formshell; 49 | 50 | edge [style=invis]; 51 | 1984 -> v9sh -> tcsh ; 52 | 1988 -> rc -> KornShell; 53 | Formshell -> csh; 54 | KornShell -> Perl; 55 | } 56 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/states.gv: -------------------------------------------------------------------------------- 1 | /* 2 | The command line is 3 | 4 | dot -Tps -Grankdir=LR states.gv > states.ps 5 | 6 | and the file is: 7 | */ 8 | digraph states { 9 | size="3,2"; 10 | rankdir=LR; 11 | node [shape=ellipse]; 12 | empty [label = "Empty"]; 13 | stolen [label = "Stolen"]; 14 | waiting [label = "Waiting"]; 15 | full [label = "Full"]; 16 | empty -> full [label = "return"] 17 | empty -> stolen [label = "dispatch", wt=28] 18 | stolen -> full [label = "return"]; 19 | stolen -> waiting [label = "touch"]; 20 | waiting -> full [label = "return"]; 21 | } 22 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/structs.gv: -------------------------------------------------------------------------------- 1 | digraph structs { 2 | node [shape=record]; 3 | struct1 [shape=record,label=" left| middle| right"]; 4 | struct2 [shape=record,label=" one| two"]; 5 | struct3 [shape=record,label="hello\nworld |{ b |{c| d|e}| f}| g | h"]; 6 | struct1:f1 -> struct2:f0; 7 | struct1:f2 -> struct3:here; 8 | } 9 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/switch.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | graph [center=true rankdir=LR bgcolor="#808080"] 3 | edge [dir=none] 4 | node [width=0.3 height=0.3 label=""] 5 | { node [shape=circle style=invis] 6 | 1 2 3 4 5 6 7 8 10 20 30 40 50 60 70 80 7 | } 8 | { node [shape=circle] 9 | a b c d e f g h i j k l m n o p q r s t u v w x 10 | } 11 | { node [shape=diamond] 12 | A B C D E F G H I J K L M N O P Q R S T U V W X 13 | } 14 | 1 -> a -> {A B} [color="#0000ff"] 15 | 2 -> b -> {B A} [color="#ff0000"] 16 | 3 -> c -> {C D} [color="#ffff00"] 17 | 4 -> d -> {D C} [color="#00ff00"] 18 | 5 -> e -> {E F} [color="#000000"] 19 | 6 -> f -> {F E} [color="#00ffff"] 20 | 7 -> g -> {G H} [color="#ffffff"] 21 | 8 -> h -> {H G} [color="#ff00ff"] 22 | { edge [color="#ff0000:#0000ff"] 23 | A -> i -> {I K} 24 | B -> j -> {J L} 25 | } 26 | { edge [color="#00ff00:#ffff00"] 27 | C -> k -> {K I} 28 | D -> l -> {L J} 29 | } 30 | { edge [color="#00ffff:#000000"] 31 | E -> m -> {M O} 32 | F -> n -> {N P} 33 | } 34 | { edge [color="#ff00ff:#ffffff"] 35 | G -> o -> {O M} 36 | H -> p -> {P N} 37 | } 38 | { edge [color="#00ff00:#ffff00:#ff0000:#0000ff"] 39 | I -> q -> {Q U} 40 | J -> r -> {R V} 41 | K -> s -> {S W} 42 | L -> t -> {T X} 43 | } 44 | { edge [color="#ff00ff:#ffffff:#00ffff:#000000"] 45 | M -> u -> {U Q} 46 | N -> v -> {V R} 47 | O -> w -> {W S} 48 | P -> x -> {X T} 49 | } 50 | { edge [color="#ff00ff:#ffffff:#00ffff:#000000:#00ff00:#ffff00:#ff0000:#0000ff"] 51 | Q -> 10 52 | R -> 20 53 | S -> 30 54 | T -> 40 55 | U -> 50 56 | V -> 60 57 | W -> 70 58 | X -> 80 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/table.gv: -------------------------------------------------------------------------------- 1 | digraph structs { 2 | node [shape=plaintext]; 3 | 4 | struct1 [label=< 5 | 6 | 7 | 8 | 9 | 10 |
abc
>]; 11 | 12 | struct2 [label=< 13 | 14 | 15 | 16 | 17 | 26 | 27 | 28 | 29 | 30 |
elefanteltwo
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
buca
c
f
patratos
4
31 | >]; 32 | 33 | struct3 [label=< 34 | 35 | 36 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
Hello 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
b
adinoy
rhino
climbUp
low
>]; 54 | 55 | struct1 -> struct3; 56 | struct1 -> struct2; 57 | } 58 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/train11.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | size="6,6"; 3 | node [shape=circle,fontsize=8]; 4 | rankdir=LR; 5 | st9 -> st9 [label="11/1"]; 6 | st9 -> st10 [label="10/1"]; 7 | st8 -> st8 [label="10/1"]; 8 | st8 -> st0 [label="00/-"]; 9 | st7 -> st8 [label="10/1"]; 10 | st7 -> st7 [label="00/1"]; 11 | st6 -> st6 [label="01/1"]; 12 | st6 -> st0 [label="00/-"]; 13 | st5 -> st6 [label="01/1"]; 14 | st5 -> st5 [label="11/1"]; 15 | st4 -> st4 [label="01/1"]; 16 | st4 -> st0 [label="00/-"]; 17 | st3 -> st4 [label="01/1"]; 18 | st3 -> st3 [label="00/1"]; 19 | st2 -> st9 [label="11/1"]; 20 | st2 -> st7 [label="00/1"]; 21 | st2 -> st2 [label="01/1"]; 22 | st10 -> st10 [label="10/1"]; 23 | st10 -> st0 [label="00/-"]; 24 | st1 -> st5 [label="11/1"]; 25 | st1 -> st3 [label="00/1"]; 26 | st1 -> st1 [label="10/1"]; 27 | st0 -> st2 [label="01/-"]; 28 | st0 -> st1 [label="10/-"]; 29 | st0 -> st0 [label="00/0"]; 30 | } 31 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/trapeziumlr.gv: -------------------------------------------------------------------------------- 1 | digraph test { 2 | 3 | size="7,9.5"; 4 | page="8,10.5"; 5 | ratio=fill; 6 | rankdir=LR; 7 | 8 | { rank=same; 9 | node [shape=house]; 10 | A;C;E;G;I;K;M;O;Q;S;U;W;Y; 11 | node [shape=invhouse]; 12 | B;D;F;H;J;L;N;P;R;T;V;X;Z; 13 | } 14 | 15 | { rank=same; 16 | node [shape=trapezium]; 17 | "Trapezium"; 18 | ordering=out; 19 | } 20 | 21 | Trapezium -> A; 22 | Trapezium -> B; 23 | Trapezium -> C; 24 | Trapezium -> D; 25 | Trapezium -> E; 26 | Trapezium -> F; 27 | Trapezium -> G; 28 | Trapezium -> H; 29 | Trapezium -> I; 30 | Trapezium -> J; 31 | Trapezium -> K; 32 | Trapezium -> L; 33 | Trapezium -> M; 34 | Trapezium -> N; 35 | Trapezium -> O; 36 | Trapezium -> P; 37 | Trapezium -> Q; 38 | Trapezium -> R; 39 | Trapezium -> S; 40 | Trapezium -> T; 41 | Trapezium -> U; 42 | Trapezium -> V; 43 | Trapezium -> W; 44 | Trapezium -> X; 45 | Trapezium -> Y; 46 | Trapezium -> Z; 47 | 48 | { rank=same; 49 | node [shape=parallelogram]; 50 | a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z; 51 | } 52 | 53 | a -> Trapezium; 54 | b -> Trapezium; 55 | c -> Trapezium; 56 | d -> Trapezium; 57 | e -> Trapezium; 58 | f -> Trapezium; 59 | g -> Trapezium; 60 | h -> Trapezium; 61 | i -> Trapezium; 62 | j -> Trapezium; 63 | k -> Trapezium; 64 | l -> Trapezium; 65 | m -> Trapezium; 66 | n -> Trapezium; 67 | o -> Trapezium; 68 | p -> Trapezium; 69 | q -> Trapezium; 70 | r -> Trapezium; 71 | s -> Trapezium; 72 | t -> Trapezium; 73 | u -> Trapezium; 74 | v -> Trapezium; 75 | w -> Trapezium; 76 | x -> Trapezium; 77 | y -> Trapezium; 78 | z -> Trapezium; 79 | } 80 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/tree.gv: -------------------------------------------------------------------------------- 1 | digraph g { 2 | node [shape = record,height=.1]; 3 | node0[label = " | G| "]; 4 | node1[label = " | E| "]; 5 | node2[label = " | B| "]; 6 | node3[label = " | F| "]; 7 | node4[label = " | R| "]; 8 | node5[label = " | H| "]; 9 | node6[label = " | Y| "]; 10 | node7[label = " | A| "]; 11 | node8[label = " | C| "]; 12 | "node0":f2 -> "node4":f1; 13 | "node0":f0 -> "node1":f1; 14 | "node1":f0 -> "node2":f1; 15 | "node1":f2 -> "node3":f1; 16 | "node2":f2 -> "node8":f1; 17 | "node2":f0 -> "node7":f1; 18 | "node4":f2 -> "node6":f1; 19 | "node4":f0 -> "node5":f1; 20 | } 21 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/triedds.gv: -------------------------------------------------------------------------------- 1 | digraph g { 2 | graph [ 3 | rankdir = "LR" 4 | ]; 5 | node [ 6 | fontsize = "16" 7 | shape = "ellipse" 8 | ]; 9 | edge [ 10 | ]; 11 | "node0" [ 12 | label = " 0x10ba8| " 13 | shape = "record" 14 | ]; 15 | "node1" [ 16 | label = " 0xf7fc4380| | |-1" 17 | shape = "record" 18 | ]; 19 | "node2" [ 20 | label = " 0xf7fc44b8| | |2" 21 | shape = "record" 22 | ]; 23 | "node3" [ 24 | label = " 3.43322790286038071e-06|44.79998779296875|0" 25 | shape = "record" 26 | ]; 27 | "node4" [ 28 | label = " 0xf7fc4380| | |2" 29 | shape = "record" 30 | ]; 31 | "node5" [ 32 | label = " (nil)| | |-1" 33 | shape = "record" 34 | ]; 35 | "node6" [ 36 | label = " 0xf7fc4380| | |1" 37 | shape = "record" 38 | ]; 39 | "node7" [ 40 | label = " 0xf7fc4380| | |2" 41 | shape = "record" 42 | ]; 43 | "node8" [ 44 | label = " (nil)| | |-1" 45 | shape = "record" 46 | ]; 47 | "node9" [ 48 | label = " (nil)| | |-1" 49 | shape = "record" 50 | ]; 51 | "node10" [ 52 | label = " (nil)| | |-1" 53 | shape = "record" 54 | ]; 55 | "node11" [ 56 | label = " (nil)| | |-1" 57 | shape = "record" 58 | ]; 59 | "node12" [ 60 | label = " 0xf7fc43e0| | |1" 61 | shape = "record" 62 | ]; 63 | "node0":f0 -> "node1":f0 [ 64 | id = 0 65 | ]; 66 | "node0":f1 -> "node2":f0 [ 67 | id = 1 68 | ]; 69 | "node1":f0 -> "node3":f0 [ 70 | id = 2 71 | ]; 72 | "node1":f1 -> "node4":f0 [ 73 | id = 3 74 | ]; 75 | "node1":f2 -> "node5":f0 [ 76 | id = 4 77 | ]; 78 | "node4":f0 -> "node3":f0 [ 79 | id = 5 80 | ]; 81 | "node4":f1 -> "node6":f0 [ 82 | id = 6 83 | ]; 84 | "node4":f2 -> "node10":f0 [ 85 | id = 7 86 | ]; 87 | "node6":f0 -> "node3":f0 [ 88 | id = 8 89 | ]; 90 | "node6":f1 -> "node7":f0 [ 91 | id = 9 92 | ]; 93 | "node6":f2 -> "node9":f0 [ 94 | id = 10 95 | ]; 96 | "node7":f0 -> "node3":f0 [ 97 | id = 11 98 | ]; 99 | "node7":f1 -> "node1":f0 [ 100 | id = 12 101 | ]; 102 | "node7":f2 -> "node8":f0 [ 103 | id = 13 104 | ]; 105 | "node10":f1 -> "node11":f0 [ 106 | id = 14 107 | ]; 108 | "node10":f2 -> "node12":f0 [ 109 | id = 15 110 | ]; 111 | "node11":f2 -> "node1":f0 [ 112 | id = 16 113 | ]; 114 | } 115 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/try.gv: -------------------------------------------------------------------------------- 1 | digraph G { 2 | subgraph cluster_small { 3 | a -> b; 4 | label=small; 5 | } 6 | 7 | subgraph cluster_big { 8 | p -> q -> r -> s -> t; 9 | label=big; 10 | t -> p; 11 | } 12 | 13 | t -> a; 14 | b -> q; 15 | } 16 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/unix.gv: -------------------------------------------------------------------------------- 1 | /* courtesy Ian Darwin and Geoff Collyer, Softquad Inc. */ 2 | digraph unix { 3 | size="6,6"; 4 | "5th Edition" -> "6th Edition"; 5 | "5th Edition" -> "PWB 1.0"; 6 | "6th Edition" -> "LSX"; 7 | "6th Edition" -> "1 BSD"; 8 | "6th Edition" -> "Mini Unix"; 9 | "6th Edition" -> "Wollongong"; 10 | "6th Edition" -> "Interdata"; 11 | "Interdata" -> "Unix/TS 3.0"; 12 | "Interdata" -> "PWB 2.0"; 13 | "Interdata" -> "7th Edition"; 14 | "7th Edition" -> "8th Edition"; 15 | "7th Edition" -> "32V"; 16 | "7th Edition" -> "V7M"; 17 | "7th Edition" -> "Ultrix-11"; 18 | "7th Edition" -> "Xenix"; 19 | "7th Edition" -> "UniPlus+"; 20 | "V7M" -> "Ultrix-11"; 21 | "8th Edition" -> "9th Edition"; 22 | "1 BSD" -> "2 BSD"; 23 | "2 BSD" -> "2.8 BSD"; 24 | "2.8 BSD" -> "Ultrix-11"; 25 | "2.8 BSD" -> "2.9 BSD"; 26 | "32V" -> "3 BSD"; 27 | "3 BSD" -> "4 BSD"; 28 | "4 BSD" -> "4.1 BSD"; 29 | "4.1 BSD" -> "4.2 BSD"; 30 | "4.1 BSD" -> "2.8 BSD"; 31 | "4.1 BSD" -> "8th Edition"; 32 | "4.2 BSD" -> "4.3 BSD"; 33 | "4.2 BSD" -> "Ultrix-32"; 34 | "PWB 1.0" -> "PWB 1.2"; 35 | "PWB 1.0" -> "USG 1.0"; 36 | "PWB 1.2" -> "PWB 2.0"; 37 | "USG 1.0" -> "CB Unix 1"; 38 | "USG 1.0" -> "USG 2.0"; 39 | "CB Unix 1" -> "CB Unix 2"; 40 | "CB Unix 2" -> "CB Unix 3"; 41 | "CB Unix 3" -> "Unix/TS++"; 42 | "CB Unix 3" -> "PDP-11 Sys V"; 43 | "USG 2.0" -> "USG 3.0"; 44 | "USG 3.0" -> "Unix/TS 3.0"; 45 | "PWB 2.0" -> "Unix/TS 3.0"; 46 | "Unix/TS 1.0" -> "Unix/TS 3.0"; 47 | "Unix/TS 3.0" -> "TS 4.0"; 48 | "Unix/TS++" -> "TS 4.0"; 49 | "CB Unix 3" -> "TS 4.0"; 50 | "TS 4.0" -> "System V.0"; 51 | "System V.0" -> "System V.2"; 52 | "System V.2" -> "System V.3"; 53 | } 54 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/unix2.gv: -------------------------------------------------------------------------------- 1 | /* Courtesy of Ian Darwin 2 | * and Geoff Collyer 3 | * Mildly updated by Ian Darwin in 2000. 4 | */ 5 | digraph unix { 6 | size="6,6"; 7 | node [color=lightblue2, style=filled]; 8 | "5th Edition" -> "6th Edition"; 9 | "5th Edition" -> "PWB 1.0"; 10 | "6th Edition" -> "LSX"; 11 | "6th Edition" -> "1 BSD"; 12 | "6th Edition" -> "Mini Unix"; 13 | "6th Edition" -> "Wollongong"; 14 | "6th Edition" -> "Interdata"; 15 | "Interdata" -> "Unix/TS 3.0"; 16 | "Interdata" -> "PWB 2.0"; 17 | "Interdata" -> "7th Edition"; 18 | "7th Edition" -> "8th Edition"; 19 | "7th Edition" -> "32V"; 20 | "7th Edition" -> "V7M"; 21 | "7th Edition" -> "Ultrix-11"; 22 | "7th Edition" -> "Xenix"; 23 | "7th Edition" -> "UniPlus+"; 24 | "V7M" -> "Ultrix-11"; 25 | "8th Edition" -> "9th Edition"; 26 | "9th Edition" -> "10th Edition"; 27 | "1 BSD" -> "2 BSD"; 28 | "2 BSD" -> "2.8 BSD"; 29 | "2.8 BSD" -> "Ultrix-11"; 30 | "2.8 BSD" -> "2.9 BSD"; 31 | "32V" -> "3 BSD"; 32 | "3 BSD" -> "4 BSD"; 33 | "4 BSD" -> "4.1 BSD"; 34 | "4.1 BSD" -> "4.2 BSD"; 35 | "4.1 BSD" -> "2.8 BSD"; 36 | "4.1 BSD" -> "8th Edition"; 37 | "4.2 BSD" -> "4.3 BSD"; 38 | "4.2 BSD" -> "Ultrix-32"; 39 | "4.3 BSD" -> "4.4 BSD"; 40 | "4.4 BSD" -> "FreeBSD"; 41 | "4.4 BSD" -> "NetBSD"; 42 | "4.4 BSD" -> "OpenBSD"; 43 | "PWB 1.0" -> "PWB 1.2"; 44 | "PWB 1.0" -> "USG 1.0"; 45 | "PWB 1.2" -> "PWB 2.0"; 46 | "USG 1.0" -> "CB Unix 1"; 47 | "USG 1.0" -> "USG 2.0"; 48 | "CB Unix 1" -> "CB Unix 2"; 49 | "CB Unix 2" -> "CB Unix 3"; 50 | "CB Unix 3" -> "Unix/TS++"; 51 | "CB Unix 3" -> "PDP-11 Sys V"; 52 | "USG 2.0" -> "USG 3.0"; 53 | "USG 3.0" -> "Unix/TS 3.0"; 54 | "PWB 2.0" -> "Unix/TS 3.0"; 55 | "Unix/TS 1.0" -> "Unix/TS 3.0"; 56 | "Unix/TS 3.0" -> "TS 4.0"; 57 | "Unix/TS++" -> "TS 4.0"; 58 | "CB Unix 3" -> "TS 4.0"; 59 | "TS 4.0" -> "System V.0"; 60 | "System V.0" -> "System V.2"; 61 | "System V.2" -> "System V.3"; 62 | "System V.3" -> "System V.4"; 63 | } 64 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/viewfile.gv: -------------------------------------------------------------------------------- 1 | digraph Viewfile { 2 | node [ style = filled ]; 3 | atoi [color=green]; 4 | chkmalloc [color=green]; 5 | close [color=green]; 6 | error [color=blue]; 7 | exit [color=blue]; 8 | fclose [color=green]; 9 | fgets [color=red]; 10 | fopen [color=green]; 11 | fprintf [color=blue]; 12 | free [color=blue]; 13 | free_list [color=blue]; 14 | fstat [color=green]; 15 | getopt [color=green]; 16 | init_list [color=green]; 17 | insert_list [color=green]; 18 | main [color=green]; 19 | makeargs [color=blue]; 20 | makepairs [color=green]; 21 | malloc [color=green]; 22 | open [color=green]; 23 | printf [color=red]; 24 | read [color=green]; 25 | rewind [color=green]; 26 | viewline [color=green]; 27 | viewlines [color=green]; 28 | walk_list [color=green]; 29 | write [color=green]; 30 | fclose -> close [color=green]; 31 | fgets -> fstat [color=green]; 32 | fgets -> read [color=green]; 33 | fopen -> open [color=green]; 34 | printf -> write [color=green]; 35 | main -> fgets [color=blue]; 36 | main -> getopt [color=green]; 37 | main -> makeargs [color=blue]; 38 | main -> makepairs [color=green]; 39 | main -> chkmalloc [color=green]; 40 | main -> error [color=blue]; 41 | main -> viewlines [color=green]; 42 | makeargs -> chkmalloc [color=blue]; 43 | makepairs -> atoi [color=green]; 44 | makepairs -> init_list [color=green]; 45 | makepairs -> insert_list [color=green]; 46 | makepairs -> chkmalloc [color=green]; 47 | free_list -> free [color=blue]; 48 | init_list -> chkmalloc [color=green]; 49 | insert_list -> chkmalloc [color=green]; 50 | walk_list -> error [color=blue]; 51 | walk_list -> viewline [color=green]; 52 | chkmalloc -> malloc [color=green]; 53 | chkmalloc -> error [color=blue]; 54 | error -> exit [color=blue]; 55 | error -> fprintf [color=blue]; 56 | error -> error [color=blue]; 57 | viewline -> fgets [color=red]; 58 | viewline -> printf [color=red]; 59 | viewline -> rewind [color=green]; 60 | viewlines -> fclose [color=green]; 61 | viewlines -> fopen [color=green]; 62 | viewlines -> walk_list [color=green]; 63 | viewlines -> viewline [color=blue]; 64 | } 65 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/directed/world.gv: -------------------------------------------------------------------------------- 1 | digraph world { 2 | size="7,7"; 3 | {rank=same; S8 S24 S1 S35 S30;} 4 | {rank=same; T8 T24 T1 T35 T30;} 5 | {rank=same; 43 37 36 10 2;} 6 | {rank=same; 25 9 38 40 13 17 12 18;} 7 | {rank=same; 26 42 11 3 33 19 39 14 16;} 8 | {rank=same; 4 31 34 21 41 28 20;} 9 | {rank=same; 27 5 22 32 29 15;} 10 | {rank=same; 6 23;} 11 | {rank=same; 7;} 12 | 13 | S8 -> 9; 14 | S24 -> 25; 15 | S24 -> 27; 16 | S1 -> 2; 17 | S1 -> 10; 18 | S35 -> 43; 19 | S35 -> 36; 20 | S30 -> 31; 21 | S30 -> 33; 22 | 9 -> 42; 23 | 9 -> T1; 24 | 25 -> T1; 25 | 25 -> 26; 26 | 27 -> T24; 27 | 2 -> {3 ; 16 ; 17 ; T1 ; 18} 28 | 10 -> { 11 ; 14 ; T1 ; 13; 12;} 29 | 31 -> T1; 30 | 31 -> 32; 31 | 33 -> T30; 32 | 33 -> 34; 33 | 42 -> 4; 34 | 26 -> 4; 35 | 3 -> 4; 36 | 16 -> 15; 37 | 17 -> 19; 38 | 18 -> 29; 39 | 11 -> 4; 40 | 14 -> 15; 41 | 37 -> {39 ; 41 ; 38 ; 40;} 42 | 13 -> 19; 43 | 12 -> 29; 44 | 43 -> 38; 45 | 43 -> 40; 46 | 36 -> 19; 47 | 32 -> 23; 48 | 34 -> 29; 49 | 39 -> 15; 50 | 41 -> 29; 51 | 38 -> 4; 52 | 40 -> 19; 53 | 4 -> 5; 54 | 19 -> {21 ; 20 ; 28;} 55 | 5 -> {6 ; T35 ; 23;} 56 | 21 -> 22; 57 | 20 -> 15; 58 | 28 -> 29; 59 | 6 -> 7; 60 | 15 -> T1; 61 | 22 -> T35; 62 | 22 -> 23; 63 | 29 -> T30; 64 | 7 -> T8; 65 | 23 -> T24; 66 | 23 -> T1; 67 | } 68 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/undirected/ER.gv: -------------------------------------------------------------------------------- 1 | graph ER { 2 | node [shape=box]; course; institute; student; 3 | node [shape=ellipse]; {node [label="name"] name0; name1; name2;} 4 | code; grade; number; 5 | node [shape=diamond,style=filled,color=lightgrey]; "C-I"; "S-C"; "S-I"; 6 | 7 | name0 -- course; 8 | code -- course; 9 | course -- "C-I" [label="n",len=1.00]; 10 | "C-I" -- institute [label="1",len=1.00]; 11 | institute -- name1; 12 | institute -- "S-I" [label="1",len=1.00]; 13 | "S-I" -- student [label="n",len=1.00]; 14 | student -- grade; 15 | student -- name2; 16 | student -- number; 17 | student -- "S-C" [label="m",len=1.00]; 18 | "S-C" -- course [label="n",len=1.00]; 19 | 20 | label = "\n\nEntity Relation Diagram\ndrawn by NEATO"; 21 | fontsize=20; 22 | } 23 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/undirected/Heawood.gv: -------------------------------------------------------------------------------- 1 | /* 2 | * The transitive 6-net, also known as Heawood's graph, 3 | * can be used to test the "stability points" of the layout 4 | * algorithm. 5 | 6 | * The "ideal" layout occurs when len="2.5". The layout 7 | * loses the regularity when smaller values are used. 8 | */ 9 | graph "Heawood" { 10 | node [ 11 | fontname = "Arial" 12 | label = "\N" 13 | shape = "circle" 14 | width = "0.50000" 15 | height = "0.500000" 16 | color = "black" 17 | ] 18 | edge [ 19 | color = "black" 20 | ] 21 | /* The outer wheel */ 22 | "0" -- "1" -- "2" -- "3" -- "4" -- "5" -- "6" -- "7" -- "8" -- "9" -- "10" -- "11" -- "12" -- "13" -- "0"; 23 | /* The internal edges. The len = makes them internal */ 24 | "0" -- "5" [len = 2.5]; 25 | "2" -- "7" [len = 2.5]; 26 | "4" -- "9" [len = 2.5]; 27 | "6" -- "11" [len = 2.5]; 28 | "8" -- "13" [len = 2.5]; 29 | "10" -- "1" [len = 2.5]; 30 | "12" -- "3" [len = 2.5]; 31 | } 32 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/undirected/Petersen.gv: -------------------------------------------------------------------------------- 1 | /* 2 | * The transitive 5-net, also known as Petersen's graph, 3 | * can be used to test the "stability points" of the layout 4 | * algorithm. 5 | * 6 | * The "ideal" layout is achieved for certain random seed 7 | * values when len=1.5. For len=2.5 or above, the layout 8 | * is stable. Sometimes, the graph is rendered "inside-out". 9 | */ 10 | graph "Petersen" { 11 | node [ 12 | fontname = "Arial" 13 | label = "\N" 14 | shape = "circle" 15 | width = "0.400000" 16 | height = "0.400000" 17 | color = "black" 18 | ] 19 | edge [ 20 | color = "black" 21 | ] 22 | /* Outer wheel. The len= is what makes it outer */ 23 | "0" -- "1" -- "2" -- "3" -- "4" -- "0" [ 24 | color = "blue" 25 | len = 2.6 26 | ] 27 | "0" -- "5" [ 28 | color = "red" 29 | weight = "5" 30 | ] 31 | "1" -- "6" [ 32 | color = "red" 33 | weight = "5" 34 | ] 35 | "2" -- "7" [ 36 | color = "red" 37 | weight = "5" 38 | ] 39 | "3" -- "8" [ 40 | color = "red" 41 | weight = "5" 42 | ] 43 | "4" -- "9" [ 44 | color = "red" 45 | weight = "5" 46 | ] 47 | "5" -- "7" -- "9" -- "6" -- "8" -- "5"; 48 | } 49 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/undirected/ngk10_4.gv: -------------------------------------------------------------------------------- 1 | graph G { 2 | graph [splines=true overlap=false] 3 | 1 -- 30 [f=1]; 4 | 1 -- 40 [f=14]; 5 | 8 -- 46 [f=1]; 6 | 8 -- 16 [f=18]; 7 | 10 -- 25 [f=1]; 8 | 10 -- 19 [f=5]; 9 | 10 -- 33 [f=1]; 10 | 12 -- 8 [f=1]; 11 | 12 -- 36 [f=5]; 12 | 12 -- 17 [f=16]; 13 | 13 -- 38 [f=1]; 14 | 13 -- 24 [f=19]; 15 | 24 -- 49 [f=1]; 16 | 24 -- 13 [f=1]; 17 | 24 -- 47 [f=12]; 18 | 24 -- 12 [f=19]; 19 | 25 -- 27 [f=1]; 20 | 25 -- 12 [f=1]; 21 | 27 -- 12 [f=1]; 22 | 27 -- 14 [f=8]; 23 | 29 -- 10 [f=1]; 24 | 29 -- 8 [f=17]; 25 | 30 -- 24 [f=1]; 26 | 30 -- 44 [f=15]; 27 | 38 -- 29 [f=1]; 28 | 38 -- 35 [f=15]; 29 | 2 -- 42 [f=2]; 30 | 2 -- 35 [f=3]; 31 | 2 -- 11 [f=19]; 32 | 14 -- 18 [f=2]; 33 | 14 -- 24 [f=15]; 34 | 14 -- 38 [f=18]; 35 | 18 -- 49 [f=2]; 36 | 18 -- 47 [f=20]; 37 | 26 -- 41 [f=2]; 38 | 26 -- 42 [f=15]; 39 | 31 -- 39 [f=2]; 40 | 31 -- 47 [f=17]; 41 | 31 -- 25 [f=14]; 42 | 37 -- 26 [f=2]; 43 | 37 -- 16 [f=14]; 44 | 39 -- 50 [f=2]; 45 | 39 -- 14 [f=2]; 46 | 39 -- 18 [f=17]; 47 | 39 -- 47 [f=10]; 48 | 41 -- 31 [f=2]; 49 | 41 -- 8 [f=16]; 50 | 42 -- 44 [f=2]; 51 | 42 -- 29 [f=12]; 52 | 44 -- 37 [f=2]; 53 | 44 -- 32 [f=15]; 54 | 3 -- 20 [f=2]; 55 | 3 -- 28 [f=19]; 56 | 6 -- 45 [f=2]; 57 | 6 -- 28 [f=10]; 58 | 9 -- 6 [f=2]; 59 | 9 -- 16 [f=1]; 60 | 15 -- 16 [f=2]; 61 | 15 -- 48 [f=2]; 62 | 16 -- 50 [f=2]; 63 | 16 -- 32 [f=14]; 64 | 16 -- 39 [f=8]; 65 | 20 -- 33 [f=2]; 66 | 33 -- 9 [f=2]; 67 | 33 -- 46 [f=3]; 68 | 33 -- 48 [f=17]; 69 | 45 -- 15 [f=2]; 70 | 4 -- 17 [f=4]; 71 | 4 -- 15 [f=6]; 72 | 4 -- 12 [f=16]; 73 | 17 -- 21 [f=4]; 74 | 19 -- 35 [f=4]; 75 | 19 -- 15 [f=9]; 76 | 19 -- 43 [f=4]; 77 | 21 -- 19 [f=4]; 78 | 21 -- 50 [f=4]; 79 | 23 -- 36 [f=4]; 80 | 34 -- 23 [f=4]; 81 | 34 -- 24 [f=11]; 82 | 35 -- 34 [f=4]; 83 | 35 -- 16 [f=6]; 84 | 35 -- 18 [f=16]; 85 | 36 -- 46 [f=4]; 86 | 5 -- 7 [f=1]; 87 | 5 -- 36 [f=6]; 88 | 7 -- 32 [f=1]; 89 | 7 -- 11 [f=2]; 90 | 7 -- 14 [f=17]; 91 | 11 -- 40 [f=1]; 92 | 11 -- 50 [f=1]; 93 | 22 -- 46 [f=1]; 94 | 28 -- 43 [f=1]; 95 | 28 -- 8 [f=18]; 96 | 32 -- 28 [f=1]; 97 | 32 -- 39 [f=13]; 98 | 32 -- 42 [f=15]; 99 | 40 -- 22 [f=1]; 100 | 40 -- 47 [f=1]; 101 | 43 -- 11 [f=1]; 102 | 43 -- 17 [f=19]; 103 | } 104 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/graphviz/graphs/undirected/process.gv: -------------------------------------------------------------------------------- 1 | graph G { 2 | run -- intr; 3 | intr -- runbl; 4 | runbl -- run; 5 | run -- kernel; 6 | kernel -- zombie; 7 | kernel -- sleep; 8 | kernel -- runmem; 9 | sleep -- swap; 10 | swap -- runswap; 11 | runswap -- new; 12 | runswap -- runmem; 13 | new -- runmem; 14 | sleep -- runmem; 15 | } 16 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/acyclic.1: -------------------------------------------------------------------------------- 1 | .TH ACYCLIC 1 "21 March 2001" 2 | .SH NAME 3 | acyclic \- make directed graph acyclic 4 | .SH SYNOPSIS 5 | .B acyclic 6 | [ 7 | .B \-nv? 8 | ] [ 9 | .B \-o 10 | .I outfile 11 | ] 12 | [ 13 | .I file 14 | ] 15 | .SH DESCRIPTION 16 | .B acyclic 17 | is a filter that takes a directed graph as input and outputs 18 | a copy of the graph with sufficient edges reversed to make 19 | the graph acyclic. The reversed edge inherits all of the attributes 20 | of the original edge. The optional file argument specifies where the 21 | input graph is stored; by default, the program reads from \fBstdin\fP. 22 | .SH OPTIONS 23 | The following options are supported: 24 | .TP 25 | .B \-n 26 | No output is produced, though the return value 27 | will indicate whether the graph is acyclic or not. 28 | .TP 29 | .B \-v 30 | Print information about whether the file is acyclic, has a cycle or 31 | is undirected. 32 | .TP 33 | .BI \-o " outfile" 34 | causes the output to be written to the specified file; by default, 35 | output is written to \fBstdout\fP. 36 | .TP 37 | .B \-? 38 | option causes the program to print usage information. 39 | .SH RETURN CODES 40 | .B acyclic 41 | returns 42 | .B 0 43 | if the graph is acyclic; 44 | .B 1 45 | if the graph has a cycle; 46 | .B 2 47 | if the graph is undirected; and 48 | .B 255 49 | if there are any errors. 50 | .SH BUGS 51 | If the graph is strict and there is a cycle of length 2, 52 | the attributes of the reversed edge are lost. 53 | .PP 54 | Some edge attributes are non-symmetric, referring to either the head 55 | or tail node. At present, there is no mechanism or convention for 56 | correctly switching or renaming these. 57 | .SH AUTHORS 58 | Stephen C. North 59 | .br 60 | Emden R. Gansner 61 | .SH "SEE ALSO" 62 | gc(1), dot(1), gvpr(1), gvcolor(1), ccomps(1), sccmap(1), tred(1), libgraph(3) 63 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/dijkstra.1: -------------------------------------------------------------------------------- 1 | .TH DIJKSTRA 1 "21 March 2001" 2 | .SH NAME 3 | dijkstra \- single-source distance filter for Graphviz 4 | .SH SYNOPSIS 5 | .B dijkstra 6 | [ 7 | .B \-adp? 8 | ] 9 | [ 10 | .I sourcenode file 11 | ] 12 | .SH DESCRIPTION 13 | .B dijkstra 14 | reads a stream of Graphviz formatted graphs and for each computes the distance of every node from 15 | .I sourcenode. 16 | Edge length is given in the 17 | .I len 18 | attribute, and the default is 1. The 19 | .I dist 20 | attribute of every node is set to its distance from 21 | .I sourcenode. 22 | If the \fB-p\fP flag is used, the 23 | .I prev 24 | attribute of each node reachable from 25 | .I sourcenode 26 | is set to the name of the previous node on a shortest path. 27 | The graph attribute 28 | .I maxdist 29 | is set to the maximum 30 | .I dist 31 | of all nodes in the graph. 32 | .P 33 | If the \fB-d\fP flag is used, the graph is treated as directed and 34 | only forward edges are used. 35 | .P 36 | By default, if the graph is disconnected, the 37 | .I dist 38 | attribute of nodes unreachable from 39 | .I sourcenode 40 | are left untouched, and 41 | .I maxdist 42 | is set to the maximum of any previous value and the largest 43 | distance recorded in this run. On the other hand, if 44 | the \fB-a\fP flag is used, the 45 | .I dist 46 | attribute of an unreachable node is assigned a very large value, 47 | and 48 | .I maxdist 49 | records the maximum distance found in the component containing 50 | .I sourcenode. 51 | .P 52 | Any number of 53 | .I sourcenode file 54 | pairs may be given. 55 | If the last 56 | .I file 57 | is missing, \fBstdin\fP is used. 58 | All output is written to \fBstdout\fP. 59 | .P 60 | In a typical application, 61 | .I dist 62 | and 63 | .I maxdist 64 | can drive a downstream calculation of color or some other attribute. 65 | .SH "SEE ALSO" 66 | gvpr(1), gvcolor(1), libgraph(3) 67 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/gc.1: -------------------------------------------------------------------------------- 1 | .TH GC 1 "21 March 2001" 2 | .SH NAME 3 | gc \- count graph components 4 | .SH SYNOPSIS 5 | .B gc 6 | [ 7 | .B \-necCaDUrsv? 8 | ] 9 | [ 10 | .I files 11 | ] 12 | .SH DESCRIPTION 13 | .B gc 14 | is a graph analogue to 15 | .B wc 16 | in that it prints to standard output 17 | the number of nodes, edges, connected components or clusters contained 18 | in the input files. 19 | It also prints a total count for 20 | all graphs if more than one graph is given. 21 | .SH OPTIONS 22 | The following options are supported: 23 | .TP 24 | .B \-n 25 | Count nodes. 26 | .TP 27 | .B \-e 28 | Count edges. 29 | .TP 30 | .B \-c 31 | Count connected components. 32 | .TP 33 | .B \-C 34 | Count clusters. By definition, a cluster is a graph or 35 | subgraph whose name begins with "cluster". 36 | .TP 37 | .B \-a 38 | Count all. Equivalent to 39 | .B \-encC 40 | .TP 41 | .B \-r 42 | Recursively analyze subgraphs. 43 | .TP 44 | .B \-s 45 | Print no output. Only exit value is important. 46 | .TP 47 | .B \-D 48 | Only analyze directed graphs. 49 | .TP 50 | .B \-U 51 | Only analyze undirected graphs. 52 | .TP 53 | .B \-v 54 | Verbose output. 55 | .TP 56 | .B \-? 57 | Print usage information. 58 | .LP 59 | By default, 60 | .I gc 61 | returns the number of nodes and edges. 62 | .SH OPERANDS 63 | The following operand is supported: 64 | .TP 8 65 | .I files 66 | Names of files containing 1 or more graphs in dot format. 67 | If no 68 | .I files 69 | operand is specified, 70 | the standard input will be used. 71 | .SH "EXIT STATUS" 72 | The following exit values are returned: 73 | .TP 4 74 | .B 0 75 | Successful completion. 76 | .TP 77 | .B 1 78 | The 79 | .B \-U 80 | or 81 | .B \-E 82 | option was used, and a graph of the wrong type was encountered. 83 | .SH AUTHOR 84 | Emden R. Gansner 85 | .SH "SEE ALSO" 86 | wc(1), acyclic(1), gvpr(1), gvcolor(1), ccomps(1), sccmap(1), tred(1), libgraph(3) 87 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/gml2gv.1: -------------------------------------------------------------------------------- 1 | .TH GML2GV,GV2GML 1 "24 June 2011" 2 | .SH NAME 3 | gml2gv,gv2gml \- GML-DOT converters 4 | .SH SYNOPSIS 5 | .B gml2gv 6 | [ 7 | .B \-?v 8 | ] 9 | [ 10 | .BI -g gname 11 | ] 12 | [ 13 | .BI -o outfile 14 | ] 15 | [ 16 | .I files 17 | ] 18 | .br 19 | .B gv2gml 20 | [ 21 | .B \-? 22 | ] 23 | [ 24 | .BI -o outfile 25 | ] 26 | [ 27 | .I files 28 | ] 29 | 30 | .SH DESCRIPTION 31 | .B gml2gv 32 | converts a graph specified in the GML format to a graph in the GV (formerly DOT) format. 33 | .B gv2gml 34 | converts a graph specified in the GV format to a graph in the GML format. 35 | .SH OPTIONS 36 | The following options are supported: 37 | .TP 38 | .B \-v 39 | Turns on verbose mode 40 | .TP 41 | .B \-? 42 | Prints usage information and exits. 43 | .TP 44 | .BI \-g "gname" 45 | The string \fIgname\fP is used as the name of the generated graph. 46 | If multiple graphs are generated, subsequent graphs use the name 47 | \fIgname\fP appended with an integer. 48 | .TP 49 | .BI \-o "outfile" 50 | Prints output to the file \fIoutfile\fP. If not given, \fBgml2gv\fP 51 | uses stdout. 52 | .TP 53 | .SH OPERANDS 54 | The following operand is supported: 55 | .TP 8 56 | .I files 57 | Names of files containing 1 or more graphs in GML. 58 | If no 59 | .I files 60 | operand is specified, 61 | the standard input will be used. 62 | .SH RETURN CODES 63 | Return \fB0\fP 64 | if there were no problems during conversion; 65 | and non-zero if any error occurred. 66 | .SH "LIMITATIONS" 67 | As both the graph and graphics models of GV and GML differ significantly, the 68 | conversion is at best approximate. In particular, it is not clear how multiedges 69 | are differentiated in GML, so multiedges are created in GV with no user-available 70 | key. Also, no attribute information is lost, in that 71 | any GML attributes that aren't converted to GV equivalents are retained as 72 | attributes in the output graph. 73 | .P 74 | At present, 75 | .B gv2gml 76 | does not support subgraphs and clusters. In addition, there does not appear to be 77 | a standard mechanism for specifying default node and edge attributes in GML, so 78 | any attributes are repeated for every node and edge. 79 | .SH AUTHORS 80 | Emden R. Gansner 81 | .SH "SEE ALSO" 82 | dot(1), libcgraph(3) 83 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/graphml2gv.1: -------------------------------------------------------------------------------- 1 | .TH GRAPHML2GV 1 "14 July 2011" 2 | .SH NAME 3 | graphml2gv \- GRAPHML-DOT converter 4 | .SH SYNOPSIS 5 | .B graphml2gv 6 | [ 7 | .B \-?v 8 | ] 9 | [ 10 | .BI -g gname 11 | ] 12 | [ 13 | .BI -o outfile 14 | ] 15 | [ 16 | .I files 17 | ] 18 | .SH DESCRIPTION 19 | .B graphml2gv 20 | converts a graph specified in the GRAPHML format to a graph in the GV (formerly DOT) format. 21 | .SH OPTIONS 22 | The following options are supported: 23 | .TP 24 | .B \-v 25 | Turns on verbose mode 26 | .TP 27 | .B \-? 28 | Prints usage information and exits. 29 | .TP 30 | .BI \-g "gname" 31 | The string \fIgname\fP is used as the name of the generated graph. 32 | If multiple graphs are generated, subsequent graphs use the name 33 | \fIgname\fP appended with an integer. 34 | .TP 35 | .BI \-o "outfile" 36 | Prints output to the file \fIoutfile\fP. If not given, \fBgraphml2gv\fP 37 | uses stdout. 38 | .TP 39 | .SH OPERANDS 40 | The following operand is supported: 41 | .TP 8 42 | .I files 43 | Names of files containing 1 or more graphs in GRAPHML. 44 | If no 45 | .I files 46 | operand is specified, 47 | the standard input will be used. 48 | .SH RETURN CODES 49 | Return \fB0\fP 50 | if there were no problems during conversion; 51 | and non-zero if any error occurred. 52 | .SH "LIMITATIONS" 53 | As both the graph and graphics models of GV and GML differ significantly, the 54 | conversion can only be at best approximate. 55 | In particular, GV currently has no notion of hyperedges or edges containing graphs. 56 | .P 57 | At present, 58 | .B graphml2gv 59 | only supports the basic graph topology. Specifically, the and 60 | elements are not handled, though they could be. 61 | .SH AUTHORS 62 | Emden R. Gansner 63 | .SH "SEE ALSO" 64 | dot(1), libcgraph(3) 65 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/gvcolor.1: -------------------------------------------------------------------------------- 1 | .TH GVCOLOR 1 "21 March 2001" 2 | .SH NAME 3 | gvcolor \- flow colors through a ranked digraph 4 | .SH SYNOPSIS 5 | .B gvcolor 6 | [ 7 | .I files 8 | ] 9 | .SH "USAGE" 10 | .ft 5 11 | dot file.gv | gvcolor | dot \-T\fI\fP 12 | .ft 13 | .SH DESCRIPTION 14 | .B gvcolor 15 | (previously known as 16 | .BR colorize) 17 | is a filter that sets node colors from initial seed values. 18 | Colors flow along edges from tail to head, and are averaged 19 | (as HSB vectors) at nodes. 20 | \fIThe graph must already have been processed by dot.\fP 21 | Appropriate choice of initial colors yields drawings in which node 22 | colors help to emphasize logical relationships between nodes, even 23 | when they are spread far apart in the layout. 24 | .PP 25 | Initial colors must be set externally, using the \fBcolor\fP 26 | attribute of a node. It is often effective to 27 | assign colors to a few key source or sink nodes, manually setting 28 | their colors by editing the graph file. 29 | Color names are as in \fIdot(1)\fP: symbolic names or RGB triples. 30 | It is best to choose some easily\(hydistinguished but related colors; 31 | not necessarily spaced evenly around the color wheel. For example, 32 | blue_green, green, and light_yellow looks better than red, green, blue. 33 | .PP 34 | Certain graph attributes control the \fIgvcolor\fP algorithm. 35 | \fBflow=back\fP reverses the flow of colors from heads to tails. 36 | \fBsaturation=.1,.9\fP (or any two numbers between 0 and 1) 37 | adjusts the color saturation linearly from least to greatest rank. 38 | If \fBDefcolor\fP is set, this color value is applied to any 39 | node not otherwise colored. 40 | .SH "EXIT STATUS" 41 | The following exit values are returned: 42 | .TP 4 43 | .B 0 44 | Successful completion. 45 | .TP 46 | .B 1 47 | If nodes of the graph do not possess a ``pos'' attribute. 48 | .SH BUGS 49 | It would be nice to make the program work without relying on 50 | an initial pass through \fBdot\fP. 51 | .SH AUTHORS 52 | Stephen C. North 53 | .br 54 | Emden R. Gansner 55 | .SH "SEE ALSO" 56 | gc(1), dot(1), gvpr(1), ccomps(1), sccmap(1), tred(1), libgraph(3) 57 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/nop.1: -------------------------------------------------------------------------------- 1 | .TH NOP 1 "21 March 2001" 2 | .SH NAME 3 | nop \- pretty-print graph file 4 | .SH SYNOPSIS 5 | .B nop 6 | [ 7 | .B \-p? 8 | ] 9 | [ 10 | .I files 11 | ] 12 | .SH DESCRIPTION 13 | .B nop 14 | reads a stream of graphs and prints each in pretty-printed (canonical) format 15 | on stdout. If no 16 | .I files 17 | are given, it reads from stdin. 18 | .SH OPTIONS 19 | The following options are supported: 20 | .TP 21 | .B \-p 22 | Produce no output - just check the input for valid DOT. 23 | .TP 24 | .B \-? 25 | Print usage information. 26 | .SH "EXIT STATUS" 27 | If any errors occurred while processing any input, such as a file 28 | not found or a file containing illegal DOT, \fBEXIT_FAILURE\fR is returned. 29 | Otherwise \fBEXIT_SUCCESS\fR is returned. 30 | .SH "SEE ALSO" 31 | wc(1), acyclic(1), gvpr(1), gvcolor(1), ccomps(1), sccmap(1), tred(1), libgraph(3) 32 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/sccmap.1: -------------------------------------------------------------------------------- 1 | .TH SCCMAP 1 "21 March 2001" 2 | .SH NAME 3 | sccmap \- extract strongly connected components of directed graphs 4 | .SH SYNOPSIS 5 | \fBsccmap\fR 6 | [\fB\-dsSv\fR] 7 | [ 8 | .BI \-o outfile 9 | ] 10 | [ 11 | .I files 12 | ] 13 | .SH DESCRIPTION 14 | .I sccmap 15 | decomposes digraphs into strongly connected components 16 | and an auxiliary map of the relationship between components. 17 | In this map, each component is collapsed into a node. 18 | The resulting graphs are printed to standard out. 19 | The number of nodes, edges and strongly connected components 20 | are printed to standard error. 21 | .B sccmap 22 | is a way of partitioning large graphs into more manageable pieces. 23 | .SH OPTIONS 24 | The following options are supported: 25 | .TP 26 | .B \-d 27 | Preserve degenerate components of only one node. 28 | .TP 29 | .B \-s 30 | Do not print the resulting graphs. Only the statistics are 31 | important. 32 | .TP 33 | .B \-S 34 | Just print the resulting graphs. No statistics are printed. 35 | .TP 36 | .BI \-o "output" 37 | Prints output to the file \fIoutput\fP. If not given, \fBsccmap\fP 38 | uses stdout. 39 | .TP 40 | .B \-v 41 | Generate additional statistics. In particular, 42 | .B sccmap 43 | prints the number of nodes, edges, connected components, 44 | and strongly connected components, followed by the fraction of 45 | nodes in a non-trivial strongly connected components, 46 | the maximum degree of the graph, and fraction of non-tree edges 47 | in the graph. 48 | .SH OPERANDS 49 | The following operand is supported: 50 | .TP 8 51 | .I files 52 | Names of files containing 1 or more graphs in dot format. 53 | If no 54 | .I files 55 | operand is specified, 56 | the standard input will be used. 57 | .SH "DIAGNOSTICS" 58 | \fBsccmap\fP emits a warning if it encounters an undirected graph, 59 | and ignores it. 60 | .SH AUTHORS 61 | Stephen C. North 62 | .br 63 | Emden R. Gansner 64 | .SH "SEE ALSO" 65 | gc(1), dot(1), acyclic(1), gvpr(1), gvcolor(1), ccomps(1), tred(1), libgraph(3) 66 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/tred.1: -------------------------------------------------------------------------------- 1 | .TH TRED 1 "21 March 2001" 2 | .SH NAME 3 | tred \- transitive reduction filter for directed graphs 4 | .SH SYNOPSIS 5 | .B tred 6 | [ 7 | .B \-vr? 8 | ] 9 | [ 10 | .I files 11 | ] 12 | .SH DESCRIPTION 13 | .B tred 14 | computes the transitive reduction of directed graphs, 15 | and prints the resulting graphs to standard output. 16 | This removes edges implied by transitivity. 17 | Nodes and subgraphs are not otherwise affected. 18 | The ``meaning'' and validity of the reduced graphs 19 | is application dependent. 20 | .B tred 21 | is particularly useful as a preprocessor to 22 | .I dot 23 | to reduce clutter in dense layouts. 24 | .PP 25 | Undirected graphs are silently ignored. 26 | .SH OPTIONS 27 | The following options are supported: 28 | .TP 29 | .B \-v 30 | Verbose output to stderr. 31 | .TP 32 | .B \-r 33 | Print information of removed edges to stderr. 34 | .TP 35 | .B \-? 36 | Print usage information. 37 | .SH OPERANDS 38 | The following operand is supported: 39 | .TP 8 40 | .I files 41 | Names of files containing 1 or more graphs in dot format. 42 | If no 43 | .I files 44 | operand is specified, 45 | the standard input will be used. 46 | .SH "BUGS" 47 | Using bitmaps internally would substantially decrease running time. 48 | .SH "DIAGNOSTICS" 49 | If a graph has cycles, its transitive reduction is not uniquely defined. 50 | In this case \fItred\fP emits a warning. 51 | .SH AUTHORS 52 | Stephen C. North 53 | .br 54 | Emden R. Gansner 55 | .SH "SEE ALSO" 56 | gc(1), dot(1), acyclic(1), gvpr(1), gvcolor(1), ccomps(1), sccmap(1), libgraph(3) 57 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man1/unflatten.1: -------------------------------------------------------------------------------- 1 | .TH UNFLATTEN 1 "21 January 2001" 2 | .SH NAME 3 | unflatten \- adjust directed graphs to improve layout aspect ratio 4 | .SH SYNOPSIS 5 | .B unflatten 6 | [\fB\-f?\fR] 7 | [\fB\-l\fIlen\fR] 8 | [\fB\-c\fIlen\fR 9 | ] [ 10 | .B \-o 11 | .I outfile 12 | ] 13 | [ files ] 14 | .SH DESCRIPTION 15 | .B unflatten 16 | is a preprocessor to 17 | .B dot 18 | that is 19 | used to improve the aspect ratio of graphs having many leaves 20 | or disconnected nodes. 21 | The usual layout for such a graph is generally very wide or tall. 22 | .B unflatten 23 | inserts invisible edges or adjusts the \fBminlen\fP on edges 24 | to improve layout compaction. 25 | .SH OPTIONS 26 | The following options are supported: 27 | .TP 28 | .BI \-l " len" 29 | The minimum length of leaf edges is staggered 30 | between 1 and \fIlen\fP (a small integer). 31 | .TP 32 | .B \-f 33 | Enables the staggering of the \fB-l\fP option to fanout nodes whose 34 | indegree and outdegree are both 1. This helps with structures such 35 | as \fIa -> {w x y z} -> b\fP. 36 | This option only works if the \fB-l\fP flag is set. 37 | .TP 38 | .BI \-c " len" 39 | Form disconnected nodes into chains of up to \fIlen\fP nodes. 40 | .TP 41 | .BI \-o " outfile" 42 | causes the output to be written to the specified file; by default, 43 | output is written to \fBstdout\fP. 44 | .TP 45 | .BI \-? 46 | Prints the usage and exits. 47 | .SH OPERANDS 48 | The following operand is supported: 49 | .TP 8 50 | .I files 51 | Names of files containing 1 or more graphs in dot format. 52 | If no 53 | .I files 54 | operand is specified, 55 | the standard input will be used. 56 | .SH AUTHORS 57 | Stephen C. North 58 | .br 59 | Emden R. Gansner 60 | .SH "SEE ALSO" 61 | gc(1), dot(1), acyclic(1), gvpr(1), gvcolor(1), ccomps(1), tred(1), libgraph(3) 62 | -------------------------------------------------------------------------------- /westat/plugins/win/Graphviz/share/man/man3/gvc.3: -------------------------------------------------------------------------------- 1 | .TH LIBGVC 3 2 | .SH NAME 3 | \fBlibgvc\fR \- Graphviz context library 4 | .SH SYNOPSIS 5 | .ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i 6 | .PP 7 | .nf 8 | \f5 9 | #include 10 | 11 | /* set up a graphviz context */ 12 | extern GVC_t *gvNEWcontext(char **info, char *user); 13 | extern char *gvUsername(void); 14 | 15 | /* set up a graphviz context \(hy alternative */ 16 | /* (wraps the above two functions using info built into libgvc) */ 17 | extern GVC_t *gvContext(void); 18 | 19 | /* parse command line args \(hy minimally argv[0] sets layout engine */ 20 | extern int gvParseArgs(GVC_t *gvc, int argc, char **argv); 21 | extern graph_t *gvNextInputGraph(GVC_t *gvc); 22 | 23 | /* Compute a layout using a specified engine */ 24 | extern int gvLayout(GVC_t *gvc, graph_t *g, char *engine); 25 | 26 | /* Compute a layout using layout engine from command line args */ 27 | extern int gvLayoutJobs(GVC_t *gvc, graph_t *g); 28 | 29 | /* Render layout into string attributes of the graph */ 30 | extern void attach_attrs(graph_t *g); 31 | 32 | /* Parse an html string */ 33 | extern char *agstrdup_html(char *s); 34 | extern int aghtmlstr(char *s); 35 | 36 | /* Render layout in a specified format to an open FILE */ 37 | extern int gvRender(GVC_t *gvc, graph_t *g, char *format, FILE *out); 38 | 39 | /* Render layout in a specified format to an open FILE */ 40 | extern int gvRenderFilename(GVC_t *gvc, graph_t *g, char *format, char *filename); 41 | 42 | /* Render layout according to \-T and \-o options found by gvParseArgs */ 43 | extern int gvRenderJobs(GVC_t *gvc, graph_t *g); 44 | 45 | /* Clean up layout data structures \(hy layouts are not nestable (yet) */ 46 | extern int gvFreeLayout(GVC_t *gvc, graph_t *g); 47 | 48 | /* Clean up graphviz context */ 49 | extern int gvFreeContext(GVC_t *gvc); 50 | 51 | /* Inquire about available plugins */ 52 | /* See comment in gvc.h */ 53 | extern char** gvPluginList(GVC_t *gvc, char* kind, int* cnt, char*); 54 | 55 | \fP 56 | .fi 57 | .SH DESCRIPTION 58 | \fIlibgvc\fP provides a context for applications wishing to manipulate 59 | and render graphs. It provides a command line parsing, common rendering code, 60 | and a plugin mechanism for renderers. 61 | 62 | .SH SEE ALSO 63 | .BR dot (1), 64 | .BR neato (1), 65 | .BR libcdt (3) 66 | .BR libgraph (3) 67 | .br 68 | 69 | .SH AUTHOR 70 | John Ellson (ellson@research.att.com), AT&T 71 | -------------------------------------------------------------------------------- /westat/quant/__init__.py: -------------------------------------------------------------------------------- 1 | from .get_stock import get_stock 2 | from .get_stock_pk import get_stock_pk 3 | from .get_stock_m import get_stock_m 4 | from .get_stock_i import get_stock_i 5 | from .get_stock_index import get_stock_index 6 | -------------------------------------------------------------------------------- /westat/quant/get_stock_m.py: -------------------------------------------------------------------------------- 1 | def get_stock_m(code='sh000001', language='cn'): 2 | """ 3 | 根据证券代码获取股票分钟数据 4 | Returns: 5 | 指定股票的分钟数据 6 | """ 7 | import requests 8 | import pandas as pd 9 | from westat.utils import regexp_like 10 | 11 | if len(code) == 6 and regexp_like(code[:3], '600|601|603|605|900'): 12 | code = 'sh' + code 13 | elif len(code) == 6 and regexp_like(code[:3], '000|002|003|200|300'): 14 | code = 'sz' + code 15 | elif len(code) == 5: 16 | code = 'hk' + code 17 | elif not regexp_like(code[:2],'sh|sz|hk') and regexp_like(code.lower(),'[a-z].+') and not regexp_like(code.lower(),'us'): 18 | code = 'us' + code.replace('.','') 19 | else: 20 | code = code 21 | 22 | response = requests.get('https://web.ifzq.gtimg.cn/appstock/app/minute/query?code=' + code) 23 | 24 | if response.status_code == 200: 25 | text = response.json() 26 | if response.json()['msg'] == 'code param error': 27 | print('未匹配到任何数据!') 28 | else: 29 | data = text['data'][code]['data']['data'] 30 | 31 | data_list = [] 32 | for d in data: 33 | row = d.split(' ') 34 | minute = row[0] 35 | price = row[1] 36 | vol = row[2] 37 | amount = row[3] 38 | data_list.append([minute, price, vol, amount]) 39 | result = pd.DataFrame(data_list, columns=['time', 'price', 'volume', 'amount']) 40 | result['time'] = pd.to_numeric(result['time']) 41 | result['price'] = pd.to_numeric(result['price']) 42 | result['volume'] = pd.to_numeric(result['volume']) 43 | result['amount'] = pd.to_numeric(result['amount']) 44 | 45 | if language == 'cn': 46 | result.rename(columns={'time': '时间', 'price': '价格', 'volume': '成交量', 'amount': '成交额'},inplace=True) 47 | return result 48 | -------------------------------------------------------------------------------- /westat/quant/get_stock_pk.py: -------------------------------------------------------------------------------- 1 | def get_stock_pk(code='sh000001', language='cn'): 2 | """ 3 | 根据证券代码获取股票盘口数据 4 | Returns: 5 | 指定股票的盘口数据 6 | """ 7 | import requests 8 | import pandas as pd 9 | from westat.utils import regexp_like 10 | 11 | if len(code) == 6 and regexp_like(code[:3], '600|601|603|605|900'): 12 | code = 'sh' + code 13 | elif len(code) == 6 and regexp_like(code[:3], '000|002|003|200|300'): 14 | code = 'sz' + code 15 | elif len(code) == 5: 16 | code = 'hk' + code 17 | elif not regexp_like(code[:2],'sh|sz|hk') and regexp_like(code.lower(),'[a-z].+') and not regexp_like(code.lower(),'us'): 18 | code = 'us' + code.replace('.','') 19 | else: 20 | code = code 21 | 22 | response = requests.get('http://qt.gtimg.cn/q=s_pk' + code) 23 | 24 | if response.status_code == 200: 25 | text = response.text 26 | 27 | if regexp_like(text, 'none_match'): 28 | print('未匹配到任何数据!') 29 | else: 30 | 31 | data = text.split('"')[1].split('~') 32 | result = pd.DataFrame(data, index=range(len(data))).T 33 | result.columns = ['buy_big', 'buy_small', 'sale_big', 'sale_small'] 34 | result['time'] = pd.to_numeric(result['time']) 35 | 36 | if language == 'cn': 37 | result.rename(columns={'buy_big': '买盘大单', 'buy_small': '买盘小单', 'sale_big': '卖盘大单', 38 | 'sale_small': '卖盘小单'}) 39 | 40 | return result 41 | -------------------------------------------------------------------------------- /westat/sample/__init__.py: -------------------------------------------------------------------------------- 1 | from pandas import read_csv, read_excel 2 | 3 | from .get_data_partition import get_data_partition 4 | -------------------------------------------------------------------------------- /westat/sample/get_data_partition.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | from sklearn.model_selection import train_test_split 4 | 5 | 6 | def get_data_partition(data: pd.DataFrame, 7 | test_size: float = 0.25, 8 | random_state=1234, 9 | target: str = 'y'): 10 | """ 11 | 划分训练集和测试集 12 | Args: 13 | data: DataFrame,将要进行数据分区的目标数据集 14 | target: str,目标变量名称,默认为'y' 15 | test_size:float 测试集所占比例,默认为0.25 16 | random_state: 随机种子,默认为1234 17 | 18 | Returns: 19 | 返回数据分区后的训练集和测试集 20 | """ 21 | X = data[[col for col in data.columns if col != target]] 22 | y = data[target] 23 | x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=test_size, random_state=random_state) 24 | data_train = x_train.reset_index() 25 | del data_train['index'] 26 | data_train[target] = y_train.reset_index()[target] 27 | data_test = x_test.reset_index() 28 | del data_test['index'] 29 | data_test[target] = y_test.reset_index()[target] 30 | return data_train, data_test 31 | -------------------------------------------------------------------------------- /westat/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .path import current_path 2 | from .device import user_name, host_name, host_ip 3 | from .datetime import date_diff,add_months,year_start,year_end,month_start,month_end,month_diff 4 | from .math import sin, cos 5 | from .get_max_continue import get_max_continue 6 | from .get_over_continue import get_over_continue 7 | from .nvl import nvl 8 | from .growth_rate import growth_rate 9 | from .rate import rate 10 | from .regexp_replace import regexp_replace 11 | from .regexp_like import regexp_like 12 | from .to_single_byte import to_single_byte 13 | from .to_multi_byte import to_multi_byte 14 | from .set_precision import set_precision -------------------------------------------------------------------------------- /westat/utils/device.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import getpass 3 | 4 | # 设备信息 5 | user_name = getpass.getuser() # 获取当前用户名 6 | host_name = socket.gethostname() # 获取当前主机名 7 | host_ip = socket.gethostbyname(socket.gethostname()) # 获取当前IP 8 | -------------------------------------------------------------------------------- /westat/utils/export/to_csv.py: -------------------------------------------------------------------------------- 1 | def to_csv(data,path,index=True): 2 | data.to_csv(path=,index=index) -------------------------------------------------------------------------------- /westat/utils/get_max_continue.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def get_max_continue(column, find=0): 5 | """ 6 | 根据已经排序好的序列s,计算find出现的最大连续次数 7 | Args: 8 | column:pd.Series,已经排序的数据序列 9 | find:int,需要查找的值,默认为0 10 | Returns: 11 | int,find最大连续出现的次数 12 | """ 13 | if isinstance(column,list) or isinstance(column,tuple): 14 | column=pd.Series(column) 15 | x = 0 16 | y = [] 17 | 18 | for i in column: 19 | if i != find: 20 | x = 0 21 | y.append(x) 22 | else: 23 | x = x + 1 24 | y.append(x) 25 | return max(y) -------------------------------------------------------------------------------- /westat/utils/get_over_continue.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def get_over_continue(column, over=0, eq=False): 5 | """ 6 | 获取序列连续大于指定值的次数 ,或序列连续相等且大于指定值的次数 7 | Args: 8 | column: pd.Series,已经排序的数据序列 9 | over: int,需要大于的指定值,默认为0 10 | eq: 是否要求取值相等 11 | 12 | Returns: 13 | int, 序列连续大于指定值的次数 ,或序列连续相等且大于指定值的次数 14 | """ 15 | if isinstance(column, list) or isinstance(column, tuple): 16 | column = pd.Series(column) 17 | 18 | x = 0 19 | y = [] 20 | 21 | # 循环检查序列中的每个元素,是否大于指定值,并与上一个元素相等 22 | for i in range(len(column)): 23 | # print(i,' ',column[i],' ',y) 24 | if i == 0: 25 | if column[i] > over: 26 | x = x + 1 27 | y.append(x) 28 | else: 29 | x = 0 30 | y.append(x) 31 | else: 32 | if column[i] > over: 33 | if eq: 34 | if column[i] == column[i - 1]: # 如果当前元素与上一个元素相等,则统计数+1 35 | x = x + 1 36 | y.append(x) 37 | else: 38 | x = 1 # 如果当前元素与上一个元素不相等,则初始化为1 39 | y.append(x) 40 | else: 41 | x = x + 1 42 | y.append(x) 43 | else: 44 | x = 0 45 | y.append(x) 46 | return max(y) 47 | -------------------------------------------------------------------------------- /westat/utils/growth_rate.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def growth_rate(a: float, b: float, method: int = 1, missing=99999999) -> float: 5 | """ 6 | 计算两个数值的增长率 (a-b)/b 7 | Args: 8 | a: 本期数值 9 | b: 上期数值 10 | method:增长率计算方法, 11 | 1:分子或分母缺失时,赋值为null;分母为0时,结果为null; 12 | 2:分子或分母缺失时,赋值为null;分母为0时,根据分子>0、=0、<0,分别赋值为 missing、0、-missing 13 | Returns: 14 | 增长率计算结果 15 | """ 16 | if method == 1: 17 | if b == 0: 18 | result = np.nan 19 | else: 20 | result = (a - b) / b 21 | elif method == 2: 22 | if b == 0: 23 | if a > 0: 24 | result = missing 25 | elif a == 0: 26 | result = 0 27 | elif a < 0: 28 | result = -missing 29 | else: 30 | result = (a - b) / b 31 | 32 | return result 33 | -------------------------------------------------------------------------------- /westat/utils/math.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | 4 | def cos(number, precision=4): 5 | """ 6 | 返回cos函数结果 7 | Args: 8 | number: 9 | precision: 10 | 11 | Returns: 12 | 13 | """ 14 | result = round(math.cos(number), precision) 15 | return result 16 | 17 | 18 | def sin(number, precision=4): 19 | """ 20 | 返回cos函数结果 21 | Args: 22 | number: 23 | precision: 24 | 25 | Returns: 26 | 27 | """ 28 | result = round(math.sin(number), precision) 29 | return result 30 | -------------------------------------------------------------------------------- /westat/utils/nvl.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | 4 | def nvl(value, new_value): 5 | """ 6 | 如果变量为空则返回新取值,否则返回旧的值 7 | Args: 8 | value: 需要判断是否为空的变量 9 | new_value: 当变量为空时的取值 10 | 11 | Returns: 12 | 如果变量为空则返回新的取值,否则返回旧的值 13 | """ 14 | if value is None or pd.isna(value): 15 | return new_value 16 | else: 17 | return value 18 | -------------------------------------------------------------------------------- /westat/utils/path.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | # 路径 4 | current_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 获取当前路径 5 | -------------------------------------------------------------------------------- /westat/utils/rate.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | def rate(a: float, b: float, method: int = 1,missing=99999999) -> float: 3 | """ 4 | 计算两个数值的比率 a/b 5 | Args: 6 | a: 本期数值 7 | b: 上期数值 8 | method:比率计算方法, 9 | 1:分子或分母缺失时,赋值为null;分母为0时,结果为null; 10 | 2:分子或分母缺失时,赋值为null;分母为0时,根据分子>0、=0、<0,分别赋值为 missing、0、-missing 11 | Returns: 12 | 增长率计算结果 13 | """ 14 | if method == 1: 15 | if b == 0: 16 | result = np.nan 17 | else: 18 | result = a / b 19 | elif method == 2: 20 | if b == 0: 21 | if a > 0: 22 | result = missing 23 | elif a == 0: 24 | result = 0 25 | elif a < 0: 26 | result = -missing 27 | else: 28 | result = a / b 29 | 30 | return result -------------------------------------------------------------------------------- /westat/utils/regexp_like.py: -------------------------------------------------------------------------------- 1 | def regexp_like(source, pattern): 2 | """ 3 | 根据输入的字符串,根据正则公式,检查是否匹配指定内容 4 | Args: 5 | source:要替换的原始字符串 6 | pattern:要匹配的正则模式 7 | Returns: 8 | 9 | """ 10 | import re 11 | p = re.compile(pattern) 12 | re_result = p.findall(source) 13 | result = len(re_result) > 0 14 | return result 15 | -------------------------------------------------------------------------------- /westat/utils/regexp_replace.py: -------------------------------------------------------------------------------- 1 | def regexp_replace(source, pattern, replace_string): 2 | """ 3 | 根据输入的字符串,根据正则公式,查找指定内容,并进行替换 4 | Args: 5 | source:要替换的原始字符串 6 | pattern:要匹配的正则模式 7 | replace_string:将匹配的pattern替换成的字符串 8 | 9 | Returns: 10 | 返回正则替换后的字符串 11 | """ 12 | import re 13 | p = re.compile(pattern) 14 | output_str = p.sub(replace_string, source) 15 | return output_str 16 | -------------------------------------------------------------------------------- /westat/utils/set_precision.py: -------------------------------------------------------------------------------- 1 | def set_precision(precision=2): 2 | """ 3 | 设置pandas数据显示精度 4 | Args: 5 | precision: int,需要显示的小数位数,默认不显示科学计数法,显示2位小数 6 | 7 | Returns: 8 | 没有返回值 9 | """ 10 | import pandas as pd 11 | fmt_str = '{:.' + str(precision) + 'f}' 12 | pd.set_option('display.float_format', fmt_str.format) 13 | -------------------------------------------------------------------------------- /westat/utils/to_multi_byte.py: -------------------------------------------------------------------------------- 1 | def to_multi_byte(input_str): 2 | """ 3 | 将输入的字符串中的半角字符转换为全角字符 4 | Args: 5 | input_str: 需要转换的字符串 6 | 7 | Returns: 8 | 转换为全角字符后的字符串 9 | """ 10 | output_str = '' 11 | for i in input_str: 12 | code_i = ord(i) 13 | if code_i == 32: 14 | code_i = 12288 15 | elif 33 <= code_i <= 126: 16 | code_i += 65248 17 | 18 | output_str += chr(code_i) 19 | 20 | return output_str -------------------------------------------------------------------------------- /westat/utils/to_single_byte.py: -------------------------------------------------------------------------------- 1 | def to_single_byte(input_str): 2 | """ 3 | 将输入的字符串中的全角字符转换为半角字符 4 | Args: 5 | input_str: 需要转换的字符串 6 | 7 | Returns: 8 | 转换为半角字符后的字符串 9 | """ 10 | output_str = '' 11 | for i in input_str: 12 | code_i = ord(i) 13 | if code_i == 12288: 14 | code_i = 32 15 | elif 65281 <= code_i <= 65374: 16 | code_i -= 65248 17 | 18 | output_str += chr(code_i) 19 | 20 | return output_str 21 | --------------------------------------------------------------------------------