Skip to content

Commit 4e55fb5

Browse files
author
Dieb
committed
first documentation
1 parent be426da commit 4e55fb5

13 files changed

+353
-0
lines changed

docs/.DS_Store

8 KB
Binary file not shown.

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = MDTS
8+
SOURCEDIR = .
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)

docs/_static/.DS_Store

6 KB
Binary file not shown.

docs/_static/images/.DS_Store

6 KB
Binary file not shown.

docs/_static/images/hybrid.png

227 KB
Loading

docs/_static/images/mdts.png

307 KB
Loading

docs/conf.py

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# MDTS documentation build configuration file, created by
4+
# sphinx-quickstart on Tue Jan 23 16:40:36 2018.
5+
#
6+
# This file is execfile()d with the current directory set to its
7+
# containing dir.
8+
#
9+
# Note that not all possible configuration values are present in this
10+
# autogenerated file.
11+
#
12+
# All configuration values have a default; values that are commented out
13+
# serve to show the default.
14+
15+
# If extensions (or modules to document with autodoc) are in another directory,
16+
# add these directories to sys.path here. If the directory is relative to the
17+
# documentation root, use os.path.abspath to make it absolute, like shown here.
18+
#
19+
# import os
20+
# import sys
21+
# sys.path.insert(0, os.path.abspath('.'))
22+
23+
24+
# -- General configuration ------------------------------------------------
25+
26+
# If your documentation needs a minimal Sphinx version, state it here.
27+
#
28+
# needs_sphinx = '1.0'
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = ['sphinx.ext.mathjax']
34+
35+
# Add any paths that contain templates here, relative to this directory.
36+
templates_path = ['_templates']
37+
38+
# The suffix(es) of source filenames.
39+
# You can specify multiple suffix as a list of string:
40+
#
41+
# source_suffix = ['.rst', '.md']
42+
source_suffix = '.rst'
43+
44+
# The master toctree document.
45+
master_doc = 'index'
46+
47+
# General information about the project.
48+
project = u'MDTS'
49+
copyright = u'2018, Thaer Dieb'
50+
author = u'Thaer Dieb'
51+
52+
# The version info for the project you're documenting, acts as replacement for
53+
# |version| and |release|, also used in various other places throughout the
54+
# built documents.
55+
#
56+
# The short X.Y version.
57+
version = u'0.1'
58+
# The full version, including alpha/beta/rc tags.
59+
release = u'0.1'
60+
61+
# The language for content autogenerated by Sphinx. Refer to documentation
62+
# for a list of supported languages.
63+
#
64+
# This is also used if you do content translation via gettext catalogs.
65+
# Usually you set "language" from the command line for these cases.
66+
language = None
67+
68+
# List of patterns, relative to source directory, that match files and
69+
# directories to ignore when looking for source files.
70+
# This patterns also effect to html_static_path and html_extra_path
71+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
72+
73+
# The name of the Pygments (syntax highlighting) style to use.
74+
pygments_style = 'sphinx'
75+
76+
# If true, `todo` and `todoList` produce output, else they produce nothing.
77+
todo_include_todos = False
78+
79+
80+
# -- Options for HTML output ----------------------------------------------
81+
82+
# The theme to use for HTML and HTML Help pages. See the documentation for
83+
# a list of builtin themes.
84+
#
85+
html_theme = 'sphinx_rtd_theme'
86+
87+
# Theme options are theme-specific and customize the look and feel of a theme
88+
# further. For a list of options available for each theme, see the
89+
# documentation.
90+
#
91+
# html_theme_options = {}
92+
93+
# Add any paths that contain custom static files (such as style sheets) here,
94+
# relative to this directory. They are copied after the builtin static files,
95+
# so a file named "default.css" will overwrite the builtin "default.css".
96+
html_static_path = ['_static']
97+
98+
# Custom sidebar templates, must be a dictionary that maps document names
99+
# to template names.
100+
#
101+
# This is required for the alabaster theme
102+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
103+
html_sidebars = {
104+
'**': [
105+
'relations.html', # needs 'show_related': True theme option to display
106+
'searchbox.html',
107+
]
108+
}
109+
110+
111+
# -- Options for HTMLHelp output ------------------------------------------
112+
113+
# Output file base name for HTML help builder.
114+
htmlhelp_basename = 'MDTSdoc'
115+
116+
117+
# -- Options for LaTeX output ---------------------------------------------
118+
119+
latex_elements = {
120+
# The paper size ('letterpaper' or 'a4paper').
121+
#
122+
# 'papersize': 'letterpaper',
123+
124+
# The font size ('10pt', '11pt' or '12pt').
125+
#
126+
# 'pointsize': '10pt',
127+
128+
# Additional stuff for the LaTeX preamble.
129+
#
130+
# 'preamble': '',
131+
132+
# Latex figure (float) alignment
133+
#
134+
# 'figure_align': 'htbp',
135+
}
136+
137+
# Grouping the document tree into LaTeX files. List of tuples
138+
# (source start file, target name, title,
139+
# author, documentclass [howto, manual, or own class]).
140+
latex_documents = [
141+
(master_doc, 'MDTS.tex', u'MDTS Documentation',
142+
u'Thaer Dieb', 'manual'),
143+
]
144+
145+
146+
# -- Options for manual page output ---------------------------------------
147+
148+
# One entry per manual page. List of tuples
149+
# (source start file, name, description, authors, manual section).
150+
man_pages = [
151+
(master_doc, 'mdts', u'MDTS Documentation',
152+
[author], 1)
153+
]
154+
155+
156+
# -- Options for Texinfo output -------------------------------------------
157+
158+
# Grouping the document tree into Texinfo files. List of tuples
159+
# (source start file, target name, title, author,
160+
# dir menu entry, description, category)
161+
texinfo_documents = [
162+
(master_doc, 'MDTS', u'MDTS Documentation',
163+
author, 'MDTS', 'One line description of project.',
164+
'Miscellaneous'),
165+
]
166+
167+
168+

docs/index.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. MDTS documentation master file, created by
2+
sphinx-quickstart on Tue Jan 23 16:40:36 2018.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to MDTS's documentation!
7+
================================
8+
**MDTS: Materials Design by Tree Search**
9+
10+
Tsuda lab at the University of Tokyo
11+
12+
.. image:: /_static/images/mdts.png
13+
14+
15+
.. toctree::
16+
:maxdepth: 2
17+
:caption: Contents:
18+
19+
method
20+
installation
21+
versions
22+
usage
23+
papers
24+

docs/installation.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Installation
2+
============
3+
4+
Required Packages
5+
- python >= 2.7.x
6+
- numpy >=1.12.x
7+
- COMBO https://github.com/tsudalab/combo (in case you want to use Bayesian rollout function)
8+
9+
Setup
10+
- Download or clone the github repository, e.g.git clone https://github.com/tsudalab/MDTS
11+
- CD to the MDTS folder
12+
- python setup.py install
13+
- Please refer to test.py file for a use case

docs/method.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Method
2+
======
3+
4+
Materials design process is often represented as a black-box function f(x) optimization problem.
5+
6+
Monte Carlo tree search (MCTS) is an iterative, guided-random best-first search method that models the search space as a shallow tree. Each node of the tree represents an assignment of an atom of a certain type into a position in the structure. At the beginning, only the root node exists. Within a predetermined number of required experiments, the tree grows gradually in an iterative manner. Each iteration consists of 4 steps: Selection, Expansion, Simulation, and Backpropagation. In the Selection step, the tree is traversed from root to a leaf node following the child with the best score (children are scored using several methods, most commonly Upper Confidence Bound (UCB)). In Expansion step, children are generated under the selected node. The simulation step checks the merit of the new children by evaluating a full solution obtained at each child using experiment or simulation. Finally, the Backpropagation step updates the node information back to the root. A new iteration then begins.
7+
8+
To obtain a full solution from a shallow tree, several strategies can be used. The most simple one is the random completion (filling the rest of the positions randomly), a cheap and less efficient solution.
9+
10+
We use Bayesian learning to obtain full solution from a shallow tree. Bayesian optimization methods maintain a surrogate model of f(x), most commonly, Gaussian process (GP). A pool of candidate is generated where each data point represents a full structure. GP starts with an initial set of randomly selected data points from the pool. GP is updated as more data points are observed. An acquisition function is, then, used to determine where to query f(x) by quantifying how promising a data point is using both predicted value and prediction uncertainty.
11+
12+
.. image:: /_static/images/hybrid.png

docs/papers.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Publications
2+
============
3+
4+
If you use this package, please cite us:
5+
Thaer M. Dieb, Shenghong Ju, Kazuki Yoshizoe, Zhufeng Hou, Junichiro Shiomi and Koji Tsuda. MDTS: Automatic Complex Materials Design using Monte Carlo Tree Search. Sci. Tech. Adv. Mater. 18, 498 (2017)
6+
7+
Publications that have cited our work
8+
- Xiufeng Yang, Jinzhe Zhang, Kazuki Yoshizoe, Kei Terayama, Koji Tsuda. ChemTS: an efficient python library for de novo molecular generation. Sci. Tech. Adv. Mater. 18:1, pages 972-976. (2017)
9+
- Thaer M. Dieb, Koji Tsuda. Machine Learning-Based Experimental Design in Materials Science. Nanoinformatics, pages 65-74 (2018)

docs/usage.rst

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Usage
2+
=====
3+
4+
5+
After installation:
6+
7+
- import mdts package into your code ::
8+
9+
import mots
10+
11+
- implement the get_reward (struct) function: This function evaluates the solution, that is the material structure, usually by a simulation function. It takes a python list representing the structure and returns the reward, usually the material property to be optimized. If no reward shall be return, use the **False** value as an output.
12+
- set the search tree object (mdts.Tree): This object will set the parameters for constructing the shallow tree. The parameters are as follows:
13+
14+
+ no_positions: number of positions in each structure to be set. For example, 16 positions.
15+
+ atom_types: types of atoms. For example, 0 for Si and 1 for Ge
16+
+ atom_const: number of each atom type in the structure. For example, 8 atoms Si and 8 atoms Ge. NONE indicates no constraints on number of that atom. Default is None
17+
+ get_reward: the simulation function to evaluate a solution.
18+
+ positions_order: define the order to assign atoms to the positions in the structure: "direct", "reverse","shuffle" or a list. Default is "reverse"
19+
+ max_flag: if True the algorithm searches for maximum reward, else for minimum
20+
+ expand_children : number of children to expand at each node. Default is "1". i.e. expand one child at a time.
21+
+ play_out: number of playouts to be performed when creating a new node. Default is 1. Please note if you set the parameter use_combo to True, play_out can not be 1
22+
+ play_out_selection: when performing multiple playouts, best or mean is returned. Default is best
23+
+ space: numpy ndarray representing the candidates space if available or enumerable. If the space is not available or too expensive to enumerate, use NONE. Default is None. Note, if you specified the space, the "no_positions", "atom_types", and "atom_const" parameters will be ignored and there values will be taken from the ndarray of the space.
24+
+ candidate_pool_size: the pool size that will be generated for the Bayesian rollout. It has to be set if you set use_combo=True, otherwise, it can be ignored.
25+
+ ucb: it can be either "mean" or "best", it represents taking either average or best ucb score for Monte Carlo tree search. Default is "mean"
26+
+ use_combo: weather to use Bayesian optimisation package (COMBO) or not in combination with Monte Carlo tree search to perform the rollout. If it is set to False, random rollout is performed.
27+
+ combo_play_out: total number of candidates to be examined by COMBO while performing the rollout operation.
28+
+ combo_init_random: the initial random selection for Bayesian optimisation. Default is 1
29+
+ combo_step: the interval for Bayesian optimisation to perform hyper-parameter optimization. Default is 1
30+
::
31+
32+
myTree=mdts.Tree(no_positions=16, atom_types=[0,1], atom_const=[8,8], get_reward=get_reward, positions_order=range(16),
33+
max_flag=True, expand_children=2, play_out=5, play_out_selection="best", space=None, candidate_pool_size=100,
34+
ucb="mean", use_combo=True, combo_play_out=20, combo_init_random=5, combo_step=5)
35+
- start the search by defining the required number of iterations. Search function will return an object of the class Result::
36+
37+
res=myTree.search(display=True,no_candidates=500)
38+
39+
- search results can be obtained using the following properties of the class Result:
40+
41+
+ Optimal reward::
42+
43+
print res.optimal_fx
44+
45+
+ List of optimal candidates::
46+
47+
print res.optimal_candidate
48+
49+
+ List of tuples with the candidates examined and their rewards::
50+
51+
print res.checked_candidates_DS
52+
53+
+ Number of examined candidates::
54+
55+
print res.checked_candidates_size
56+
57+
+ List of chosen candidates in order::
58+
59+
print res.checked_candidates
60+
61+
+ List of simulated candidates rewards in order::
62+
63+
print res.fx
64+
65+
+ List of current best reward::
66+
67+
print res.best_fx
68+
69+
+ Maximum depth reached::
70+
71+
print res.max_depth_reached
72+
73+
+ Number of nodes constructed::
74+
75+
print res.no_nodes
76+
77+
+ Average visit per node::
78+
79+
print res.avg_node_visit
80+
81+
- save and load results
82+
83+
+ Save results::
84+
85+
res.save('results.npz')
86+
87+
+Load results::
88+
89+
new_res=mdts.Result()
90+
new_res.load('results.npz')
91+
print new_res.optimal_fx
92+
93+
94+
- The tree can be saved::
95+
96+
mdts.save_tree(myTree,'Tree_file')
97+
del myTree
98+
99+
- Load the tree and continue the search from where you left it::
100+
101+
myNewTree = mdts.load_tree('Tree_file')
102+
newTree_res=myNewTree.search(display=True, no_candidates=600)
103+
print newTree_res.checked_candidates_size
104+

docs/versions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Versions
2+
========
3+
Current release version is 0.6

0 commit comments

Comments
 (0)