Example #1
0
VectorFileEffector::VectorFileEffector(const ValueMap& params, Region* region) :
  RegionImpl(region),
  dataIn_(NTA_BasicType_Real32),
  filename_(""),
  outFile_(0)
{
  if (params.contains("outputFile"))
    filename_ = *params.getString("outputFile");
  else
    filename_ = "";

}
Example #2
0
//--------------------------------------------------------------------------------
SpatialPoolerNode::SpatialPoolerNode(const ValueMap& params, Region* region)
  : RegionImpl(region), 
    mode_(Learning),
    // clonedNodes_(true), handled below
    nodeCount_(0), // will be set in initialize()
    // segmentSize_ (handled below)
    // sparsificationMode_ (handled below)
    // inferenceMode_ (handled below)
    // patchMasksStr_ (handled below -- nta_patchMasks)
    // normalize -- handled below
    // norm_ -- handled below
    // kWinners_ -- handled below -- nta_kWinners
    // maxDistance_ -- handled below
    // minAcceptNorm_ -- handled below
    // minProtoSum_ -- handled below
    // sigma_ -- handled below
    // seed_ -- handled below
    // maxNAttempts_(0), -- handled below
    // maxNPrototypes_(0) -- handled bedlow (maxCoincidenceCount)
    acceptanceProbability_(1.0),
    // rgen_(42) -- handled below
    poolersAllocated_(false),

    // non-serialized attributes
    bottomUpIn_(NULL), 
    topDownIn_(NULL),
    bottomUpOut_(NTA_BasicType_Real),
    topDownOut_(NTA_BasicType_Real),
    // bottomUpInputVector_ -- default constructor
    // topDownInputVector_ -- default constructor
    buInputSizePerNode_(0),
    tdInputSizePerNode_(0),
    phaseIndex_(0)
{

  waitDebuggerAttach_();
  
  clonedNodes_ = params.getScalarT<UInt32>("clonedNodes");
  segmentSize_ = params.getScalarT<UInt32>("nta_segmentSize");
  sparsificationMode_ = 
    SparsePooler::convertSparsificationMode(*params.getString("sparsify"));
  inferenceMode_ = 
    SparsePooler::convertInferenceMode(*params.getString("spatialPoolerAlgorithm"));
  patchMasksStr_ = *params.getString("nta_patchMasks");
  normalize_ = (bool)params.getScalarT<UInt32>("nta_normalize");
  norm_ = params.getScalarT<Real32>("nta_norm");
  kWinners_ = params.getScalarT<UInt32>("nta_kWinners");
  maxDistance_ = max(nta::Epsilon, params.getScalarT<Real32>("maxDistance"));
  minAcceptNorm_ = params.getScalarT<Real32>("nta_minAcceptNorm");
  minProtoSum_ = params.getScalarT<Real32>("nta_minProtoSum");
  sigma_ = params.getScalarT<Real32>("sigma");
  seed_ = params.getScalarT<UInt32>("nta_seed");
  maxNPrototypes_ = params.getScalarT<UInt32>("maxCoincidenceCount");

  // SpatialPoolerNode <realInitial> <clonedNodes> 
  // <numNodes> <nodeMode> 
  // <maxNPrototypes> <maxNAttempts> 
  // <stateSize> <state>...

  // May be specified in a parameter; if not (or zero), we will calculate 
  // a value in initialize() based on the number of baby nodes. 
  maxNAttempts_ = params.getScalarT<UInt32>("nta_maxNAttempts", 0);

  poolers_.clear();



}