Reels
|
The namespace including everything to simplify using Reels in a c++ application,. More...
Classes | |
struct | BinEventPt |
The binary representation of an event as stored in a transaction file. More... | |
struct | BinTransaction |
The binary representation of a transaction in a transaction file. More... | |
class | Clients |
A container class to hold client ids. More... | |
class | Clips |
A container class to hold clips (sequences of events). More... | |
struct | CodeInTreeStatistics |
CodeInTreeStatistics: A structure to compute aggregated statistics of for each code. More... | |
struct | CodeScoreItem |
CodeScoreItem: A structure to sort codes by lift. More... | |
struct | CodeTreeNode |
CodeTreeNode: Each node in a fitted CodeTree. More... | |
class | Events |
A container class to hold events. More... | |
struct | EventStat |
The metrics associated to an event identified by a BinEventPt. More... | |
struct | ImageBlock |
An generic block structure to store object state in a Python-friendly way. More... | |
class | Logger |
A minimalist logger stored as a std::string providing sprintf functionality. More... | |
struct | OptimizeEvalItem |
OptimizeEvalItem: A structure to compare predicted and observed. More... | |
struct | StringUsage |
StringUsage: A pair of String and number of times it is used. More... | |
class | Targets |
A container class to hold target events and do predictions based on clips. More... | |
class | TimeUtil |
A common ancestor of Clips and Targets to avoid duplicating time management. More... | |
Typedefs | |
typedef uint64_t | ElementHash |
A binary hash of a string. More... | |
typedef std::string | String |
A dynamically allocated c++ string. More... | |
typedef const char * | pChar |
A c string. More... | |
typedef time_t | TimePoint |
A c 8 byte integer time point. More... | |
typedef struct tm | TimeStruct |
A c structure of integer fields. More... | |
typedef double | ExtFloat |
Accumulator type: Was a 128 bit float, changed to 64 for macos compatibility. More... | |
typedef std::vector< ImageBlock > | BinaryImage |
An array of generic blocks to serialize anything. More... | |
typedef BinaryImage * | pBinaryImage |
A pointer to BinaryImage. More... | |
typedef std::map< BinEventPt, EventStat > | EventMap |
EventMap: A map from hashes in an BinEventPt to usage data defines the info about an event. More... | |
typedef std::map< uint64_t, BinEventPt > | PriorityMap |
PriorityMap: A map with all the acceptable priority values in the EventMap as keys. More... | |
typedef std::map< uint64_t, uint64_t > | EventCodeMap |
EventCodeMap: A map converting the space of Event codes into a lower cardinality set for Event optimization. More... | |
typedef std::map< uint64_t, CodeInTreeStatistics > | CodeInTreeStatMap |
CodeInTreeStatMap: A map to store all the CodeInTreeStatistics by code. More... | |
typedef std::map< ElementHash, StringUsage > | StringUsageMap |
StringUsageMap: A map from hashes to string and number of times the string is used. More... | |
typedef std::vector< ElementHash > | ClientIDs |
ClientIDs: A vector of client ID hashes. More... | |
typedef std::set< ElementHash > | ClientIDSet |
ClientIDSet: A set of client ID hashes. More... | |
typedef std::map< TimePoint, uint64_t > | Clip |
Clip: The clip (timeline) of a client is just a map of time points and codes. More... | |
typedef std::map< ElementHash, Clip > | ClipMap |
ClipMap: A map from clients to clips. More... | |
typedef ClipMap * | pClipMap |
Pointer to a ClipMap. More... | |
typedef std::map< ElementHash, TimePoint > | TargetMap |
TargetMap: A map from clients to target event TimePoints. More... | |
typedef TargetMap * | pTargetMap |
Pointer to a TargetMap. More... | |
typedef std::vector< double > | TimesToTarget |
TimesToTarget: A vector of predictions. More... | |
typedef std::set< uint64_t > | CodeSet |
CodeSet: A set of event codes. More... | |
typedef CodeSet * | pCodeSet |
Pointer to a CodeSet. More... | |
typedef std::vector< OptimizeEvalItem > | OptimizeEval |
OptimizeEval: A vector of OptimizeEvalItem. More... | |
typedef std::vector< CodeScoreItem > | CodeScores |
CodeScores: A vector of CodeScoreItem. More... | |
typedef std::map< uint64_t, int > | ChildIndex |
ChildIndex: A map to find the next child in a CodeTree. More... | |
typedef CodeTreeNode * | pCodeTreeNode |
Pointer to a CodeTreeNode. More... | |
typedef std::vector< CodeTreeNode > | CodeTree |
CodeTree: A tree of fitted targets. More... | |
typedef CodeTree * | pCodeTree |
Pointer to a CodeTree. More... | |
Enumerations | |
enum | Transform { tr_undefined , tr_linear , tr_log } |
Transform: The transformation applied to time differences. (And inverted again in predict().) More... | |
enum | Aggregate { ag_undefined , ag_mean , ag_minimax , ag_longest } |
Aggregate: The method used to aggregate predictions for different sequence lengths. More... | |
Functions | |
uint64_t | MurmurHash64A (const void *key, int len) |
MurmurHash2, 64-bit versions, by Austin Appleby. More... | |
bool | image_put (pBinaryImage p_bi, void *p_data, int size) |
A function to push arbitrary raw data into a BinaryImage. More... | |
bool | image_get (pBinaryImage p_bi, int &c_block, int &c_ofs, void *p_data, int size) |
A function to get an arbitrary raw data block from a BinaryImage. More... | |
bool | compare_optimize_eval (const OptimizeEvalItem a, const OptimizeEvalItem b) |
Compare two OptimizeEvalItem structures for sorting. More... | |
bool | compare_score_item (const CodeScoreItem a, const CodeScoreItem b) |
Compare two CodeScoreItem structures for sorting. More... | |
Variables | |
Logger | REELS_logger = {} |
Used to output stats of Events::get_top_codes added by the Python API in events_optimize_events() More... | |
The namespace including everything to simplify using Reels in a c++ application,.
typedef std::vector<ImageBlock> reels::BinaryImage |
An array of generic blocks to serialize anything.
typedef std::map<uint64_t, int> reels::ChildIndex |
ChildIndex: A map to find the next child in a CodeTree.
typedef std::vector<ElementHash> reels::ClientIDs |
ClientIDs: A vector of client ID hashes.
This map is the fundamental storage of the Clients class preserving the order in which they are defined.
typedef std::set<ElementHash> reels::ClientIDSet |
ClientIDSet: A set of client ID hashes.
This set allows fast search of a Client ID hash.
typedef std::map<TimePoint, uint64_t> reels::Clip |
Clip: The clip (timeline) of a client is just a map of time points and codes.
typedef std::map<ElementHash, Clip> reels::ClipMap |
ClipMap: A map from clients to clips.
This map is the fundamental storage of the Clips class.
typedef std::map<uint64_t, CodeInTreeStatistics> reels::CodeInTreeStatMap |
CodeInTreeStatMap: A map to store all the CodeInTreeStatistics by code.
typedef std::vector<CodeScoreItem> reels::CodeScores |
CodeScores: A vector of CodeScoreItem.
typedef std::set<uint64_t> reels::CodeSet |
CodeSet: A set of event codes.
typedef std::vector<CodeTreeNode> reels::CodeTree |
CodeTree: A tree of fitted targets.
This is the complete fitted model in a Targets object.
typedef uint64_t reels::ElementHash |
A binary hash of a string.
typedef std::map<uint64_t, uint64_t> reels::EventCodeMap |
EventCodeMap: A map converting the space of Event codes into a lower cardinality set for Event optimization.
typedef std::map<BinEventPt, EventStat> reels::EventMap |
EventMap: A map from hashes in an BinEventPt to usage data defines the info about an event.
This map is combined with a PriorityMap to update observed events.
typedef double reels::ExtFloat |
Accumulator type: Was a 128 bit float, changed to 64 for macos compatibility.
typedef std::vector<OptimizeEvalItem> reels::OptimizeEval |
OptimizeEval: A vector of OptimizeEvalItem.
typedef BinaryImage* reels::pBinaryImage |
A pointer to BinaryImage.
typedef const char* reels::pChar |
A c string.
typedef ClipMap* reels::pClipMap |
Pointer to a ClipMap.
typedef CodeSet* reels::pCodeSet |
Pointer to a CodeSet.
typedef CodeTree* reels::pCodeTree |
Pointer to a CodeTree.
typedef CodeTreeNode* reels::pCodeTreeNode |
Pointer to a CodeTreeNode.
typedef std::map<uint64_t, BinEventPt> reels::PriorityMap |
PriorityMap: A map with all the acceptable priority values in the EventMap as keys.
This map is the priority queue that accepts removal by least priority of current value.
typedef TargetMap* reels::pTargetMap |
Pointer to a TargetMap.
typedef std::string reels::String |
A dynamically allocated c++ string.
typedef std::map<ElementHash, StringUsage> reels::StringUsageMap |
StringUsageMap: A map from hashes to string and number of times the string is used.
This map allows doing the reverse conversion to a hash() function finding out the original string.
typedef std::map<ElementHash, TimePoint> reels::TargetMap |
TargetMap: A map from clients to target event TimePoints.
This map is given to the constructor of a Target object.
typedef time_t reels::TimePoint |
A c 8 byte integer time point.
typedef std::vector<double> reels::TimesToTarget |
TimesToTarget: A vector of predictions.
This is the return type of all predict methods.
typedef struct tm reels::TimeStruct |
A c structure of integer fields.
enum reels::Aggregate |
enum reels::Transform |
bool reels::compare_optimize_eval | ( | const OptimizeEvalItem | a, |
const OptimizeEvalItem | b | ||
) |
Compare two OptimizeEvalItem structures for sorting.
a | The first structure |
b | The second one |
bool reels::compare_score_item | ( | const CodeScoreItem | a, |
const CodeScoreItem | b | ||
) |
Compare two CodeScoreItem structures for sorting.
a | The first structure |
b | The second one |
bool reels::image_get | ( | pBinaryImage | p_bi, |
int & | c_block, | ||
int & | c_ofs, | ||
void * | p_data, | ||
int | size | ||
) |
A function to get an arbitrary raw data block from a BinaryImage.
p_bi | A pointer to an existing BinaryImage that was created by a series of image_put call (saved/loaded, etc.) |
c_block | The highest number (block number of the current cursor) that defines where to start reading from. (The normal use is starting at (0,0) and let this function update cursor value. Just get() the blocks in the same order ands size that was used to put() them.) |
c_ofs | The lowest number (offset inside the current block number) of the current cursor. This works together with c_block . |
p_data | Address of the memory buffer that will receive the block |
size | Number of bytes to get |
bool reels::image_put | ( | pBinaryImage | p_bi, |
void * | p_data, | ||
int | size | ||
) |
A function to push arbitrary raw data into a BinaryImage.
p_bi | A pointer to an existing BinaryImage that receives the data |
p_data | Address of the memory block to store |
size | Number of bytes to store |
uint64_t reels::MurmurHash64A | ( | const void * | key, |
int | len | ||
) |
MurmurHash2, 64-bit versions, by Austin Appleby.
(from https://sites.google.com/site/murmurhash/) a 64-bit hash for 64-bit platforms
All code is released to the public domain. For business purposes, Murmurhash is under the MIT license.
The same caveats as 32-bit MurmurHash2 apply here - beware of alignment and endian-ness issues if used across multiple platforms.
key | address of the memory block to hash. |
len | Number of bytes to hash. |
Logger reels::REELS_logger = {} |
Used to output stats of Events::get_top_codes added by the Python API in events_optimize_events()