-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathclasschatopera_1_1bot_1_1crfsuite_1_1Trainer.html
594 lines (572 loc) · 31.3 KB
/
classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Clause: chatopera::bot::crfsuite::Trainer类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Clause
 <span id="projectnumber">1.0</span>
</div>
<div id="projectbrief">Chatopera Language Understanding Service.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>首页</span></a></li>
<li><a href="pages.html"><span>相关页面</span></a></li>
<li><a href="modules.html"><span>模块</span></a></li>
<li><a href="namespaces.html"><span>命名空间</span></a></li>
<li class="current"><a href="annotated.html"><span>类</span></a></li>
<li><a href="files.html"><span>文件</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="搜索" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>类列表</span></a></li>
<li><a href="classes.html"><span>类索引</span></a></li>
<li><a href="inherits.html"><span>类继承关系</span></a></li>
<li><a href="functions.html"><span>类成员</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacechatopera.html">chatopera</a></li><li class="navelem"><b>bot</b></li><li class="navelem"><b>crfsuite</b></li><li class="navelem"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html">Trainer</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public 成员函数</a> |
<a href="#pro-static-methods">静态 Protected 成员函数</a> |
<a href="#pro-attribs">Protected 属性</a> |
<a href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer-members.html">所有成员列表</a> </div>
<div class="headertitle">
<div class="title">chatopera::bot::crfsuite::Trainer类 参考<div class="ingroups"><a class="el" href="group__crfsuite__hpp__api__doc.html">Data structures</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <<a class="el" href="crfsuite__api_8hpp_source.html">crfsuite_api.hpp</a>></code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a47e0b9d2f99b9745c34815493c5bc0c0"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a47e0b9d2f99b9745c34815493c5bc0c0">Trainer</a> ()</td></tr>
<tr class="separator:a47e0b9d2f99b9745c34815493c5bc0c0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aad702690d74bca0e38ef4a4e8f392810"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#aad702690d74bca0e38ef4a4e8f392810">~Trainer</a> ()</td></tr>
<tr class="separator:aad702690d74bca0e38ef4a4e8f392810"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a11e2975f51e34d4d0058a84a40459978"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a11e2975f51e34d4d0058a84a40459978">init</a> ()</td></tr>
<tr class="separator:a11e2975f51e34d4d0058a84a40459978"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad12cec6ca40c552981cd877d3ed53c4c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#ad12cec6ca40c552981cd877d3ed53c4c">clear</a> ()</td></tr>
<tr class="separator:ad12cec6ca40c552981cd877d3ed53c4c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a83647ff7fa0e30c64c04bb1e56a0529f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a83647ff7fa0e30c64c04bb1e56a0529f">append</a> (const <a class="el" href="group__crfsuite__hpp__api__doc.html#ga34f58d96010025b06e985a6710fbfd05">ItemSequence</a> &xseq, const <a class="el" href="group__crfsuite__hpp__api__doc.html#gaf82774957c9896d38894cddd592aa061">StringList</a> &yseq, int group)</td></tr>
<tr class="separator:a83647ff7fa0e30c64c04bb1e56a0529f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a56b387aafec11fd9239391784136abda"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a56b387aafec11fd9239391784136abda">select</a> (const std::string &algorithm, const std::string &type)</td></tr>
<tr class="separator:a56b387aafec11fd9239391784136abda"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a792e40b315cc6526a9d951dd9e55e5ee"><td class="memItemLeft" align="right" valign="top">crfsuite_data_t * </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a792e40b315cc6526a9d951dd9e55e5ee">pdata</a> ()</td></tr>
<tr class="separator:a792e40b315cc6526a9d951dd9e55e5ee"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8b95b93e0f76623f8d3c8cd9ab414871"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a8b95b93e0f76623f8d3c8cd9ab414871">read_data</a> (const std::string &filepath, int group=0)</td></tr>
<tr class="separator:a8b95b93e0f76623f8d3c8cd9ab414871"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aeaacda20768776e7f99f8a672b6123b3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#aeaacda20768776e7f99f8a672b6123b3">train</a> (const std::string &model, int holdout)</td></tr>
<tr class="separator:aeaacda20768776e7f99f8a672b6123b3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad64da31f7d1893927085a90809ad69e0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__crfsuite__hpp__api__doc.html#gaf82774957c9896d38894cddd592aa061">StringList</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#ad64da31f7d1893927085a90809ad69e0">params</a> ()</td></tr>
<tr class="separator:ad64da31f7d1893927085a90809ad69e0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac4e2cdffbfb268c2a320c0099f91494a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#ac4e2cdffbfb268c2a320c0099f91494a">set</a> (const std::string &name, const std::string &value)</td></tr>
<tr class="separator:ac4e2cdffbfb268c2a320c0099f91494a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a74ba4064ce086a43070e0a96147e111d"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a74ba4064ce086a43070e0a96147e111d">get</a> (const std::string &name)</td></tr>
<tr class="separator:a74ba4064ce086a43070e0a96147e111d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab60d99375d698c0db0aea5ec4d57cb00"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#ab60d99375d698c0db0aea5ec4d57cb00">help</a> (const std::string &name)</td></tr>
<tr class="separator:ab60d99375d698c0db0aea5ec4d57cb00"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aacae96619f05e4a497c995df5805d50a"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#aacae96619f05e4a497c995df5805d50a">message</a> (const std::string &msg)</td></tr>
<tr class="separator:aacae96619f05e4a497c995df5805d50a"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-static-methods"></a>
静态 Protected 成员函数</h2></td></tr>
<tr class="memitem:a6abf746d57f050dc3d20185de8038fac"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6abf746d57f050dc3d20185de8038fac"></a>
static int </td><td class="memItemRight" valign="bottom"><b>__logging_callback</b> (void *userdata, const char *format, va_list args)</td></tr>
<tr class="separator:a6abf746d57f050dc3d20185de8038fac"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected 属性</h2></td></tr>
<tr class="memitem:a4242e43aa2aeda1e07958a82dac827f3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4242e43aa2aeda1e07958a82dac827f3"></a>
crfsuite_data_t * </td><td class="memItemRight" valign="bottom"><b>data</b></td></tr>
<tr class="separator:a4242e43aa2aeda1e07958a82dac827f3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af26320a43ae93006f11fb7f07c1bc570"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af26320a43ae93006f11fb7f07c1bc570"></a>
crfsuite_trainer_t * </td><td class="memItemRight" valign="bottom"><b>tr</b></td></tr>
<tr class="separator:af26320a43ae93006f11fb7f07c1bc570"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>The trainer class. This class maintains a data set for training, and provides an interface to various graphical models and training algorithms. The standard procedure for implementing a trainer is:</p><ul>
<li>create a class by inheriting this class</li>
<li>overwrite <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#aacae96619f05e4a497c995df5805d50a">message()</a> function to receive messages of training progress</li>
<li>call <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a83647ff7fa0e30c64c04bb1e56a0529f">append()</a> to append item/label sequences to the training set</li>
<li>call <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a56b387aafec11fd9239391784136abda">select()</a> to specify a graphical model and an algorithm</li>
<li>call <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#ac4e2cdffbfb268c2a320c0099f91494a">set()</a> to configure parameters specific to the model and algorithm</li>
<li>call <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#aeaacda20768776e7f99f8a672b6123b3">train()</a> to start a training process with the current setting </li>
</ul>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a class="anchor" id="a47e0b9d2f99b9745c34815493c5bc0c0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">chatopera::bot::crfsuite::Trainer::Trainer </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a trainer. </p>
</div>
</div>
<a class="anchor" id="aad702690d74bca0e38ef4a4e8f392810"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">chatopera::bot::crfsuite::Trainer::~Trainer </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Destruct a trainer. </p>
</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a class="anchor" id="a83647ff7fa0e30c64c04bb1e56a0529f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void chatopera::bot::crfsuite::Trainer::append </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__crfsuite__hpp__api__doc.html#ga34f58d96010025b06e985a6710fbfd05">ItemSequence</a> & </td>
<td class="paramname"><em>xseq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__crfsuite__hpp__api__doc.html#gaf82774957c9896d38894cddd592aa061">StringList</a> & </td>
<td class="paramname"><em>yseq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>group</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Append an instance (item/label sequence) to the data set. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">xseq</td><td>The item sequence of the instance. </td></tr>
<tr><td class="paramname">yseq</td><td>The label sequence of the instance. The number of elements in yseq must be identical to that in xseq. </td></tr>
<tr><td class="paramname">group</td><td>The group number of the instance. </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>异常</dt><dd>
<table class="exception">
<tr><td class="paramname">std::invalid_argument</td><td>Arguments xseq and yseq are invalid. </td></tr>
<tr><td class="paramname">std::runtime_error</td><td>Out of memory. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ad12cec6ca40c552981cd877d3ed53c4c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void chatopera::bot::crfsuite::Trainer::clear </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove all instances in the data set. </p>
</div>
</div>
<a class="anchor" id="a74ba4064ce086a43070e0a96147e111d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string chatopera::bot::crfsuite::Trainer::get </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>name</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the value of a training parameter. This function gets a parameter value for the graphical model and training algorithm specified by <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a56b387aafec11fd9239391784136abda">select()</a> function. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">name</td><td>The parameter name. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>std::string The value of the parameter. </dd></dl>
<dl class="exception"><dt>异常</dt><dd>
<table class="exception">
<tr><td class="paramname">std::invalid_argument</td><td>The parameter is not found. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ab60d99375d698c0db0aea5ec4d57cb00"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string chatopera::bot::crfsuite::Trainer::help </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>name</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the description of a training parameter. This function obtains the help message for the parameter specified by the name. The graphical model and training algorithm must be selected by <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a56b387aafec11fd9239391784136abda">select()</a> function before calling this function. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">name</td><td>The parameter name. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>std::string The description (help message) of the parameter. </dd></dl>
</div>
</div>
<a class="anchor" id="a11e2975f51e34d4d0058a84a40459978"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void chatopera::bot::crfsuite::Trainer::init </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Init, call after select </p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a11e2975f51e34d4d0058a84a40459978_icgraph.png" border="0" usemap="#classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a11e2975f51e34d4d0058a84a40459978_icgraph" alt=""/></div>
<map name="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a11e2975f51e34d4d0058a84a40459978_icgraph" id="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a11e2975f51e34d4d0058a84a40459978_icgraph">
<area shape="rect" id="node2" href="classchatopera_1_1bot_1_1intent_1_1Trainer.html#a716714ea065d83a00231a188ef9d0a6c" title="chatopera::bot::intent\l::Trainer::train" alt="" coords="224,5,385,47"/>
</map>
</div>
</p>
</div>
</div>
<a class="anchor" id="aacae96619f05e4a497c995df5805d50a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void chatopera::bot::crfsuite::Trainer::message </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>msg</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Receive messages from the training algorithm. Override this member function to receive messages of the training process. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">msg</td><td>The message </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ad64da31f7d1893927085a90809ad69e0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__crfsuite__hpp__api__doc.html#gaf82774957c9896d38894cddd592aa061">StringList</a> chatopera::bot::crfsuite::Trainer::params </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Obtain the list of parameters. This function returns the list of parameter names available for the graphical model and training algorithm specified by <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a56b387aafec11fd9239391784136abda">select()</a> function. </p><dl class="section return"><dt>返回</dt><dd>StringList The list of parameters available for the current graphical model and training algorithm. </dd></dl>
</div>
</div>
<a class="anchor" id="a792e40b315cc6526a9d951dd9e55e5ee"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">crfsuite_data_t * chatopera::bot::crfsuite::Trainer::pdata </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get crfsuite_data_t pointer</p>
<p>Get data pointer </p>
</div>
</div>
<a class="anchor" id="a8b95b93e0f76623f8d3c8cd9ab414871"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool chatopera::bot::crfsuite::Trainer::read_data </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>filepath</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>group</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read data for traing in IWA format.</p>
<p>Read data for training </p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a8b95b93e0f76623f8d3c8cd9ab414871_icgraph.png" border="0" usemap="#classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a8b95b93e0f76623f8d3c8cd9ab414871_icgraph" alt=""/></div>
<map name="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a8b95b93e0f76623f8d3c8cd9ab414871_icgraph" id="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a8b95b93e0f76623f8d3c8cd9ab414871_icgraph">
<area shape="rect" id="node2" href="classchatopera_1_1bot_1_1intent_1_1Trainer.html#a716714ea065d83a00231a188ef9d0a6c" title="chatopera::bot::intent\l::Trainer::train" alt="" coords="224,5,385,47"/>
</map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a56b387aafec11fd9239391784136abda"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool chatopera::bot::crfsuite::Trainer::select </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>algorithm</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>type</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialize the training algorithm. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">algorithm</td><td>The name of the training algorithm. </td></tr>
<tr><td class="paramname">type</td><td>The name of the graphical model. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>bool <code>true</code> if the training algorithm is successfully initialized, <code>false</code> otherwise. </dd></dl>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a56b387aafec11fd9239391784136abda_icgraph.png" border="0" usemap="#classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a56b387aafec11fd9239391784136abda_icgraph" alt=""/></div>
<map name="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a56b387aafec11fd9239391784136abda_icgraph" id="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_a56b387aafec11fd9239391784136abda_icgraph">
<area shape="rect" id="node2" href="classchatopera_1_1bot_1_1intent_1_1Trainer.html#a716714ea065d83a00231a188ef9d0a6c" title="chatopera::bot::intent\l::Trainer::train" alt="" coords="224,5,385,47"/>
</map>
</div>
</p>
</div>
</div>
<a class="anchor" id="ac4e2cdffbfb268c2a320c0099f91494a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void chatopera::bot::crfsuite::Trainer::set </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set a training parameter. This function sets a parameter value for the graphical model and training algorithm specified by <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a56b387aafec11fd9239391784136abda">select()</a> function. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">name</td><td>The parameter name. </td></tr>
<tr><td class="paramname">value</td><td>The value of the parameter. </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>异常</dt><dd>
<table class="exception">
<tr><td class="paramname">std::invalid_argument</td><td>The parameter is not found. </td></tr>
</table>
</dd>
</dl>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_ac4e2cdffbfb268c2a320c0099f91494a_icgraph.png" border="0" usemap="#classchatopera_1_1bot_1_1crfsuite_1_1Trainer_ac4e2cdffbfb268c2a320c0099f91494a_icgraph" alt=""/></div>
<map name="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_ac4e2cdffbfb268c2a320c0099f91494a_icgraph" id="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_ac4e2cdffbfb268c2a320c0099f91494a_icgraph">
<area shape="rect" id="node2" href="classchatopera_1_1bot_1_1intent_1_1Trainer.html#a716714ea065d83a00231a188ef9d0a6c" title="chatopera::bot::intent\l::Trainer::train" alt="" coords="224,5,385,47"/>
</map>
</div>
</p>
</div>
</div>
<a class="anchor" id="aeaacda20768776e7f99f8a672b6123b3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int chatopera::bot::crfsuite::Trainer::train </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"><em>model</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>holdout</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Run the training algorithm. This function starts the training algorithm with the data set given by <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#a83647ff7fa0e30c64c04bb1e56a0529f">append()</a> function. After starting the training process, the training algorithm invokes the virtual function <a class="el" href="classchatopera_1_1bot_1_1crfsuite_1_1Trainer.html#aacae96619f05e4a497c995df5805d50a">message()</a> to report the progress of the training process. </p><dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">model</td><td>The filename to which the trained model is stored. If this value is empty, this function does not write out a model file. </td></tr>
<tr><td class="paramname">holdout</td><td>The group number of holdout evaluation. The instances with this group number will not be used for training, but for holdout evaluation. Specify <code>-1</code> to use all instances for training. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>int The status code. </dd></dl>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_aeaacda20768776e7f99f8a672b6123b3_icgraph.png" border="0" usemap="#classchatopera_1_1bot_1_1crfsuite_1_1Trainer_aeaacda20768776e7f99f8a672b6123b3_icgraph" alt=""/></div>
<map name="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_aeaacda20768776e7f99f8a672b6123b3_icgraph" id="classchatopera_1_1bot_1_1crfsuite_1_1Trainer_aeaacda20768776e7f99f8a672b6123b3_icgraph">
<area shape="rect" id="node2" href="classchatopera_1_1bot_1_1intent_1_1Trainer.html#a716714ea065d83a00231a188ef9d0a6c" title="chatopera::bot::intent\l::Trainer::train" alt="" coords="224,5,385,47"/>
</map>
</div>
</p>
</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>src/ner/src/<a class="el" href="crfsuite__api_8hpp_source.html">crfsuite_api.hpp</a></li>
<li>src/ner/src/<a class="el" href="crfsuite_8hpp_source.html">crfsuite.hpp</a></li>
</ul>
</div><!-- contents -->
<address class="footer">
<small>
Copyright (c) (2019-2020) <a href="https://www.chatopera.com">
北京华夏春松科技有限公司
</a>. All Rights Reserved
</small>
</address>