Skip to content

Latest commit

 

History

History

state

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@ector/state

npm version

@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

Type: (Object<string, ConceptNetworkNodeState> | {})

ConceptNetworkNodeState

Type: Object<string, any>

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

Returns ConceptNetworkState

getActivationValue

Get the activation value of the node which label is given

Parameters

Returns (number | undefined)

getOldActivationValue

Get the activation value of a node (which label is given)

Parameters

Returns (number | undefined)

getMaxActivationValue

Get the maximum activation value of all nodes which label starts with beginning.

Parameters

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

setActivationValue

Set the activation value of a node label.

Parameters

Returns ConceptNetworkState

propagate

Propagate the activation values along the links.

Parameters

  • cn ConceptNetwork
  • cns ConceptNetworkState
  • options (optional, default {decay:40,memoryPerf:100})

Returns ConceptNetworkState

mapObjIndexed

influenceNb

influenceValue