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. More...
 
#define PRIORITY_SEEN_FACTOR   2000000000
 Close enough to 2^31 increases by 1 on visit, multiplies by this on seen. More...
 
#define DEFAULT_NUM_EVENTS   1000
 A size to store events in an Events object by default. More...
 
#define MAX_SEQ_LEN_IN_PREDICT   1000
 The maximum sequence length used in prediction. More...
 
#define PREDICT_MAX_TIME   (100*365.25*24*3600)
 Hundred years when the target was never seen. More...
 
#define WEIGHT_PRECISION   10000
 10^ the number of digits at which weight is rounded More...
 

Typedefs

typedef uint64_t reels::ElementHash
 A binary hash of a string. More...
 
typedef std::string reels::String
 A dynamically allocated c++ string. More...
 
typedef const char * reels::pChar
 A c string. More...
 
typedef time_t reels::TimePoint
 A c 8 byte integer time point. More...
 
typedef struct tm reels::TimeStruct
 A c structure of integer fields. More...
 
typedef double reels::ExtFloat
 Accumulator type: Was a 128 bit float, changed to 64 for macos compatibility. More...
 
typedef std::vector< ImageBlock > reels::BinaryImage
 An array of generic blocks to serialize anything. More...
 
typedef BinaryImage * reels::pBinaryImage
 A pointer to BinaryImage. More...
 
typedef std::map< BinEventPt, EventStat > reels::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 > reels::PriorityMap
 PriorityMap: A map with all the acceptable priority values in the EventMap as keys. More...
 
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. More...
 
typedef std::map< uint64_t, CodeInTreeStatistics > reels::CodeInTreeStatMap
 CodeInTreeStatMap: A map to store all the CodeInTreeStatistics by code. More...
 
typedef std::map< ElementHash, StringUsage > reels::StringUsageMap
 StringUsageMap: A map from hashes to string and number of times the string is used. More...
 
typedef std::vector< ElementHash > reels::ClientIDs
 ClientIDs: A vector of client ID hashes. More...
 
typedef std::set< ElementHash > reels::ClientIDSet
 ClientIDSet: A set of client ID hashes. More...
 
typedef std::map< TimePoint, uint64_t > reels::Clip
 Clip: The clip (timeline) of a client is just a map of time points and codes. More...
 
typedef std::map< ElementHash, Clip > reels::ClipMap
 ClipMap: A map from clients to clips. More...
 
typedef ClipMap * reels::pClipMap
 Pointer to a ClipMap. More...
 
typedef std::map< ElementHash, TimePoint > reels::TargetMap
 TargetMap: A map from clients to target event TimePoints. More...
 
typedef TargetMap * reels::pTargetMap
 Pointer to a TargetMap. More...
 
typedef std::vector< double > reels::TimesToTarget
 TimesToTarget: A vector of predictions. More...
 
typedef std::set< uint64_t > reels::CodeSet
 CodeSet: A set of event codes. More...
 
typedef CodeSet * reels::pCodeSet
 Pointer to a CodeSet. More...
 
typedef std::vector< OptimizeEvalItem > reels::OptimizeEval
 OptimizeEval: A vector of OptimizeEvalItem. More...
 
typedef std::vector< CodeScoreItem > reels::CodeScores
 CodeScores: A vector of CodeScoreItem. More...
 
typedef std::map< uint64_t, int > reels::ChildIndex
 ChildIndex: A map to find the next child in a CodeTree. More...
 
typedef CodeTreeNode * reels::pCodeTreeNode
 Pointer to a CodeTreeNode. More...
 
typedef std::vector< CodeTreeNode > reels::CodeTree
 CodeTree: A tree of fitted targets. More...
 
typedef CodeTree * reels::pCodeTree
 Pointer to a CodeTree. More...
 

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

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

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