Main Page | Modules | Data Structures | File List | Globals | Related Pages

bnlearn-engine.h

Go to the documentation of this file.
00001 #ifndef __BNLEARN_ENGINE_H__
00002 #define __BNLEARN_ENGINE_H__
00003 
00004 #include "vfml.h"
00005 
00036 typedef enum BNLAction_ {BNL_NO_CHANGE, BNL_ADDED_PARENT, BNL_REMOVED_PARENT, BNL_REVERSED_PARENT} BNLAction;
00037 
00038 // Callback API
00039 // Any of these may be NULL, in which case they are ignored
00040 typedef struct BNLearnCallbackAPI_ {  
00041   // the user data is one-per-Bn
00042   // action is what action was taken to create the newBn from the oldBn
00043   void (*NetInit)(void **user, BeliefNet newBn, BeliefNet oldBn, BNLAction action, int childId, int parentId);
00044   void (*NetFree)(void **user, BeliefNet bn);
00045   void (*NodeUpdateBD)(void **user, BeliefNetNode bnn,
00046        float **add_eventCounts, float *add_rowCounts);
00047 } BNLearnCallbackAPI;
00048 
00049 
00050 /* The various parameters you may specify to bnlearn, and in
00051    comments are the default values */
00052 typedef struct BNLearnParams_ {
00053    // Data Input. One of these should be non-NULL
00054    VoidListPtr gDataMemory;   // Fastest. Consider using ExamplesRead(...)
00055    FILE *gDataFile;           // Data is loaded from disk on each iteration. Useful if data does not fit into RAM
00056 
00057    // Input Network. Exactly one of these needs to be non-NULL.
00058    BeliefNet gInputNetMemory;
00059    FILE *gInputNetFile;
00060    ExampleSpecPtr gInputNetEmptySpec; // consider using ExampleSpecRead(char *fileName);
00061 
00062    // Results
00063    char *gOutputNetFilename;     // name of file to output to. NULL for none
00064    int gOutputNetToMemory;       // Boolean (defaults to false)
00065    BeliefNet gOutputNetMemory;   // holds the resulting network upon return
00066 
00067    // Parameters
00068    long  gLimitBytes;              /*   -1      */
00069    double gLimitSeconds;           /*   -1      */
00070    int   gNoReverse;               /*   0       */
00071    double gKappa;                  /*   0.5     */
00072    int   gOnlyEstimateParameters;  /*   0       */
00073    int   gMaxSearchSteps;          /*   -1      */
00074    int   gMaxParentsPerNode;       /*   -1      */
00075    int   gMaxParameterGrowthMult;  /*   -1      */
00076    long  gMaxParameterCount;       /*   -1      */
00077    int   gSeed;                    /*   -1      */
00078    double gSmoothAmount;           /*   1.0     */
00079    int gCheckModelCycle;           /*  0        */
00080    BNLearnCallbackAPI *gCallbackAPI; /* NULL    */
00081 } BNLearnParams;
00082 
00083 
00084 
00086 BNLearnParams *BNLearn_NewParams();
00087 
00093 void BNLearn_FreeParams(BNLearnParams *params);
00094 
00096 void BNLearn(BNLearnParams *params);  
00097 
00098 
00099 #endif
00100 

Generated for VFML by doxygen hosted by SourceForge.net Logo