-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e5933e
commit ebcc6e4
Showing
39 changed files
with
2,721 additions
and
2,279 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 2dc9210081928e74d5a6f5d2967dc749 | ||
config: b534122c30510fb718a6ee6c56b8a566 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,202 +1,99 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" > | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
||
<title>Overview: module code — pyexplainer documentation</title> | ||
|
||
|
||
|
||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> | ||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> | ||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> | ||
<!--[if lt IE 9]> | ||
<script src="../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
|
||
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> | ||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> | ||
<script src="../_static/jquery.js"></script> | ||
<script src="../_static/underscore.js"></script> | ||
<script src="../_static/doctools.js"></script> | ||
|
||
<script type="text/javascript" src="../_static/js/theme.js"></script> | ||
|
||
|
||
<script src="../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../genindex.html" /> | ||
<link rel="search" title="Search" href="../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
|
||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../index.html" class="icon icon-home"> pyexplainer | ||
|
||
|
||
|
||
</a> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<p class="caption"><span class="caption-text">Contents:</span></p> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../usage.html">Usage</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../usage.html">Tutorial</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../conduct.html">Code of Conduct</a></li> | ||
</ul> | ||
|
||
|
||
|
||
</div> | ||
|
||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> | ||
|
||
|
||
<nav class="wy-nav-top" aria-label="top navigation"> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../index.html">pyexplainer</a> | ||
|
||
</nav> | ||
|
||
|
||
<div class="wy-nav-content"> | ||
|
||
<div class="rst-content"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div role="navigation" aria-label="breadcrumbs navigation"> | ||
|
||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
|
||
<li><a href="../index.html" class="icon icon-home"></a> »</li> | ||
|
||
<li>Overview: module code</li> | ||
|
||
|
||
<li class="wy-breadcrumbs-aside"> | ||
|
||
</li> | ||
|
||
</ul> | ||
|
||
|
||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>All modules for which code is available</h1> | ||
<ul><li><a href="pyexplainer/pyexplainer_pyexplainer.html">pyexplainer.pyexplainer_pyexplainer</a></li> | ||
<li><a href="pyexplainer/rulefit.html">pyexplainer.rulefit</a></li> | ||
<ul><li><a href="pyexplainer/rulefit.html">pyexplainer.rulefit</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p> | ||
© Copyright 2021, Michael Fu. | ||
|
||
</p> | ||
<p>© Copyright 2021, Michael Fu.</p> | ||
</div> | ||
|
||
|
||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
|
||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
|
||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</div> | ||
|
||
|
||
<script type="text/javascript"> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
|
||
|
||
|
||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,63 @@ | ||
.. highlight:: python | ||
|
||
===== | ||
Usage | ||
Tutorial | ||
===== | ||
|
||
To use pyexplainer in a project:: | ||
Quick start | ||
-------------- | ||
|
||
To use pyexplainer in a project, first we need to import the required library:: | ||
|
||
from pyexplainer import pyexplainer_pyexplainer | ||
We can obtain the default dataset and global model stored in a dictionary as below, which is necessary to initialise a PyExplainer object later :: | ||
default_data_and_model = pyexplainer_pyexplainer.get_dflt() | ||
""" | ||
Important Note. | ||
The default dictionary has the following keys: | ||
1. X_train - Training features used to train the global model | ||
2. y_train - Training labels used to train the global model | ||
3. indep - The column names of features | ||
4. dep - The column name of labels | ||
5. blackbox_model - Trained global model (only support supervised classification models from sklearn) | ||
6. X_explain - One row of features (independent variables) to be explained | ||
7. y_explain - One row of label (dependent variable) to be explained | ||
8. full_ft_names - Full column names of features | ||
""" | ||
Initialise PyExplainer object with X_train, y_train, indep, dep, and blackbox_model. Attention!! PyExplainer only supports `sklearn's supervised classification model <https://scikit-learn.org/stable/supervised_learning.html>`_ :: | ||
# Note that full_ft_names is optional while other variables are necessary | ||
py_explainer = pyexplainer_pyexplainer.PyExplainer(X_train = default_data_and_model['X_train'], | ||
y_train = default_data_and_model['y_train'], | ||
indep = default_data_and_model['indep'], | ||
dep = default_data_and_model['dep'], | ||
blackbox_model = default_data_and_model['blackbox_model'] | ||
full_ft_names = default_data_and_model['full_ft_names']) | ||
|
||
Prepare data using default data dictionary to trigger explain function later:: | ||
|
||
# one row of features (independent variables) to be explained | ||
X_explain = default_data_and_model['X_explain'] | ||
# one row of label (dependent variable) to be explained | ||
y_explain = default_data_and_model['y_explain'] | ||
|
||
Trigger explain function under PyExplainer object to get rules:: | ||
|
||
created_rules = py_explainer.explain(X_explain=X_explain, | ||
y_explain=y_explain, | ||
search_function='crossoverinterpolation') | ||
|
||
Visualise those rules using visualise function under PyExplainer object:: | ||
|
||
py_explainer.visualise(created_rule_obj) | ||
Full tutorial | ||
-------------- | ||
|
||
|
||
|
||
import pyexplainer | ||
Simply click `here <https://github.com/awsm-research/PyExplainer/blob/master/TUTORIAL.ipynb>`_ to access our full tutorial Jupyter Notebook, in which we introduce the full workflow from data preparation to explainable prediction :: |
Oops, something went wrong.