![]() |
NuPIC
0.2.7.dev0
Numenta Platform for Intelligent Computing
|
A date encoder encodes a date according to encoding parameters specified in its constructor. More...
Public Member Functions | |
def | getScalarNames |
See method description in base.py. | |
def | getEncodedValues |
See method description in base.py. | |
def | getScalars |
See method description in base.py. More... | |
def | getBucketIndices |
See method description in base.py. | |
def | encodeIntoArray |
See method description in base.py. | |
![]() | |
def | getWidth |
Should return the output width, in bits. More... | |
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... | |
A date encoder encodes a date according to encoding parameters specified in its constructor.
The input to a date encoder is a datetime.datetime object. The output is the concatenation of several sub-encodings, each of which encodes a different aspect of the date. Which sub-encodings are present, and details of those sub-encodings, are specified in the DateEncoder constructor.
Each parameter describes one attribute to encode. By default, the attribute is not encoded.
season (season of the year; units = day): (int) width of attribute; default radius = 91.5 days (1 season) (tuple) season[0] = width; season[1] = radius
dayOfWeek (monday = 0; units = day) (int) width of attribute; default radius = 1 day (tuple) dayOfWeek[0] = width; dayOfWeek[1] = radius
weekend (boolean: 0, 1) (int) width of attribute
holiday (boolean: 0, 1) (int) width of attribute
timeOfday (midnight = 0; units = hour) (int) width of attribute: default radius = 4 hours (tuple) timeOfDay[0] = width; timeOfDay[1] = radius
customDays TODO: what is it?
forced (default True) : if True, skip checks for parameters' settings; see encoders/scalar.py for details
def getScalars | ( | self, | |
input | |||
) |
See method description in base.py.
input: A datetime object representing the time being encoded
Returns: A numpy array of the corresponding scalar values in the following order:
[season, dayOfWeek, weekend, holiday, timeOfDay]
Note: some of these fields might be omitted if they were not specified in the encoder