Reels
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
reels.h File Reference
#include <algorithm>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <string.h>
#include <time.h>
#include <vector>
#include <stdarg.h>
#include <cstdint>
Include dependency graph for reels.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  reels::ImageBlock
 An generic block structure to store object state in a Python-friendly way. More...
 
struct  reels::BinEventPt
 The binary representation of an event as stored in a transaction file. More...
 
struct  reels::BinTransaction
 The binary representation of a transaction in a transaction file. More...
 
struct  reels::EventStat
 The metrics associated to an event identified by a BinEventPt. More...
 
struct  reels::CodeInTreeStatistics
 CodeInTreeStatistics: A structure to compute aggregated statistics of for each code. More...
 
struct  reels::StringUsage
 StringUsage: A pair of String and number of times it is used. More...
 
struct  reels::OptimizeEvalItem
 OptimizeEvalItem: A structure to compare predicted and observed. More...
 
struct  reels::CodeScoreItem
 CodeScoreItem: A structure to sort codes by lift. More...
 
struct  reels::CodeTreeNode
 CodeTreeNode: Each node in a fitted CodeTree. More...
 
class  reels::Logger
 A minimalist logger stored as a std::string providing sprintf functionality. More...
 
class  reels::Events
 A container class to hold events. More...
 
class  reels::Clients
 A container class to hold client ids. More...
 
class  reels::TimeUtil
 A common ancestor of Clips and Targets to avoid duplicating time management. More...
 
class  reels::Clips
 A container class to hold clips (sequences of events). More...
 
class  reels::Targets
 A container class to hold target events and do predictions based on clips. More...
 

Namespaces

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

Macros

#define INCLUDED_REELS_TYPES
 
#define IMAGE_BUFF_SIZE   6136
 Makes sizeof(ImageBlock) == 6K.
 
#define PRIORITY_SEEN_FACTOR   2000000000
 Close enough to 2^31 increases by 1 on visit, multiplies by this on seen.
 
#define DEFAULT_NUM_EVENTS   1000
 A size to store events in an Events object by default.
 
#define MAX_SEQ_LEN_IN_PREDICT   1000
 The maximum sequence length used in prediction.
 
#define PREDICT_MAX_TIME   (100*365.25*24*3600)
 Hundred years when the target was never seen.
 
#define WEIGHT_PRECISION   10000
 10^ the number of digits at which weight is rounded
 

Typedefs

typedef uint64_t reels::ElementHash
 A binary hash of a string.
 
typedef std::string reels::String
 A dynamically allocated c++ string.
 
typedef const char * reels::pChar
 A c string.
 
typedef time_t reels::TimePoint
 A c 8 byte integer time point.
 
typedef struct tm reels::TimeStruct
 A c structure of integer fields.
 
typedef double reels::ExtFloat
 Accumulator type: Was a 128 bit float, changed to 64 for macos compatibility.
 
typedef std::vector< ImageBlockreels::BinaryImage
 An array of generic blocks to serialize anything.
 
typedef BinaryImagereels::pBinaryImage
 A pointer to BinaryImage.
 
typedef std::map< BinEventPt, EventStatreels::EventMap
 EventMap: A map from hashes in an BinEventPt to usage data defines the info about an event.
 
typedef std::map< uint64_t, BinEventPtreels::PriorityMap
 PriorityMap: A map with all the acceptable priority values in the EventMap as keys.
 
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< uint64_t, CodeInTreeStatisticsreels::CodeInTreeStatMap
 CodeInTreeStatMap: A map to store all the CodeInTreeStatistics by code.
 
typedef std::map< ElementHash, StringUsagereels::StringUsageMap
 StringUsageMap: A map from hashes to string and number of times the string is used.
 
typedef std::vector< ElementHashreels::ClientIDs
 ClientIDs: A vector of client ID hashes.
 
typedef std::set< ElementHashreels::ClientIDSet
 ClientIDSet: A set of client ID hashes.
 
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, Clipreels::ClipMap
 ClipMap: A map from clients to clips.
 
typedef ClipMapreels::pClipMap
 Pointer to a ClipMap.
 
typedef std::map< ElementHash, TimePointreels::TargetMap
 TargetMap: A map from clients to target event TimePoints.
 
typedef TargetMapreels::pTargetMap
 Pointer to a TargetMap.
 
typedef std::vector< double > reels::TimesToTarget
 TimesToTarget: A vector of predictions.
 
typedef std::set< uint64_t > reels::CodeSet
 CodeSet: A set of event codes.
 
typedef CodeSetreels::pCodeSet
 Pointer to a CodeSet.
 
typedef std::vector< OptimizeEvalItemreels::OptimizeEval
 OptimizeEval: A vector of OptimizeEvalItem.
 
typedef std::vector< CodeScoreItemreels::CodeScores
 CodeScores: A vector of CodeScoreItem.
 
typedef std::map< uint64_t, int > reels::ChildIndex
 ChildIndex: A map to find the next child in a CodeTree.
 
typedef CodeTreeNodereels::pCodeTreeNode
 Pointer to a CodeTreeNode.
 
typedef std::vector< CodeTreeNodereels::CodeTree
 CodeTree: A tree of fitted targets.
 
typedef CodeTreereels::pCodeTree
 Pointer to a CodeTree.
 

Enumerations

enum  reels::Transform { reels::tr_undefined , reels::tr_linear , reels::tr_log }
 Transform: The transformation applied to time differences. (And inverted again in predict().) More...
 
enum  reels::Aggregate { reels::ag_undefined , reels::ag_mean , reels::ag_minimax , reels::ag_longest }
 Aggregate: The method used to aggregate predictions for different sequence lengths. More...
 

Functions

bool reels::compare_optimize_eval (const OptimizeEvalItem a, const OptimizeEvalItem b)
 Compare two OptimizeEvalItem structures for sorting.
 
uint64_t reels::MurmurHash64A (const void *key, int len)
 MurmurHash2, 64-bit versions, by Austin Appleby.
 
bool reels::image_put (pBinaryImage p_bi, void *p_data, int size)
 A function to push arbitrary raw data into a BinaryImage.
 
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.
 

Macro Definition Documentation

◆ DEFAULT_NUM_EVENTS

#define DEFAULT_NUM_EVENTS   1000

A size to store events in an Events object by default.

◆ IMAGE_BUFF_SIZE

#define IMAGE_BUFF_SIZE   6136

Makes sizeof(ImageBlock) == 6K.

◆ INCLUDED_REELS_TYPES

#define INCLUDED_REELS_TYPES

◆ MAX_SEQ_LEN_IN_PREDICT

#define MAX_SEQ_LEN_IN_PREDICT   1000

The maximum sequence length used in prediction.

◆ PREDICT_MAX_TIME

#define PREDICT_MAX_TIME   (100*365.25*24*3600)

Hundred years when the target was never seen.

◆ PRIORITY_SEEN_FACTOR

#define PRIORITY_SEEN_FACTOR   2000000000

Close enough to 2^31 increases by 1 on visit, multiplies by this on seen.

◆ WEIGHT_PRECISION

#define WEIGHT_PRECISION   10000

10^ the number of digits at which weight is rounded