Allows to create, evaluate, and differentiate computational graphs in R. A computational graph is a graph representation of a multivariate function decomposed by its (elementary) operations. Nodes in the graph represent arrays while edges represent dependencies among the arrays. An advantage of expressing a function as a computational graph is that this enables to differentiate the function by automatic differentiation. The 'cgraph' package supports various operations including basic arithmetic, trigonometry operations, and linear algebra operations. It differentiates computational graphs by reverse automatic differentiation. The flexible architecture of the package makes it applicable to solve a variety of problems including local sensitivity analysis, gradient-based optimization, and machine learning.
vfollowed by the node id.
cg_nodeobject for efficiency reasons.
cg_graph_gradientscan now also be
NULLto differentiate nodes element-wise. This is now also the default behavior.
bsumnow prints a correct error message when argument
block_sizeis not a numerical scalar.
cgraphon R versions before 3.5.
cg_session_set_graphno longer prints
NULLto the console when the active graph is changed.
cg_sigmoidnow works correctly when argument
xis a logical or integer vector or array.
cgraphis removed. To create a computational graph, use function
add_parmsare no longer available.
activeis removed. The active graph can now be retrieved and changed by function
oprhave been renamed to
setare removed. The value of a constant or parameter node can be retrieved or changed directly by calling
xis the environment of a
gradientshave been renamed to
cg_functionobject which can be linked to an operator. This significantly reduces the size of a
R6has been removed from the
Importssection in the package description.
Rgraphvizhas been removed from the
Suggestssection in the package description.
cg_nodeenvironment rather than its value when calling
cg_graphobject which contains nodes with an invalid id.
cg.matmulis now named
cg_matmul. The same rule applies to class names. For example, class
cg.nodeis now named
nameis removed. Names for nodes are now generated internally in the C-API.
approx.gradientsis removed. A simliar function is still available as
cgraph:::approx_gradin the package namespace. However, it should be noted that this function is not well-optimized and should only be used for testing purposes.
cg_nodeobject no longer prints the value of the node. Use function
valto evaluate a node.
librarywhich can be used to specify which function library the graph uses.
setto retrieve or set the value of a node respectively.
cg_meannow calls the base
cg_tcrossprodnow allow argument
yto be missing (similarly as the corresponding base functions).
cg_reshapenow expects an
cg_nodeobject instead of an integer scalar or vector that holds the new array dimensions.
-will have S3 overloaded methods.
sigmoidnow correctly handles numerical underflow.
cg.pminare now correctly differentiated when argument
yare both arrays.
oprnow correctly states that argument
namemust be a character scalar (not a symbol).
approx.gradno longer cause an infinite loop when member
cgraphobject is supplied to the
valuesargument of the functions.
gradientswhich caused the R session to crash unexpectedly.
approx.gradnow checks whether node
yevaluate to a numeric vector or array.
approx.gradno longer changes the parent environment of argument
valueswhen the argument is an environment.
gradientsno longer change the parent environment of argument
valueswhen the argument is an environment.
nameno longer generates a name that indicates the node type for performance reasons. Instead, it simply generates the name 'node' followed by the number of nodes that have been added to the graph.
cgraphobject are now named to allow more convenient access to the symbols of the nodes in a graph.
options(cg.autorun = FALSE).
cgraphobject instead of trying to coerce the object to a valid object.
oprnow ignores argument
gradswhen its elements are not properly named.
runnow checks whether each node evaluates to a numeric vector or array.
gradientsnow checks whether the node supplied to argument
nameevaluates to a numeric vector or array.
add.parmsnow correctly call the underlying C-API.
cgraphobject and their corresponding wrapper functions.