1.0.3 • Published 6 years ago
@ector/state v1.0.3
@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
valuenumber Node's activation valueoldnumber? Node's old activation valueagenumber? Number of propagations
activate
Activate the node which label is given
Parameters
cnsConceptNetworkStatelabelstring
Returns ConceptNetworkState
getActivationValue
Get the activation value of the node which label is given
Parameters
cnsConceptNetworkStatelabelstring
getOldActivationValue
Get the activation value of a node (which label is given)
Parameters
cnsConceptNetworkStatelabelstring
getMaxActivationValue
Get the maximum activation value of all nodes which label starts with
beginning.
Parameters
cnsConceptNetworkStatebeginningstring (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
cnsConceptNetworkStatebeginningstring (optional, default'')thresholdnumber (optional, default95)
setActivationValue
Set the activation value of a node label.
Parameters
cnsConceptNetworkState (optional, default{})labelstringvaluenumber
Returns ConceptNetworkState
propagate
Propagate the activation values along the links.
Parameters
cnConceptNetworkcnsConceptNetworkStateoptions(optional, default{decay:40,memoryPerf:100})
Returns ConceptNetworkState