Reels
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
reels Namespace Reference

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< ImageBlockBinaryImage
 An array of generic blocks to serialize anything. More...
 
typedef BinaryImagepBinaryImage
 A pointer to BinaryImage. More...
 
typedef std::map< BinEventPt, EventStatEventMap
 EventMap: A map from hashes in an BinEventPt to usage data defines the info about an event. More...
 
typedef std::map< uint64_t, BinEventPtPriorityMap
 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, CodeInTreeStatisticsCodeInTreeStatMap
 CodeInTreeStatMap: A map to store all the CodeInTreeStatistics by code. More...
 
typedef std::map< ElementHash, StringUsageStringUsageMap
 StringUsageMap: A map from hashes to string and number of times the string is used. More...
 
typedef std::vector< ElementHashClientIDs
 ClientIDs: A vector of client ID hashes. More...
 
typedef std::set< ElementHashClientIDSet
 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, ClipClipMap
 ClipMap: A map from clients to clips. More...
 
typedef ClipMappClipMap
 Pointer to a ClipMap. More...
 
typedef std::map< ElementHash, TimePointTargetMap
 TargetMap: A map from clients to target event TimePoints. More...
 
typedef TargetMappTargetMap
 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 CodeSetpCodeSet
 Pointer to a CodeSet. More...
 
typedef std::vector< OptimizeEvalItemOptimizeEval
 OptimizeEval: A vector of OptimizeEvalItem. More...
 
typedef std::vector< CodeScoreItemCodeScores
 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 CodeTreeNodepCodeTreeNode
 Pointer to a CodeTreeNode. More...
 
typedef std::vector< CodeTreeNodeCodeTree
 CodeTree: A tree of fitted targets. More...
 
typedef CodeTreepCodeTree
 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...
 

Detailed Description

The namespace including everything to simplify using Reels in a c++ application,.

Typedef Documentation

◆ BinaryImage

typedef std::vector<ImageBlock> reels::BinaryImage

An array of generic blocks to serialize anything.

◆ ChildIndex

typedef std::map<uint64_t, int> reels::ChildIndex

ChildIndex: A map to find the next child in a CodeTree.

◆ ClientIDs

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.

◆ ClientIDSet

typedef std::set<ElementHash> reels::ClientIDSet

ClientIDSet: A set of client ID hashes.

This set allows fast search of a Client ID hash.

◆ Clip

typedef std::map<TimePoint, uint64_t> reels::Clip

Clip: The clip (timeline) of a client is just a map of time points and codes.

◆ ClipMap

typedef std::map<ElementHash, Clip> reels::ClipMap

ClipMap: A map from clients to clips.

This map is the fundamental storage of the Clips class.

◆ CodeInTreeStatMap

typedef std::map<uint64_t, CodeInTreeStatistics> reels::CodeInTreeStatMap

CodeInTreeStatMap: A map to store all the CodeInTreeStatistics by code.

◆ CodeScores

typedef std::vector<CodeScoreItem> reels::CodeScores

CodeScores: A vector of CodeScoreItem.

◆ CodeSet

typedef std::set<uint64_t> reels::CodeSet

CodeSet: A set of event codes.

◆ CodeTree

typedef std::vector<CodeTreeNode> reels::CodeTree

CodeTree: A tree of fitted targets.

This is the complete fitted model in a Targets object.

◆ ElementHash

typedef uint64_t reels::ElementHash

A binary hash of a string.

◆ EventCodeMap

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.

◆ EventMap

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.

◆ ExtFloat

typedef double reels::ExtFloat

Accumulator type: Was a 128 bit float, changed to 64 for macos compatibility.

◆ OptimizeEval

typedef std::vector<OptimizeEvalItem> reels::OptimizeEval

OptimizeEval: A vector of OptimizeEvalItem.

◆ pBinaryImage

A pointer to BinaryImage.

◆ pChar

typedef const char* reels::pChar

A c string.

◆ pClipMap

Pointer to a ClipMap.

◆ pCodeSet

Pointer to a CodeSet.

◆ pCodeTree

Pointer to a CodeTree.

◆ pCodeTreeNode

Pointer to a CodeTreeNode.

◆ PriorityMap

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.

◆ pTargetMap

Pointer to a TargetMap.

◆ String

typedef std::string reels::String

A dynamically allocated c++ string.

◆ 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.

◆ TargetMap

TargetMap: A map from clients to target event TimePoints.

This map is given to the constructor of a Target object.

◆ TimePoint

typedef time_t reels::TimePoint

A c 8 byte integer time point.

◆ TimesToTarget

typedef std::vector<double> reels::TimesToTarget

TimesToTarget: A vector of predictions.

This is the return type of all predict methods.

◆ TimeStruct

typedef struct tm reels::TimeStruct

A c structure of integer fields.

Enumeration Type Documentation

◆ Aggregate

Aggregate: The method used to aggregate predictions for different sequence lengths.

Enumerator
ag_undefined 
ag_mean 
ag_minimax 
ag_longest 

◆ Transform

Transform: The transformation applied to time differences. (And inverted again in predict().)

Enumerator
tr_undefined 
tr_linear 
tr_log 

Function Documentation

◆ compare_optimize_eval()

bool reels::compare_optimize_eval ( const OptimizeEvalItem  a,
const OptimizeEvalItem  b 
)

Compare two OptimizeEvalItem structures for sorting.

Parameters
aThe first structure
bThe second one
Returns
True if a < b.

◆ compare_score_item()

bool reels::compare_score_item ( const CodeScoreItem  a,
const CodeScoreItem  b 
)

Compare two CodeScoreItem structures for sorting.

Parameters
aThe first structure
bThe second one
Returns
True if a < b.

◆ image_get()

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.

Parameters
p_biA pointer to an existing BinaryImage that was created by a series of image_put call (saved/loaded, etc.)
c_blockThe 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_ofsThe lowest number (offset inside the current block number) of the current cursor. This works together with c_block.
p_dataAddress of the memory buffer that will receive the block
sizeNumber of bytes to get
Returns
True on success

◆ image_put()

bool reels::image_put ( pBinaryImage  p_bi,
void *  p_data,
int  size 
)

A function to push arbitrary raw data into a BinaryImage.

Parameters
p_biA pointer to an existing BinaryImage that receives the data
p_dataAddress of the memory block to store
sizeNumber of bytes to store
Returns
True on success

◆ MurmurHash64A()

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.

Parameters
keyaddress of the memory block to hash.
lenNumber of bytes to hash.
Returns
64-bit hash of the memory block.

Variable Documentation

◆ REELS_logger

Logger reels::REELS_logger = {}

Used to output stats of Events::get_top_codes added by the Python API in events_optimize_events()