tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
learner.h
Go to the documentation of this file.
1 /* =============================================================================
2  *
3  * learn.h
4  * -- Learns structure of Bayesian net from data
5  *
6  * =============================================================================
7  *
8  * Copyright (C) Stanford University, 2006. All Rights Reserved.
9  * Author: Chi Cao Minh
10  *
11  * =============================================================================
12  *
13  * For the license of bayes/sort.h and bayes/sort.c, please see the header
14  * of the files.
15  *
16  * ------------------------------------------------------------------------
17  *
18  * For the license of kmeans, please see kmeans/LICENSE.kmeans
19  *
20  * ------------------------------------------------------------------------
21  *
22  * For the license of ssca2, please see ssca2/COPYRIGHT
23  *
24  * ------------------------------------------------------------------------
25  *
26  * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
27  * header of the files.
28  *
29  * ------------------------------------------------------------------------
30  *
31  * For the license of lib/rbtree.h and lib/rbtree.c, please see
32  * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
33  *
34  * ------------------------------------------------------------------------
35  *
36  * Unless otherwise noted, the following license applies to STAMP files:
37  *
38  * Copyright (c) 2007, Stanford University
39  * All rights reserved.
40  *
41  * Redistribution and use in source and binary forms, with or without
42  * modification, are permitted provided that the following conditions are
43  * met:
44  *
45  * * Redistributions of source code must retain the above copyright
46  * notice, this list of conditions and the following disclaimer.
47  *
48  * * Redistributions in binary form must reproduce the above copyright
49  * notice, this list of conditions and the following disclaimer in
50  * the documentation and/or other materials provided with the
51  * distribution.
52  *
53  * * Neither the name of Stanford University nor the names of its
54  * contributors may be used to endorse or promote products derived
55  * from this software without specific prior written permission.
56  *
57  * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
58  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
60  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
61  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
67  * THE POSSIBILITY OF SUCH DAMAGE.
68  *
69  * =============================================================================
70  */
71 
72 
73 #ifndef LEARNER_H
74 #define LEARNER_H 1
75 
76 #include "adtree.h"
77 #include "data.h"
78 #include "net.h"
79 #include "query.h"
80 
82 
83 #define CACHE_LINE_SIZE (64)
84 
85 typedef struct learner {
89  char pad1[CACHE_LINE_SIZE - sizeof(float*)];
91  char pad2[CACHE_LINE_SIZE - sizeof(float)];
95  char pad4[CACHE_LINE_SIZE - sizeof(list_t*)];
97  char pad5[CACHE_LINE_SIZE - sizeof(long)];
98 } learner_t;
99 
100 
101 /* =============================================================================
102  * learner_alloc
103  * =============================================================================
104  */
105 learner_t*
106 learner_alloc (data_t* dataPtr, adtree_t* adtreePtr, long numThread);
107 
108 
109 /* =============================================================================
110  * learner_free
111  * =============================================================================
112  */
113 void
114 learner_free (learner_t* learnerPtr);
115 
116 
117 /* =============================================================================
118  * learner_run
119  * =============================================================================
120  */
121 void
122 learner_run (learner_t* learnerPtr);
123 
124 
125 /* =============================================================================
126  * learner_score
127  * -- Score entire network
128  * =============================================================================
129  */
130 float
131 learner_score (learner_t* learnerPtr);
132 
133 
134 #endif /* LEARNER_H */
135 
136 
137 /* =============================================================================
138  *
139  * End of learner.h
140  *
141  * =============================================================================
142  */
void learner_free(learner_t *learnerPtr)
Definition: learner.c:278
float * localBaseLogLikelihoods
Definition: learner.h:88
char pad2[CACHE_LINE_SIZE-sizeof(float)]
Definition: learner.h:91
Definition: learner.c:135
adtree_t * adtreePtr
Definition: learner.h:86
char pad5[CACHE_LINE_SIZE-sizeof(long)]
Definition: learner.h:97
char pad4[CACHE_LINE_SIZE-sizeof(list_t *)]
Definition: learner.h:95
void learner_run(learner_t *learnerPtr)
Definition: learner.c:1499
long numTotalParent
Definition: learner.h:96
Definition: net.c:96
Definition: learner.h:85
char pad1[CACHE_LINE_SIZE-sizeof(float *)]
Definition: learner.h:89
Definition: adtree.h:103
char pad3[CACHE_LINE_SIZE-sizeof(learner_task_t *)]
Definition: learner.h:93
list_t * taskListPtr
Definition: learner.h:94
Definition: list.h:93
#define CACHE_LINE_SIZE
Definition: learner.h:83
float learner_score(learner_t *learnerPtr)
Definition: learner.c:1523
struct learner learner_t
net_t * netPtr
Definition: learner.h:87
learner_task_t * tasks
Definition: learner.h:92
float baseLogLikelihood
Definition: learner.h:90
Definition: data.h:80
learner_t * learner_alloc(data_t *dataPtr, adtree_t *adtreePtr, long numThread)
Definition: learner.c:248