@ector/state
v1.0.3
Published
Allows activation values propagation within a weighted directed graph
Downloads
5
Readme
@ector/state
@ector/state
allows activation value propagation within a @ector/concept-network
.
Usage
const conceptNetwork = require('@ector/concept-network');
const cns = require('@ector/state');
let cn = conceptNetwork.addNode({}, 'ECTOR');
cn = conceptNetwork.addNode(cn, 'knows');
cn = conceptNetwork.addNode(cn, 'Achille');
cn = conceptNetwork.addLink(cn, 'ECTOR', 'knows');
cn = conceptNetwork.addLink(cn, 'knows', 'Achille');
let cns = cns.activate({}, 'ECTOR');
cns = cnsPropagate(cn, cns);
will give
{ "ECTOR": { "value": 59.500004166625004, "age": 1, "old": 100 },
"knows": { "value": 63.40844023393148, "age": 0, "old": 0 } }
Functions
Table of Contents
- ConceptNetworkState
- ConceptNetworkNodeState
- activate
- getActivationValue
- getOldActivationValue
- getMaxActivationValue
- getActivatedTypedNodes
- setActivationValue
- propagate
- mapObjIndexed
- influenceNb
- influenceValue
ConceptNetworkState
Type: (Object<string, ConceptNetworkNodeState> | {})
ConceptNetworkNodeState
Properties
value
number Node's activation valueold
number? Node's old activation valueage
number? Number of propagations
activate
Activate the node which label
is given
Parameters
cns
ConceptNetworkStatelabel
string
Returns ConceptNetworkState
getActivationValue
Get the activation value of the node which label
is given
Parameters
cns
ConceptNetworkStatelabel
string
getOldActivationValue
Get the activation value of a node (which label
is given)
Parameters
cns
ConceptNetworkStatelabel
string
getMaxActivationValue
Get the maximum activation value of all nodes which label starts with
beginning
.
Parameters
cns
ConceptNetworkStatebeginning
string (optional, default''
)
Returns number
getActivatedTypedNodes
Return an object associating nodes labels with their activation values, but
only for labels starting with beginning
and activation values greater or
equal to threshold
.
Parameters
cns
ConceptNetworkStatebeginning
string (optional, default''
)threshold
number (optional, default95
)
setActivationValue
Set the activation value
of a node label
.
Parameters
cns
ConceptNetworkState (optional, default{}
)label
stringvalue
number
Returns ConceptNetworkState
propagate
Propagate the activation values along the links.
Parameters
cn
ConceptNetworkcns
ConceptNetworkStateoptions
(optional, default{decay:40,memoryPerf:100}
)
Returns ConceptNetworkState