rl_equation_solver.utilities.utilities

Collection of useful functions

Functions

build_adjacency_matrix(graph)

Build adjacency matrix from graph edges and labels

build_adjacency_matrix_custom(graph)

Build adjacency matrix from graph edges and labels

encode_onehot(labels)

Onehot encoding

get_json_graph(expr)

Make a graph plot of the internal representation of SymPy expression.

get_node_features(graph, feature_dict)

Get node features from feature dictionary.

get_node_labels(graph)

Get node labels from graph.

graph_walk(parent, expr, node_list, link_list)

Walk over the expression tree recursively creating nodes and links.

normalize(mx)

Row-normalize sparse matrix

pad_array(arr, length)

Pad array with zeros according the given length

parse_node_features(node_features, feature_dict)

Parse node features.

plot_state_as_graph(expr)

Make a graph plot of the internal representation of SymPy expression.

sparse_mx_to_torch_sparse_tensor(sparse_mx)

Convert a scipy sparse matrix to a torch sparse tensor.

to_graph(expr, feature_dict)

Make a graph plot of the internal representation of SymPy expression.

to_vec(expr, feature_dict[, state_dim])

Get state vector for given expression

Classes

Batch()

Graph Embedding or state vector Batch

Experience(state, action, next_state, reward)

Create new instance of Experience(state, action, next_state, reward)

GraphEmbedding(graph, n_observations, ...)

Graph embedding class for embedding node features in matrix of fixed sizes

Id()

A helper class for autoincrementing node numbers.

Node(label, expr_id)

Represents a single operation or atomic argument.

ReplayMemory(capacity)

Stores the Experience Replay buffer

VectorEmbedding(vector, n_observations, device)

Vector embedding class for embedding feature vector in vector of fixed size