NuPIC
Numenta Platform for Intelligent Computing
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | List of all members
ArithmeticEncoder Class Reference

A scalar encoder based loosely on arithmetic coding. More...

Inheritance diagram for ArithmeticEncoder:
Encoder

Public Member Functions

def __init__
 TODO: document. More...
 
def getDecoderOutputFieldTypes
 [overrides nupic.encoders.base.Encoder.getDecoderOutputFieldTypes] More...
 
def getBucketInfo
 [overrides overrides nupic.encoders.base.Encoder.getBucketInfo]
 
def getWidth
 TODO: document.
 
def isDelta
 TODO: document.
 
def getBucketIndices
 TODO: document.
 
def getBucketValues
 TODO: document TODO: What values go in the return value?
 
def encodeIntoArray
 Encode inputValue and write the output bit array to outputArray. More...
 
def decode
 [overrides overrides nupic.encoders.base.Encoder.decode] Not implemented, but required override.
 
def topDownCompute
 [overrides overrides nupic.encoders.base.Encoder.topDownCompute] Not implemented, but required override.
 
def closenessScores
 TODO: document. More...
 
def getDescription
 TODO: document. More...
 
- Public Member Functions inherited from Encoder
def getWidth
 Should return the output width, in bits. More...
 
def isDelta
 
def encodeIntoArray
 Encodes inputData and puts the encoded value into the numpy output array, which is a 1-D array of length returned by getWidth(). More...
 
def setLearning
 Set whether learning is enabled. More...
 
def setFieldStats
 This method is called by the model to set the statistics like min and max for the underlying encoders if this information is available. More...
 
def encode
 Convenience wrapper for encodeIntoArray. More...
 
def getScalarNames
 Return the field names for each of the scalar values returned by getScalars. More...
 
def getDecoderOutputFieldTypes
 Returns a sequence of field types corresponding to the elements in the decoded output field array. More...
 
def setStateLock
 Setting this to true freezes the state of the encoder This is separate from the learning state which affects changing parameters. More...
 
def getEncoderList
 
def getScalars
 Returns a numpy array containing the sub-field scalar value(s) for each sub-field of the inputData. More...
 
def getEncodedValues
 Returns the input in the same format as is returned by topDownCompute(). More...
 
def getBucketIndices
 Returns an array containing the sub-field bucket indices for each sub-field of the inputData. More...
 
def scalarsToStr
 Return a pretty print string representing the return values from getScalars and getScalarNames(). More...
 
def getDescription
 This returns a list of tuples, each containing (name, offset). More...
 
def getFieldDescription
 Return the offset and length of a given field within the encoded output. More...
 
def encodedBitDescription
 Return a description of the given bit in the encoded output. More...
 
def pprintHeader
 Pretty-print a header that labels the sub-fields of the encoded output. More...
 
def pprint
 Pretty-print the encoded output using ascii art. More...
 
def decode
 Takes an encoded output and does its best to work backwards and generate the input that would have generated it. More...
 
def decodedToStr
 Return a pretty print string representing the return value from decode().
 
def getBucketValues
 Returns a list of items, one for each bucket defined by this encoder. More...
 
def getBucketInfo
 Returns a list of EncoderResult namedtuples describing the inputs for each sub-field that correspond to the bucket indices passed in 'buckets'. More...
 
def topDownCompute
 Returns a list of EncoderResult namedtuples describing the top-down best guess inputs for each sub-field given the encoded output. More...
 
def closenessScores
 Compute closeness scores between the expected scalar value(s) and actual scalar value(s). More...
 
def getDisplayWidth
 Calculate width of display for bits plus blanks between fields. More...
 
def formatBits
 Copy one array to another, inserting blanks between fields (for display) If leftpad is one, then there is a dummy value at element 0 of the arrays, and we should start our counting from 1 rather than 0. More...
 

Detailed Description

A scalar encoder based loosely on arithmetic coding.

This encoder uses a moving window of scalar values and keeps an equal number of values in each bucket. So a new value will typically not have a significant impact on the representations of values. If there are not an even number of values per bucket then the left-most buckets will contain an extra value.

NOTE: This encoder is not completely implemented.

Wikipedia on arithmetic coding

TODO: Perhaps arithmetic coding isn't the best analogy?

Constructor & Destructor Documentation

def __init__ (   self,
  w,
  n,
  periodic = False,
  window = 200,
  name = None,
  verbosity = 0 
)

TODO: document.

Parameters
wTODO: document
nTODO: document
periodicTODO: document
windowTODO: document
nameTODO: document
verbosityTODO: document

Member Function Documentation

def closenessScores (   self,
  expValues,
  actValues,
  fractional = True 
)

TODO: document.

Parameters
expValuesTODO: document
actValuesTODO: document
fractionalTODO: document
Returns
TODO: document
def encodeIntoArray (   self,
  inputValue,
  outputArray 
)

Encode inputValue and write the output bit array to outputArray.

Parameters
inputValueTODO: document
outputArrayTODO: document
def getDecoderOutputFieldTypes (   self)

[overrides nupic.encoders.base.Encoder.getDecoderOutputFieldTypes]

Returns
output field type
def getDescription (   self)

TODO: document.

Returns
TODO: document

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