NuPIC Core
Core algorithms for NuPIC(the Numenta Platform for Intelligent Computing), implemented in C++
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
nupic::algorithms::connections::Connections Class Reference

Connections implementation in C++. More...

#include <Connections.hpp>

Public Member Functions

 Connections ()
 Connections empty constructor. More...
 
 Connections (CellIdx numCells, SegmentIdx maxSegmentsPerCell=MAX_SEGMENTS_PER_CELL, SynapseIdx maxSynapsesPerSegment=MAX_SYNAPSES_PER_SEGMENT)
 Connections constructor. More...
 
void initialize (CellIdx numCells, SegmentIdx maxSegmentsPerCell, SynapseIdx maxSynapsesPerSegment)
 Initialize connections. More...
 
Segment createSegment (const Cell &cell)
 Creates a segment on the specified cell. More...
 
Synapse createSynapse (const Segment &segment, const Cell &presynapticCell, Permanence permanence)
 Creates a synapse on the specified segment. More...
 
void destroySegment (const Segment &segment)
 Destroys segment. More...
 
void destroySynapse (const Synapse &synapse)
 Destroys synapse. More...
 
void updateSynapsePermanence (const Synapse &synapse, Permanence permanence)
 Updates a synapse's permanence. More...
 
std::vector< SegmentsegmentsForCell (const Cell &cell) const
 Gets the segments for a cell. More...
 
std::vector< SynapsesynapsesForSegment (const Segment &segment)
 Gets the synapses for a segment. More...
 
SegmentData dataForSegment (const Segment &segment) const
 Gets the data for a segment. More...
 
SynapseData dataForSynapse (const Synapse &synapse) const
 Gets the data for a synapse. More...
 
std::vector< SynapsesynapsesForPresynapticCell (const Cell &presynapticCell) const
 Returns the synapses for the source cell that they synapse on. More...
 
bool mostActiveSegmentForCells (const std::vector< Cell > &cells, std::vector< Cell > input, SynapseIdx synapseThreshold, Segment &retSegment) const
 Gets the segment with the most active synapses due to given input, from among all the segments on all the given cells. More...
 
bool leastRecentlyUsedSegment (const Cell &cell, Segment &retSegment) const
 Gets the segment that was least recently used from among all the segments on the given cell. More...
 
Activity computeActivity (const std::vector< Cell > &input, Permanence permanenceThreshold, SynapseIdx synapseThreshold, bool recordIteration=true)
 Forward-propagates input to synapses, dendrites, and cells, to compute their activity. More...
 
std::vector< SegmentactiveSegments (const Activity &activity)
 Gets the active segments from activity. More...
 
std::vector< CellactiveCells (const Activity &activity)
 Gets the active cells from activity. More...
 
virtual void write (ostream &stream) const
 Writes serialized data to output stream.
 
virtual void write (ConnectionsProto::Builder &proto) const
 Writes serialized data to proto object.
 
virtual void read (istream &stream)
 Reads serialized data from input stream.
 
virtual void read (ConnectionsProto::Reader &proto)
 Reads serialized data from proto object.
 
UInt numSegments () const
 Gets the number of segments. More...
 
UInt numSynapses () const
 Gets the number of synapses. More...
 
bool operator== (const Connections &other) const
 Comparison operator.
 

Detailed Description

Connections implementation in C++.

Description The Connections class is a data structure that represents the connections of a collection of cells. It is used in the HTM learning algorithms to store and access data related to the connectivity of cells.

It's main utility is to provide a common, optimized data structure that all HTM learning algorithms can use. It is flexible enough to support any learning algorithm that operates on a collection of cells.

Each type of connection (proximal, distal, apical) should be represented by a different instantiation of this class. This class will help compute the activity along those connections due to active input cells. The responsibility for what effect that activity has on the cells and connections lies in the user of this class.

This class is optimized to store connections between cells, and compute the activity of cells due to input over the connections.

Definition at line 221 of file Connections.hpp.

Constructor & Destructor Documentation

nupic::algorithms::connections::Connections::Connections ( )
inline

Connections empty constructor.

(Does not call initialize.)

Definition at line 228 of file Connections.hpp.

nupic::algorithms::connections::Connections::Connections ( CellIdx  numCells,
SegmentIdx  maxSegmentsPerCell = MAX_SEGMENTS_PER_CELL,
SynapseIdx  maxSynapsesPerSegment = MAX_SYNAPSES_PER_SEGMENT 
)

Connections constructor.

Parameters
numCellsNumber of cells.
maxSegmentsPerCellMaximum number of segments per cell.
maxSynapsesPerSegmentMaximum number of synapses per segment.

Member Function Documentation

std::vector<Cell> nupic::algorithms::connections::Connections::activeCells ( const Activity activity)

Gets the active cells from activity.

Parameters
activityActivity.
Return values
Activecells.
std::vector<Segment> nupic::algorithms::connections::Connections::activeSegments ( const Activity activity)

Gets the active segments from activity.

Parameters
activityActivity.
Return values
Activesegments.
Activity nupic::algorithms::connections::Connections::computeActivity ( const std::vector< Cell > &  input,
Permanence  permanenceThreshold,
SynapseIdx  synapseThreshold,
bool  recordIteration = true 
)

Forward-propagates input to synapses, dendrites, and cells, to compute their activity.

Parameters
inputActive cells in the input.
permanenceThresholdOnly consider synapses with permanences greater than this threshold.
synapseThresholdOnly consider segments with number of active synapses greater than this threshold.
Return values
Activityto return.
Segment nupic::algorithms::connections::Connections::createSegment ( const Cell cell)

Creates a segment on the specified cell.

Parameters
cellCell to create segment on.
Return values
Createdsegment.
Synapse nupic::algorithms::connections::Connections::createSynapse ( const Segment segment,
const Cell presynapticCell,
Permanence  permanence 
)

Creates a synapse on the specified segment.

Parameters
segmentSegment to create synapse on.
presynapticCellCell to synapse on.
permanenceInitial permanence of new synapse.

Created synapse.

SegmentData nupic::algorithms::connections::Connections::dataForSegment ( const Segment segment) const

Gets the data for a segment.

Parameters
segmentSegment to get data for.
Return values
Segmentdata.
SynapseData nupic::algorithms::connections::Connections::dataForSynapse ( const Synapse synapse) const

Gets the data for a synapse.

Parameters
synapseSynapse to get data for.
Return values
Synapsedata.
void nupic::algorithms::connections::Connections::destroySegment ( const Segment segment)

Destroys segment.

Parameters
segmentSegment to destroy.
void nupic::algorithms::connections::Connections::destroySynapse ( const Synapse synapse)

Destroys synapse.

Parameters
synapseSynapse to destroy.
void nupic::algorithms::connections::Connections::initialize ( CellIdx  numCells,
SegmentIdx  maxSegmentsPerCell,
SynapseIdx  maxSynapsesPerSegment 
)

Initialize connections.

Parameters
numCellsNumber of cells.
maxSegmentsPerCellMaximum number of segments per cell.
maxSynapsesPerSegmentMaximum number of synapses per segment.
bool nupic::algorithms::connections::Connections::leastRecentlyUsedSegment ( const Cell cell,
Segment retSegment 
) const

Gets the segment that was least recently used from among all the segments on the given cell.

Parameters
cellCell whose segments to consider.
retSegmentSegment to return.
Return values
Falseif cell has no segments.
bool nupic::algorithms::connections::Connections::mostActiveSegmentForCells ( const std::vector< Cell > &  cells,
std::vector< Cell input,
SynapseIdx  synapseThreshold,
Segment retSegment 
) const

Gets the segment with the most active synapses due to given input, from among all the segments on all the given cells.

Parameters
cellsCells to look among.
inputActive cells in the input.
synapseThresholdOnly consider segments with number of active synapses greater than this threshold.
retSegmentSegment to return.
Return values
Segmentfound?
UInt nupic::algorithms::connections::Connections::numSegments ( ) const

Gets the number of segments.

Return values
Numberof segments.
UInt nupic::algorithms::connections::Connections::numSynapses ( ) const

Gets the number of synapses.

Return values
Numberof synapses.
std::vector<Segment> nupic::algorithms::connections::Connections::segmentsForCell ( const Cell cell) const

Gets the segments for a cell.

Parameters
cellCell to get segments for.
Return values
Segmentson cell.
std::vector<Synapse> nupic::algorithms::connections::Connections::synapsesForPresynapticCell ( const Cell presynapticCell) const

Returns the synapses for the source cell that they synapse on.

Parameters
presynapticCell(int)Source cell index
Returns
(set)Synapse indices
std::vector<Synapse> nupic::algorithms::connections::Connections::synapsesForSegment ( const Segment segment)

Gets the synapses for a segment.

Parameters
segmentSegment to get synapses for.
Return values
Synapseson segment.
void nupic::algorithms::connections::Connections::updateSynapsePermanence ( const Synapse synapse,
Permanence  permanence 
)

Updates a synapse's permanence.

Parameters
synapseSynapse to update.
permanenceNew permanence.

The documentation for this class was generated from the following file: