graphdot.model.tree_search.graph_transformer module¶
-
class
graphdot.model.tree_search.graph_transformer.
MCTSGraphTransformer
(rewriter, surrogate, exploration_bias=1.0, precision=0.01)[source]¶ Bases:
object
A varient of Monte Carlo tree search for optimization and root-finding in a space of graphs.
Parameters: - rewriter (callable) – A callable that implements the
Rewriter
abstract class. - surrogate (object) – A predictor used to calculate the target property of a given graph.
- exploration_bias (float) – Tunes the preference of the MCTS model between exploitation and exploration of the search space.
- precision (float) – Target precision of MCTS search outcome.
-
seek
(g0, target, maxiter=500, return_tree=False, random_state=None)[source]¶ Transforms an initial graph into one with a specific desired target property value.
Parameters: - g0 (object) – A graph to start the tree search with.
- target (float) – Target property value of the desired graph.
- maxiter (int) – Maximum number of MCTS iterations to perform.
- return_tree (Boolean) – Whether or not to return the search tree in its original form or as a flattened dataframe.
- random_state (int or :py:`np.random.Generator`) – The seed to the random number generator (RNG), or the RNG itself. If None, the default RNG in numpy will be used.
Returns: tree – If return_tree is True, a hierarchical dataframe representing the search tree will be returned; otherwise, a flattened dataframe will be returned.
Return type:
- rewriter (callable) – A callable that implements the