本文整理汇总了C++中Segment::DecreasePermanences方法的典型用法代码示例。如果您正苦于以下问题:C++ Segment::DecreasePermanences方法的具体用法?C++ Segment::DecreasePermanences怎么用?C++ Segment::DecreasePermanences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segment
的用法示例。
在下文中一共展示了Segment::DecreasePermanences方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplySegmentUpdates
/// This function reinforces each segment in this Cell's SegmentUpdateInfo.
///
/// Using the segmentUpdateInfo, the following changes are
/// performed. If positiveReinforcement is true then synapses on the active
/// list get their permanence counts incremented by permanenceInc. All other
/// synapses get their permanence counts decremented by permanenceDec. If
/// positiveReinforcement is false, then synapses on the active list get
/// their permanence counts decremented by permanenceDec. After this step,
/// any synapses in segmentUpdate that do yet exist get added with a permanence
/// count of initialPerm. These new synapses are randomly chosen from the
/// set of all cells that have learnState output = 1 at time step t.
///</remarks>
void Cell::ApplySegmentUpdates(int _curTime, ApplyUpdateTrigger _trigger)
{
Segment *segment;
SegmentUpdateInfo *segInfo;
Synapse *syn;
FastList modifiedSegments;
FastListIter synapses_iter, seg_update_iter;
bool apply_update;
// Iterate through all segment updates, skipping those not to be applied now, and removing those that are applied.
seg_update_iter.SetList(_segmentUpdates);
for (segInfo = (SegmentUpdateInfo*)(seg_update_iter.Reset()); segInfo != NULL; segInfo = (SegmentUpdateInfo*)(seg_update_iter.Get()))
{
// Do not apply the current segment update if it was created at the current time step, and was created as a result of the cell being predictive.
// If this is the case, then this segment update can only be evaluated at a later time step, and so should remain in the queue for now.
apply_update = !((segInfo->GetCreationTimeStep() == _curTime) && (segInfo->GetUpdateType() == UPDATE_DUE_TO_PREDICTIVE));
// Do not apply the current segment update if its numPredictionSteps > 1, and if we are applying updates due to the cell still being predictive,
// but with a greater numPredictionSteps. Unless the segment being updated predicted activation in 1 prediction step, it cannot be proven
// incorrect, and so shouldn't be processed yet. This is because a "prediction step" can take more than one time step.
if ((_trigger == AUT_LONGER_PREDICTION) && (segInfo->GetNumPredictionSteps() > 1)) {
apply_update = false;
}
if (apply_update)
{
segment = segInfo->GetSegment();
if (segment != NULL)
{
if (_trigger == AUT_ACTIVE)
{
// The cell has become actve; positively reinforce the segment.
segment->UpdatePermanences(segInfo->ActiveDistalSynapses);
}
else
{
// The cell has become inactive of is predictive but with a longer prediction. Negatively reinforce the segment.
segment->DecreasePermanences(segInfo->ActiveDistalSynapses);
}
// Record that this segment has been modified, so it can later be checked for synapses that should be removed.
if (modifiedSegments.IsInList(segment) == false) {
modifiedSegments.InsertAtEnd(segment);
}
}
// Add new synapses (and new segment if necessary)
if (segInfo->GetAddNewSynapses() && (_trigger == AUT_ACTIVE))
{
if (segment == NULL)
{
if (segInfo->CellsThatWillLearn.Count() > 0) //only add if learning cells available
{
segment = segInfo->CreateCellSegment(column->region->GetStepCounter());
}
}
else if (segInfo->CellsThatWillLearn.Count() > 0)
{
//add new synapses to existing segment
segInfo->CreateSynapsesToLearningCells(&(column->region->DistalSynapseParams));
}
}
// Remove and release the current SegmentUpdateInfo.
seg_update_iter.Remove();
mem_manager.ReleaseObject(segInfo);
}
else
{
// Leave the current segment upate in the queue, to be processed at a later time step. Advance to the next one.
seg_update_iter.Advance();
}
}
// Only process modified segments if all segment updates have been processed, to avoid deleting segments or synapses that
// are referred to by still-existing segment updates.
if (_segmentUpdates.Count() == 0)
{
// All segment updates have been processed, so there are none left that may have references to this cell's
// synapses or segments. Therefore we can iterate through all segments modified above, to prune unneeded synpses and segments.
while (modifiedSegments.Count() > 0)
{
// Get pointer to the current modified segment, and remove it from the modifiedSegments list.
segment = (Segment*)(modifiedSegments.GetFirst());
modifiedSegments.RemoveFirst();
// Remove from the current modified segment any synapses that have reached permanence of 0.
//.........这里部分代码省略.........