@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 value -
old
number? Node's old activation value -
age
number? Number of propagations
activate
Activate the node which label
is given
Parameters
-
cns
ConceptNetworkState -
label
string
Returns ConceptNetworkState
getActivationValue
Get the activation value of the node which label
is given
Parameters
-
cns
ConceptNetworkState -
label
string
getOldActivationValue
Get the activation value of a node (which label
is given)
Parameters
-
cns
ConceptNetworkState -
label
string
getMaxActivationValue
Get the maximum activation value of all nodes which label starts with
beginning
.
Parameters
-
cns
ConceptNetworkState -
beginning
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
ConceptNetworkState -
beginning
string (optional, default''
) -
threshold
number (optional, default95
)
setActivationValue
Set the activation value
of a node label
.
Parameters
-
cns
ConceptNetworkState (optional, default{}
) -
label
string -
value
number
Returns ConceptNetworkState
propagate
Propagate the activation values along the links.
Parameters
-
cn
ConceptNetwork -
cns
ConceptNetworkState -
options
(optional, default{decay:40,memoryPerf:100}
)
Returns ConceptNetworkState