opener-opinion-detector-base 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +101 -0
  3. data/bin/opinion-detector-base +19 -0
  4. data/core/annotation.cfg.erb +9 -0
  5. data/core/packages/KafNafParser-1.4.tar.gz +0 -0
  6. data/core/packages/VUA_pylib-1.5.tar.gz +0 -0
  7. data/core/python-scripts/LICENSE +339 -0
  8. data/core/python-scripts/README.md +226 -0
  9. data/core/python-scripts/classify_kaf_naf_file.py +499 -0
  10. data/core/python-scripts/cross_validation.py +634 -0
  11. data/core/python-scripts/generate_folds.py +134 -0
  12. data/core/python-scripts/models.cfg +10 -0
  13. data/core/python-scripts/my_templates/README +33 -0
  14. data/core/python-scripts/my_templates/templates_exp.only0.txt +6 -0
  15. data/core/python-scripts/my_templates/templates_exp.pol0.txt +10 -0
  16. data/core/python-scripts/my_templates/templates_exp.red.txt +7 -0
  17. data/core/python-scripts/my_templates/templates_exp.txt +10 -0
  18. data/core/python-scripts/my_templates/templates_holder.only0.txt +11 -0
  19. data/core/python-scripts/my_templates/templates_holder.red.txt +9 -0
  20. data/core/python-scripts/my_templates/templates_holder.txt +10 -0
  21. data/core/python-scripts/my_templates/templates_target.only0.txt +11 -0
  22. data/core/python-scripts/my_templates/templates_target.red.txt +9 -0
  23. data/core/python-scripts/my_templates/templates_target.txt +10 -0
  24. data/core/python-scripts/run_all_experiments.sh +49 -0
  25. data/core/python-scripts/run_basic.py +20 -0
  26. data/core/python-scripts/run_experiment.sh +42 -0
  27. data/core/python-scripts/scripts/__init__.py +1 -0
  28. data/core/python-scripts/scripts/config_manager.py +314 -0
  29. data/core/python-scripts/scripts/crfutils.py +215 -0
  30. data/core/python-scripts/scripts/extract_feats_relations.py +295 -0
  31. data/core/python-scripts/scripts/extract_features.py +376 -0
  32. data/core/python-scripts/scripts/feats_to_crf.exp.py +105 -0
  33. data/core/python-scripts/scripts/lexicons.py +44 -0
  34. data/core/python-scripts/scripts/link_entities_distance.py +77 -0
  35. data/core/python-scripts/scripts/relation_classifier.py +250 -0
  36. data/core/python-scripts/train.py +566 -0
  37. data/core/site-packages/pre_build/KafNafParser-1.4-py2.7.egg-info/PKG-INFO +10 -0
  38. data/core/site-packages/pre_build/KafNafParser-1.4-py2.7.egg-info/SOURCES.txt +22 -0
  39. data/core/site-packages/pre_build/KafNafParser-1.4-py2.7.egg-info/dependency_links.txt +1 -0
  40. data/core/site-packages/pre_build/KafNafParser-1.4-py2.7.egg-info/installed-files.txt +47 -0
  41. data/core/site-packages/pre_build/KafNafParser-1.4-py2.7.egg-info/top_level.txt +1 -0
  42. data/core/site-packages/pre_build/KafNafParser/KafNafParserMod.py +390 -0
  43. data/core/site-packages/pre_build/KafNafParser/KafNafParserMod.pyc +0 -0
  44. data/core/site-packages/pre_build/KafNafParser/__init__.py +14 -0
  45. data/core/site-packages/pre_build/KafNafParser/__init__.pyc +0 -0
  46. data/core/site-packages/pre_build/KafNafParser/constituency_data.py +125 -0
  47. data/core/site-packages/pre_build/KafNafParser/constituency_data.pyc +0 -0
  48. data/core/site-packages/pre_build/KafNafParser/coreference_data.py +52 -0
  49. data/core/site-packages/pre_build/KafNafParser/coreference_data.pyc +0 -0
  50. data/core/site-packages/pre_build/KafNafParser/dependency_data.py +78 -0
  51. data/core/site-packages/pre_build/KafNafParser/dependency_data.pyc +0 -0
  52. data/core/site-packages/pre_build/KafNafParser/entity_data.py +59 -0
  53. data/core/site-packages/pre_build/KafNafParser/entity_data.pyc +0 -0
  54. data/core/site-packages/pre_build/KafNafParser/external_references_data.py +41 -0
  55. data/core/site-packages/pre_build/KafNafParser/external_references_data.pyc +0 -0
  56. data/core/site-packages/pre_build/KafNafParser/feature_extractor/__init__.py +2 -0
  57. data/core/site-packages/pre_build/KafNafParser/feature_extractor/__init__.pyc +0 -0
  58. data/core/site-packages/pre_build/KafNafParser/feature_extractor/constituency.py +205 -0
  59. data/core/site-packages/pre_build/KafNafParser/feature_extractor/constituency.pyc +0 -0
  60. data/core/site-packages/pre_build/KafNafParser/feature_extractor/dependency.py +309 -0
  61. data/core/site-packages/pre_build/KafNafParser/feature_extractor/dependency.pyc +0 -0
  62. data/core/site-packages/pre_build/KafNafParser/features_data.py +131 -0
  63. data/core/site-packages/pre_build/KafNafParser/features_data.pyc +0 -0
  64. data/core/site-packages/pre_build/KafNafParser/header_data.py +127 -0
  65. data/core/site-packages/pre_build/KafNafParser/header_data.pyc +0 -0
  66. data/core/site-packages/pre_build/KafNafParser/opinion_data.py +211 -0
  67. data/core/site-packages/pre_build/KafNafParser/opinion_data.pyc +0 -0
  68. data/core/site-packages/pre_build/KafNafParser/references_data.py +23 -0
  69. data/core/site-packages/pre_build/KafNafParser/references_data.pyc +0 -0
  70. data/core/site-packages/pre_build/KafNafParser/span_data.py +63 -0
  71. data/core/site-packages/pre_build/KafNafParser/span_data.pyc +0 -0
  72. data/core/site-packages/pre_build/KafNafParser/term_data.py +111 -0
  73. data/core/site-packages/pre_build/KafNafParser/term_data.pyc +0 -0
  74. data/core/site-packages/pre_build/KafNafParser/term_sentiment_data.py +42 -0
  75. data/core/site-packages/pre_build/KafNafParser/term_sentiment_data.pyc +0 -0
  76. data/core/site-packages/pre_build/KafNafParser/text_data.py +99 -0
  77. data/core/site-packages/pre_build/KafNafParser/text_data.pyc +0 -0
  78. data/core/site-packages/pre_build/VUA_pylib-1.5-py2.7.egg-info/PKG-INFO +10 -0
  79. data/core/site-packages/pre_build/VUA_pylib-1.5-py2.7.egg-info/SOURCES.txt +14 -0
  80. data/core/site-packages/pre_build/VUA_pylib-1.5-py2.7.egg-info/dependency_links.txt +1 -0
  81. data/core/site-packages/pre_build/VUA_pylib-1.5-py2.7.egg-info/installed-files.txt +23 -0
  82. data/core/site-packages/pre_build/VUA_pylib-1.5-py2.7.egg-info/top_level.txt +1 -0
  83. data/core/site-packages/pre_build/VUA_pylib/__init__.py +1 -0
  84. data/core/site-packages/pre_build/VUA_pylib/__init__.pyc +0 -0
  85. data/core/site-packages/pre_build/VUA_pylib/common/__init__.py +1 -0
  86. data/core/site-packages/pre_build/VUA_pylib/common/__init__.pyc +0 -0
  87. data/core/site-packages/pre_build/VUA_pylib/common/common.py +28 -0
  88. data/core/site-packages/pre_build/VUA_pylib/common/common.pyc +0 -0
  89. data/core/site-packages/pre_build/VUA_pylib/corpus_reader/__init__.py +1 -0
  90. data/core/site-packages/pre_build/VUA_pylib/corpus_reader/__init__.pyc +0 -0
  91. data/core/site-packages/pre_build/VUA_pylib/corpus_reader/google_web_nl.py +156 -0
  92. data/core/site-packages/pre_build/VUA_pylib/corpus_reader/google_web_nl.pyc +0 -0
  93. data/core/site-packages/pre_build/VUA_pylib/io_utils/__init__.py +1 -0
  94. data/core/site-packages/pre_build/VUA_pylib/io_utils/__init__.pyc +0 -0
  95. data/core/site-packages/pre_build/VUA_pylib/io_utils/feature_file.py +121 -0
  96. data/core/site-packages/pre_build/VUA_pylib/io_utils/feature_file.pyc +0 -0
  97. data/core/site-packages/pre_build/VUA_pylib/lexicon/__init__.py +1 -0
  98. data/core/site-packages/pre_build/VUA_pylib/lexicon/__init__.pyc +0 -0
  99. data/core/site-packages/pre_build/VUA_pylib/lexicon/lexicon.py +72 -0
  100. data/core/site-packages/pre_build/VUA_pylib/lexicon/lexicon.pyc +0 -0
  101. data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/PKG-INFO +10 -0
  102. data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/SOURCES.txt +7 -0
  103. data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/dependency_links.txt +1 -0
  104. data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/installed-files.txt +11 -0
  105. data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/top_level.txt +1 -0
  106. data/core/site-packages/pre_build/VUKafParserPy/KafDataObjectsMod.py +165 -0
  107. data/core/site-packages/pre_build/VUKafParserPy/KafDataObjectsMod.pyc +0 -0
  108. data/core/site-packages/pre_build/VUKafParserPy/KafParserMod.py +439 -0
  109. data/core/site-packages/pre_build/VUKafParserPy/KafParserMod.pyc +0 -0
  110. data/core/site-packages/pre_build/VUKafParserPy/__init__.py +7 -0
  111. data/core/site-packages/pre_build/VUKafParserPy/__init__.pyc +0 -0
  112. data/core/vendor/src/crfsuite/AUTHORS +1 -0
  113. data/core/vendor/src/crfsuite/COPYING +27 -0
  114. data/core/vendor/src/crfsuite/ChangeLog +103 -0
  115. data/core/vendor/src/crfsuite/INSTALL +236 -0
  116. data/core/vendor/src/crfsuite/Makefile.am +19 -0
  117. data/core/vendor/src/crfsuite/Makefile.in +783 -0
  118. data/core/vendor/src/crfsuite/README +183 -0
  119. data/core/vendor/src/crfsuite/aclocal.m4 +9018 -0
  120. data/core/vendor/src/crfsuite/autogen.sh +38 -0
  121. data/core/vendor/src/crfsuite/compile +143 -0
  122. data/core/vendor/src/crfsuite/config.guess +1502 -0
  123. data/core/vendor/src/crfsuite/config.h.in +198 -0
  124. data/core/vendor/src/crfsuite/config.sub +1714 -0
  125. data/core/vendor/src/crfsuite/configure +14273 -0
  126. data/core/vendor/src/crfsuite/configure.in +149 -0
  127. data/core/vendor/src/crfsuite/crfsuite.sln +42 -0
  128. data/core/vendor/src/crfsuite/depcomp +630 -0
  129. data/core/vendor/src/crfsuite/example/chunking.py +49 -0
  130. data/core/vendor/src/crfsuite/example/crfutils.py +179 -0
  131. data/core/vendor/src/crfsuite/example/ner.py +270 -0
  132. data/core/vendor/src/crfsuite/example/pos.py +78 -0
  133. data/core/vendor/src/crfsuite/example/template.py +88 -0
  134. data/core/vendor/src/crfsuite/frontend/Makefile.am +29 -0
  135. data/core/vendor/src/crfsuite/frontend/Makefile.in +640 -0
  136. data/core/vendor/src/crfsuite/frontend/dump.c +116 -0
  137. data/core/vendor/src/crfsuite/frontend/frontend.vcxproj +129 -0
  138. data/core/vendor/src/crfsuite/frontend/iwa.c +273 -0
  139. data/core/vendor/src/crfsuite/frontend/iwa.h +65 -0
  140. data/core/vendor/src/crfsuite/frontend/learn.c +439 -0
  141. data/core/vendor/src/crfsuite/frontend/main.c +137 -0
  142. data/core/vendor/src/crfsuite/frontend/option.c +93 -0
  143. data/core/vendor/src/crfsuite/frontend/option.h +86 -0
  144. data/core/vendor/src/crfsuite/frontend/readdata.h +38 -0
  145. data/core/vendor/src/crfsuite/frontend/reader.c +136 -0
  146. data/core/vendor/src/crfsuite/frontend/tag.c +427 -0
  147. data/core/vendor/src/crfsuite/genbinary.sh.in +15 -0
  148. data/core/vendor/src/crfsuite/include/Makefile.am +11 -0
  149. data/core/vendor/src/crfsuite/include/Makefile.in +461 -0
  150. data/core/vendor/src/crfsuite/include/crfsuite.h +1063 -0
  151. data/core/vendor/src/crfsuite/include/crfsuite.hpp +555 -0
  152. data/core/vendor/src/crfsuite/include/crfsuite_api.hpp +400 -0
  153. data/core/vendor/src/crfsuite/include/os.h +61 -0
  154. data/core/vendor/src/crfsuite/install-sh +520 -0
  155. data/core/vendor/src/crfsuite/lib/cqdb/COPYING +28 -0
  156. data/core/vendor/src/crfsuite/lib/cqdb/Makefile.am +21 -0
  157. data/core/vendor/src/crfsuite/lib/cqdb/Makefile.in +549 -0
  158. data/core/vendor/src/crfsuite/lib/cqdb/cqdb.vcxproj +86 -0
  159. data/core/vendor/src/crfsuite/lib/cqdb/include/cqdb.h +524 -0
  160. data/core/vendor/src/crfsuite/lib/cqdb/src/cqdb.c +587 -0
  161. data/core/vendor/src/crfsuite/lib/cqdb/src/lookup3.c +976 -0
  162. data/core/vendor/src/crfsuite/lib/crf/Makefile.am +46 -0
  163. data/core/vendor/src/crfsuite/lib/crf/Makefile.in +721 -0
  164. data/core/vendor/src/crfsuite/lib/crf/crf.vcxproj +216 -0
  165. data/core/vendor/src/crfsuite/lib/crf/src/crf1d.h +353 -0
  166. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_context.c +705 -0
  167. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_encode.c +943 -0
  168. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_feature.c +352 -0
  169. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_model.c +994 -0
  170. data/core/vendor/src/crfsuite/lib/crf/src/crf1d_tag.c +550 -0
  171. data/core/vendor/src/crfsuite/lib/crf/src/crfsuite.c +492 -0
  172. data/core/vendor/src/crfsuite/lib/crf/src/crfsuite_internal.h +236 -0
  173. data/core/vendor/src/crfsuite/lib/crf/src/crfsuite_train.c +272 -0
  174. data/core/vendor/src/crfsuite/lib/crf/src/dataset.c +106 -0
  175. data/core/vendor/src/crfsuite/lib/crf/src/dictionary.c +118 -0
  176. data/core/vendor/src/crfsuite/lib/crf/src/holdout.c +80 -0
  177. data/core/vendor/src/crfsuite/lib/crf/src/logging.c +91 -0
  178. data/core/vendor/src/crfsuite/lib/crf/src/logging.h +48 -0
  179. data/core/vendor/src/crfsuite/lib/crf/src/params.c +335 -0
  180. data/core/vendor/src/crfsuite/lib/crf/src/params.h +80 -0
  181. data/core/vendor/src/crfsuite/lib/crf/src/quark.c +172 -0
  182. data/core/vendor/src/crfsuite/lib/crf/src/quark.h +46 -0
  183. data/core/vendor/src/crfsuite/lib/crf/src/rumavl.c +1107 -0
  184. data/core/vendor/src/crfsuite/lib/crf/src/rumavl.h +160 -0
  185. data/core/vendor/src/crfsuite/lib/crf/src/train_arow.c +408 -0
  186. data/core/vendor/src/crfsuite/lib/crf/src/train_averaged_perceptron.c +242 -0
  187. data/core/vendor/src/crfsuite/lib/crf/src/train_l2sgd.c +507 -0
  188. data/core/vendor/src/crfsuite/lib/crf/src/train_lbfgs.c +338 -0
  189. data/core/vendor/src/crfsuite/lib/crf/src/train_passive_aggressive.c +435 -0
  190. data/core/vendor/src/crfsuite/lib/crf/src/vecmath.h +341 -0
  191. data/core/vendor/src/crfsuite/ltmain.sh +8413 -0
  192. data/core/vendor/src/crfsuite/missing +376 -0
  193. data/core/vendor/src/crfsuite/swig/Makefile.am +13 -0
  194. data/core/vendor/src/crfsuite/swig/Makefile.in +365 -0
  195. data/core/vendor/src/crfsuite/swig/crfsuite.cpp +2 -0
  196. data/core/vendor/src/crfsuite/swig/export.i +32 -0
  197. data/core/vendor/src/crfsuite/swig/python/README +92 -0
  198. data/core/vendor/src/crfsuite/swig/python/crfsuite.py +329 -0
  199. data/core/vendor/src/crfsuite/swig/python/export_wrap.cpp +14355 -0
  200. data/core/vendor/src/crfsuite/swig/python/export_wrap.h +63 -0
  201. data/core/vendor/src/crfsuite/swig/python/prepare.sh +9 -0
  202. data/core/vendor/src/crfsuite/swig/python/sample_tag.py +52 -0
  203. data/core/vendor/src/crfsuite/swig/python/sample_train.py +68 -0
  204. data/core/vendor/src/crfsuite/swig/python/setup.py +44 -0
  205. data/core/vendor/src/crfsuite/win32/stdint.h +679 -0
  206. data/core/vendor/src/liblbfgs/AUTHORS +1 -0
  207. data/core/vendor/src/liblbfgs/COPYING +22 -0
  208. data/core/vendor/src/liblbfgs/ChangeLog +120 -0
  209. data/core/vendor/src/liblbfgs/INSTALL +231 -0
  210. data/core/vendor/src/liblbfgs/Makefile.am +10 -0
  211. data/core/vendor/src/liblbfgs/Makefile.in +638 -0
  212. data/core/vendor/src/liblbfgs/NEWS +0 -0
  213. data/core/vendor/src/liblbfgs/README +71 -0
  214. data/core/vendor/src/liblbfgs/aclocal.m4 +6985 -0
  215. data/core/vendor/src/liblbfgs/autogen.sh +38 -0
  216. data/core/vendor/src/liblbfgs/config.guess +1411 -0
  217. data/core/vendor/src/liblbfgs/config.h.in +64 -0
  218. data/core/vendor/src/liblbfgs/config.sub +1500 -0
  219. data/core/vendor/src/liblbfgs/configure +21146 -0
  220. data/core/vendor/src/liblbfgs/configure.in +107 -0
  221. data/core/vendor/src/liblbfgs/depcomp +522 -0
  222. data/core/vendor/src/liblbfgs/include/lbfgs.h +745 -0
  223. data/core/vendor/src/liblbfgs/install-sh +322 -0
  224. data/core/vendor/src/liblbfgs/lbfgs.sln +26 -0
  225. data/core/vendor/src/liblbfgs/lib/Makefile.am +24 -0
  226. data/core/vendor/src/liblbfgs/lib/Makefile.in +499 -0
  227. data/core/vendor/src/liblbfgs/lib/arithmetic_ansi.h +133 -0
  228. data/core/vendor/src/liblbfgs/lib/arithmetic_sse_double.h +294 -0
  229. data/core/vendor/src/liblbfgs/lib/arithmetic_sse_float.h +298 -0
  230. data/core/vendor/src/liblbfgs/lib/lbfgs.c +1371 -0
  231. data/core/vendor/src/liblbfgs/lib/lib.vcxproj +95 -0
  232. data/core/vendor/src/liblbfgs/ltmain.sh +6426 -0
  233. data/core/vendor/src/liblbfgs/missing +353 -0
  234. data/core/vendor/src/liblbfgs/sample/Makefile.am +15 -0
  235. data/core/vendor/src/liblbfgs/sample/Makefile.in +433 -0
  236. data/core/vendor/src/liblbfgs/sample/sample.c +81 -0
  237. data/core/vendor/src/liblbfgs/sample/sample.cpp +126 -0
  238. data/core/vendor/src/liblbfgs/sample/sample.vcxproj +105 -0
  239. data/core/vendor/src/svm_light/LICENSE.txt +59 -0
  240. data/core/vendor/src/svm_light/Makefile +105 -0
  241. data/core/vendor/src/svm_light/kernel.h +40 -0
  242. data/core/vendor/src/svm_light/svm_classify.c +197 -0
  243. data/core/vendor/src/svm_light/svm_common.c +985 -0
  244. data/core/vendor/src/svm_light/svm_common.h +301 -0
  245. data/core/vendor/src/svm_light/svm_hideo.c +1062 -0
  246. data/core/vendor/src/svm_light/svm_learn.c +4147 -0
  247. data/core/vendor/src/svm_light/svm_learn.h +169 -0
  248. data/core/vendor/src/svm_light/svm_learn_main.c +397 -0
  249. data/core/vendor/src/svm_light/svm_loqo.c +211 -0
  250. data/ext/hack/Rakefile +17 -0
  251. data/ext/hack/support.rb +88 -0
  252. data/lib/opener/opinion_detectors/base.rb +112 -0
  253. data/lib/opener/opinion_detectors/base/version.rb +7 -0
  254. data/lib/opener/opinion_detectors/configuration_creator.rb +86 -0
  255. data/lib/opener/opinion_detectors/de.rb +7 -0
  256. data/lib/opener/opinion_detectors/en.rb +7 -0
  257. data/lib/opener/opinion_detectors/it.rb +7 -0
  258. data/lib/opener/opinion_detectors/nl.rb +6 -0
  259. data/opener-opinion-detector-base.gemspec +35 -0
  260. data/pre_build_requirements.txt +3 -0
  261. metadata +374 -0
@@ -0,0 +1,745 @@
1
+ /*
2
+ * C library of Limited memory BFGS (L-BFGS).
3
+ *
4
+ * Copyright (c) 1990, Jorge Nocedal
5
+ * Copyright (c) 2007-2010 Naoaki Okazaki
6
+ * All rights reserved.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ /* $Id$ */
28
+
29
+ #ifndef __LBFGS_H__
30
+ #define __LBFGS_H__
31
+
32
+ #ifdef __cplusplus
33
+ extern "C" {
34
+ #endif/*__cplusplus*/
35
+
36
+ /*
37
+ * The default precision of floating point values is 64bit (double).
38
+ */
39
+ #ifndef LBFGS_FLOAT
40
+ #define LBFGS_FLOAT 64
41
+ #endif/*LBFGS_FLOAT*/
42
+
43
+ /*
44
+ * Activate optimization routines for IEEE754 floating point values.
45
+ */
46
+ #ifndef LBFGS_IEEE_FLOAT
47
+ #define LBFGS_IEEE_FLOAT 1
48
+ #endif/*LBFGS_IEEE_FLOAT*/
49
+
50
+ #if LBFGS_FLOAT == 32
51
+ typedef float lbfgsfloatval_t;
52
+
53
+ #elif LBFGS_FLOAT == 64
54
+ typedef double lbfgsfloatval_t;
55
+
56
+ #else
57
+ #error "libLBFGS supports single (float; LBFGS_FLOAT = 32) or double (double; LBFGS_FLOAT=64) precision only."
58
+
59
+ #endif
60
+
61
+
62
+ /**
63
+ * \addtogroup liblbfgs_api libLBFGS API
64
+ * @{
65
+ *
66
+ * The libLBFGS API.
67
+ */
68
+
69
+ /**
70
+ * Return values of lbfgs().
71
+ *
72
+ * Roughly speaking, a negative value indicates an error.
73
+ */
74
+ enum {
75
+ /** L-BFGS reaches convergence. */
76
+ LBFGS_SUCCESS = 0,
77
+ LBFGS_CONVERGENCE = 0,
78
+ LBFGS_STOP,
79
+ /** The initial variables already minimize the objective function. */
80
+ LBFGS_ALREADY_MINIMIZED,
81
+
82
+ /** Unknown error. */
83
+ LBFGSERR_UNKNOWNERROR = -1024,
84
+ /** Logic error. */
85
+ LBFGSERR_LOGICERROR,
86
+ /** Insufficient memory. */
87
+ LBFGSERR_OUTOFMEMORY,
88
+ /** The minimization process has been canceled. */
89
+ LBFGSERR_CANCELED,
90
+ /** Invalid number of variables specified. */
91
+ LBFGSERR_INVALID_N,
92
+ /** Invalid number of variables (for SSE) specified. */
93
+ LBFGSERR_INVALID_N_SSE,
94
+ /** The array x must be aligned to 16 (for SSE). */
95
+ LBFGSERR_INVALID_X_SSE,
96
+ /** Invalid parameter lbfgs_parameter_t::epsilon specified. */
97
+ LBFGSERR_INVALID_EPSILON,
98
+ /** Invalid parameter lbfgs_parameter_t::past specified. */
99
+ LBFGSERR_INVALID_TESTPERIOD,
100
+ /** Invalid parameter lbfgs_parameter_t::delta specified. */
101
+ LBFGSERR_INVALID_DELTA,
102
+ /** Invalid parameter lbfgs_parameter_t::linesearch specified. */
103
+ LBFGSERR_INVALID_LINESEARCH,
104
+ /** Invalid parameter lbfgs_parameter_t::max_step specified. */
105
+ LBFGSERR_INVALID_MINSTEP,
106
+ /** Invalid parameter lbfgs_parameter_t::max_step specified. */
107
+ LBFGSERR_INVALID_MAXSTEP,
108
+ /** Invalid parameter lbfgs_parameter_t::ftol specified. */
109
+ LBFGSERR_INVALID_FTOL,
110
+ /** Invalid parameter lbfgs_parameter_t::wolfe specified. */
111
+ LBFGSERR_INVALID_WOLFE,
112
+ /** Invalid parameter lbfgs_parameter_t::gtol specified. */
113
+ LBFGSERR_INVALID_GTOL,
114
+ /** Invalid parameter lbfgs_parameter_t::xtol specified. */
115
+ LBFGSERR_INVALID_XTOL,
116
+ /** Invalid parameter lbfgs_parameter_t::max_linesearch specified. */
117
+ LBFGSERR_INVALID_MAXLINESEARCH,
118
+ /** Invalid parameter lbfgs_parameter_t::orthantwise_c specified. */
119
+ LBFGSERR_INVALID_ORTHANTWISE,
120
+ /** Invalid parameter lbfgs_parameter_t::orthantwise_start specified. */
121
+ LBFGSERR_INVALID_ORTHANTWISE_START,
122
+ /** Invalid parameter lbfgs_parameter_t::orthantwise_end specified. */
123
+ LBFGSERR_INVALID_ORTHANTWISE_END,
124
+ /** The line-search step went out of the interval of uncertainty. */
125
+ LBFGSERR_OUTOFINTERVAL,
126
+ /** A logic error occurred; alternatively, the interval of uncertainty
127
+ became too small. */
128
+ LBFGSERR_INCORRECT_TMINMAX,
129
+ /** A rounding error occurred; alternatively, no line-search step
130
+ satisfies the sufficient decrease and curvature conditions. */
131
+ LBFGSERR_ROUNDING_ERROR,
132
+ /** The line-search step became smaller than lbfgs_parameter_t::min_step. */
133
+ LBFGSERR_MINIMUMSTEP,
134
+ /** The line-search step became larger than lbfgs_parameter_t::max_step. */
135
+ LBFGSERR_MAXIMUMSTEP,
136
+ /** The line-search routine reaches the maximum number of evaluations. */
137
+ LBFGSERR_MAXIMUMLINESEARCH,
138
+ /** The algorithm routine reaches the maximum number of iterations. */
139
+ LBFGSERR_MAXIMUMITERATION,
140
+ /** Relative width of the interval of uncertainty is at most
141
+ lbfgs_parameter_t::xtol. */
142
+ LBFGSERR_WIDTHTOOSMALL,
143
+ /** A logic error (negative line-search step) occurred. */
144
+ LBFGSERR_INVALIDPARAMETERS,
145
+ /** The current search direction increases the objective function value. */
146
+ LBFGSERR_INCREASEGRADIENT,
147
+ };
148
+
149
+ /**
150
+ * Line search algorithms.
151
+ */
152
+ enum {
153
+ /** The default algorithm (MoreThuente method). */
154
+ LBFGS_LINESEARCH_DEFAULT = 0,
155
+ /** MoreThuente method proposd by More and Thuente. */
156
+ LBFGS_LINESEARCH_MORETHUENTE = 0,
157
+ /**
158
+ * Backtracking method with the Armijo condition.
159
+ * The backtracking method finds the step length such that it satisfies
160
+ * the sufficient decrease (Armijo) condition,
161
+ * - f(x + a * d) <= f(x) + lbfgs_parameter_t::ftol * a * g(x)^T d,
162
+ *
163
+ * where x is the current point, d is the current search direction, and
164
+ * a is the step length.
165
+ */
166
+ LBFGS_LINESEARCH_BACKTRACKING_ARMIJO = 1,
167
+ /** The backtracking method with the defualt (regular Wolfe) condition. */
168
+ LBFGS_LINESEARCH_BACKTRACKING = 2,
169
+ /**
170
+ * Backtracking method with regular Wolfe condition.
171
+ * The backtracking method finds the step length such that it satisfies
172
+ * both the Armijo condition (LBFGS_LINESEARCH_BACKTRACKING_ARMIJO)
173
+ * and the curvature condition,
174
+ * - g(x + a * d)^T d >= lbfgs_parameter_t::wolfe * g(x)^T d,
175
+ *
176
+ * where x is the current point, d is the current search direction, and
177
+ * a is the step length.
178
+ */
179
+ LBFGS_LINESEARCH_BACKTRACKING_WOLFE = 2,
180
+ /**
181
+ * Backtracking method with strong Wolfe condition.
182
+ * The backtracking method finds the step length such that it satisfies
183
+ * both the Armijo condition (LBFGS_LINESEARCH_BACKTRACKING_ARMIJO)
184
+ * and the following condition,
185
+ * - |g(x + a * d)^T d| <= lbfgs_parameter_t::wolfe * |g(x)^T d|,
186
+ *
187
+ * where x is the current point, d is the current search direction, and
188
+ * a is the step length.
189
+ */
190
+ LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE = 3,
191
+ };
192
+
193
+ /**
194
+ * L-BFGS optimization parameters.
195
+ * Call lbfgs_parameter_init() function to initialize parameters to the
196
+ * default values.
197
+ */
198
+ typedef struct {
199
+ /**
200
+ * The number of corrections to approximate the inverse hessian matrix.
201
+ * The L-BFGS routine stores the computation results of previous \ref m
202
+ * iterations to approximate the inverse hessian matrix of the current
203
+ * iteration. This parameter controls the size of the limited memories
204
+ * (corrections). The default value is \c 6. Values less than \c 3 are
205
+ * not recommended. Large values will result in excessive computing time.
206
+ */
207
+ int m;
208
+
209
+ /**
210
+ * Epsilon for convergence test.
211
+ * This parameter determines the accuracy with which the solution is to
212
+ * be found. A minimization terminates when
213
+ * ||g|| < \ref epsilon * max(1, ||x||),
214
+ * where ||.|| denotes the Euclidean (L2) norm. The default value is
215
+ * \c 1e-5.
216
+ */
217
+ lbfgsfloatval_t epsilon;
218
+
219
+ /**
220
+ * Distance for delta-based convergence test.
221
+ * This parameter determines the distance, in iterations, to compute
222
+ * the rate of decrease of the objective function. If the value of this
223
+ * parameter is zero, the library does not perform the delta-based
224
+ * convergence test. The default value is \c 0.
225
+ */
226
+ int past;
227
+
228
+ /**
229
+ * Delta for convergence test.
230
+ * This parameter determines the minimum rate of decrease of the
231
+ * objective function. The library stops iterations when the
232
+ * following condition is met:
233
+ * (f' - f) / f < \ref delta,
234
+ * where f' is the objective value of \ref past iterations ago, and f is
235
+ * the objective value of the current iteration.
236
+ * The default value is \c 0.
237
+ */
238
+ lbfgsfloatval_t delta;
239
+
240
+ /**
241
+ * The maximum number of iterations.
242
+ * The lbfgs() function terminates an optimization process with
243
+ * ::LBFGSERR_MAXIMUMITERATION status code when the iteration count
244
+ * exceedes this parameter. Setting this parameter to zero continues an
245
+ * optimization process until a convergence or error. The default value
246
+ * is \c 0.
247
+ */
248
+ int max_iterations;
249
+
250
+ /**
251
+ * The line search algorithm.
252
+ * This parameter specifies a line search algorithm to be used by the
253
+ * L-BFGS routine.
254
+ */
255
+ int linesearch;
256
+
257
+ /**
258
+ * The maximum number of trials for the line search.
259
+ * This parameter controls the number of function and gradients evaluations
260
+ * per iteration for the line search routine. The default value is \c 20.
261
+ */
262
+ int max_linesearch;
263
+
264
+ /**
265
+ * The minimum step of the line search routine.
266
+ * The default value is \c 1e-20. This value need not be modified unless
267
+ * the exponents are too large for the machine being used, or unless the
268
+ * problem is extremely badly scaled (in which case the exponents should
269
+ * be increased).
270
+ */
271
+ lbfgsfloatval_t min_step;
272
+
273
+ /**
274
+ * The maximum step of the line search.
275
+ * The default value is \c 1e+20. This value need not be modified unless
276
+ * the exponents are too large for the machine being used, or unless the
277
+ * problem is extremely badly scaled (in which case the exponents should
278
+ * be increased).
279
+ */
280
+ lbfgsfloatval_t max_step;
281
+
282
+ /**
283
+ * A parameter to control the accuracy of the line search routine.
284
+ * The default value is \c 1e-4. This parameter should be greater
285
+ * than zero and smaller than \c 0.5.
286
+ */
287
+ lbfgsfloatval_t ftol;
288
+
289
+ /**
290
+ * A coefficient for the Wolfe condition.
291
+ * This parameter is valid only when the backtracking line-search
292
+ * algorithm is used with the Wolfe condition,
293
+ * ::LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE or
294
+ * ::LBFGS_LINESEARCH_BACKTRACKING_WOLFE .
295
+ * The default value is \c 0.9. This parameter should be greater
296
+ * the \ref ftol parameter and smaller than \c 1.0.
297
+ */
298
+ lbfgsfloatval_t wolfe;
299
+
300
+ /**
301
+ * A parameter to control the accuracy of the line search routine.
302
+ * The default value is \c 0.9. If the function and gradient
303
+ * evaluations are inexpensive with respect to the cost of the
304
+ * iteration (which is sometimes the case when solving very large
305
+ * problems) it may be advantageous to set this parameter to a small
306
+ * value. A typical small value is \c 0.1. This parameter shuold be
307
+ * greater than the \ref ftol parameter (\c 1e-4) and smaller than
308
+ * \c 1.0.
309
+ */
310
+ lbfgsfloatval_t gtol;
311
+
312
+ /**
313
+ * The machine precision for floating-point values.
314
+ * This parameter must be a positive value set by a client program to
315
+ * estimate the machine precision. The line search routine will terminate
316
+ * with the status code (::LBFGSERR_ROUNDING_ERROR) if the relative width
317
+ * of the interval of uncertainty is less than this parameter.
318
+ */
319
+ lbfgsfloatval_t xtol;
320
+
321
+ /**
322
+ * Coeefficient for the L1 norm of variables.
323
+ * This parameter should be set to zero for standard minimization
324
+ * problems. Setting this parameter to a positive value activates
325
+ * Orthant-Wise Limited-memory Quasi-Newton (OWL-QN) method, which
326
+ * minimizes the objective function F(x) combined with the L1 norm |x|
327
+ * of the variables, {F(x) + C |x|}. This parameter is the coeefficient
328
+ * for the |x|, i.e., C. As the L1 norm |x| is not differentiable at
329
+ * zero, the library modifies function and gradient evaluations from
330
+ * a client program suitably; a client program thus have only to return
331
+ * the function value F(x) and gradients G(x) as usual. The default value
332
+ * is zero.
333
+ */
334
+ lbfgsfloatval_t orthantwise_c;
335
+
336
+ /**
337
+ * Start index for computing L1 norm of the variables.
338
+ * This parameter is valid only for OWL-QN method
339
+ * (i.e., \ref orthantwise_c != 0). This parameter b (0 <= b < N)
340
+ * specifies the index number from which the library computes the
341
+ * L1 norm of the variables x,
342
+ * |x| := |x_{b}| + |x_{b+1}| + ... + |x_{N}| .
343
+ * In other words, variables x_1, ..., x_{b-1} are not used for
344
+ * computing the L1 norm. Setting b (0 < b < N), one can protect
345
+ * variables, x_1, ..., x_{b-1} (e.g., a bias term of logistic
346
+ * regression) from being regularized. The default value is zero.
347
+ */
348
+ int orthantwise_start;
349
+
350
+ /**
351
+ * End index for computing L1 norm of the variables.
352
+ * This parameter is valid only for OWL-QN method
353
+ * (i.e., \ref orthantwise_c != 0). This parameter e (0 < e <= N)
354
+ * specifies the index number at which the library stops computing the
355
+ * L1 norm of the variables x,
356
+ */
357
+ int orthantwise_end;
358
+ } lbfgs_parameter_t;
359
+
360
+
361
+ /**
362
+ * Callback interface to provide objective function and gradient evaluations.
363
+ *
364
+ * The lbfgs() function call this function to obtain the values of objective
365
+ * function and its gradients when needed. A client program must implement
366
+ * this function to evaluate the values of the objective function and its
367
+ * gradients, given current values of variables.
368
+ *
369
+ * @param instance The user data sent for lbfgs() function by the client.
370
+ * @param x The current values of variables.
371
+ * @param g The gradient vector. The callback function must compute
372
+ * the gradient values for the current variables.
373
+ * @param n The number of variables.
374
+ * @param step The current step of the line search routine.
375
+ * @retval lbfgsfloatval_t The value of the objective function for the current
376
+ * variables.
377
+ */
378
+ typedef lbfgsfloatval_t (*lbfgs_evaluate_t)(
379
+ void *instance,
380
+ const lbfgsfloatval_t *x,
381
+ lbfgsfloatval_t *g,
382
+ const int n,
383
+ const lbfgsfloatval_t step
384
+ );
385
+
386
+ /**
387
+ * Callback interface to receive the progress of the optimization process.
388
+ *
389
+ * The lbfgs() function call this function for each iteration. Implementing
390
+ * this function, a client program can store or display the current progress
391
+ * of the optimization process.
392
+ *
393
+ * @param instance The user data sent for lbfgs() function by the client.
394
+ * @param x The current values of variables.
395
+ * @param g The current gradient values of variables.
396
+ * @param fx The current value of the objective function.
397
+ * @param xnorm The Euclidean norm of the variables.
398
+ * @param gnorm The Euclidean norm of the gradients.
399
+ * @param step The line-search step used for this iteration.
400
+ * @param n The number of variables.
401
+ * @param k The iteration count.
402
+ * @param ls The number of evaluations called for this iteration.
403
+ * @retval int Zero to continue the optimization process. Returning a
404
+ * non-zero value will cancel the optimization process.
405
+ */
406
+ typedef int (*lbfgs_progress_t)(
407
+ void *instance,
408
+ const lbfgsfloatval_t *x,
409
+ const lbfgsfloatval_t *g,
410
+ const lbfgsfloatval_t fx,
411
+ const lbfgsfloatval_t xnorm,
412
+ const lbfgsfloatval_t gnorm,
413
+ const lbfgsfloatval_t step,
414
+ int n,
415
+ int k,
416
+ int ls
417
+ );
418
+
419
+ /*
420
+ A user must implement a function compatible with ::lbfgs_evaluate_t (evaluation
421
+ callback) and pass the pointer to the callback function to lbfgs() arguments.
422
+ Similarly, a user can implement a function compatible with ::lbfgs_progress_t
423
+ (progress callback) to obtain the current progress (e.g., variables, function
424
+ value, ||G||, etc) and to cancel the iteration process if necessary.
425
+ Implementation of a progress callback is optional: a user can pass \c NULL if
426
+ progress notification is not necessary.
427
+
428
+ In addition, a user must preserve two requirements:
429
+ - The number of variables must be multiples of 16 (this is not 4).
430
+ - The memory block of variable array ::x must be aligned to 16.
431
+
432
+ This algorithm terminates an optimization
433
+ when:
434
+
435
+ ||G|| < \epsilon \cdot \max(1, ||x||) .
436
+
437
+ In this formula, ||.|| denotes the Euclidean norm.
438
+ */
439
+
440
+ /**
441
+ * Start a L-BFGS optimization.
442
+ *
443
+ * @param n The number of variables.
444
+ * @param x The array of variables. A client program can set
445
+ * default values for the optimization and receive the
446
+ * optimization result through this array. This array
447
+ * must be allocated by ::lbfgs_malloc function
448
+ * for libLBFGS built with SSE/SSE2 optimization routine
449
+ * enabled. The library built without SSE/SSE2
450
+ * optimization does not have such a requirement.
451
+ * @param ptr_fx The pointer to the variable that receives the final
452
+ * value of the objective function for the variables.
453
+ * This argument can be set to \c NULL if the final
454
+ * value of the objective function is unnecessary.
455
+ * @param proc_evaluate The callback function to provide function and
456
+ * gradient evaluations given a current values of
457
+ * variables. A client program must implement a
458
+ * callback function compatible with \ref
459
+ * lbfgs_evaluate_t and pass the pointer to the
460
+ * callback function.
461
+ * @param proc_progress The callback function to receive the progress
462
+ * (the number of iterations, the current value of
463
+ * the objective function) of the minimization
464
+ * process. This argument can be set to \c NULL if
465
+ * a progress report is unnecessary.
466
+ * @param instance A user data for the client program. The callback
467
+ * functions will receive the value of this argument.
468
+ * @param param The pointer to a structure representing parameters for
469
+ * L-BFGS optimization. A client program can set this
470
+ * parameter to \c NULL to use the default parameters.
471
+ * Call lbfgs_parameter_init() function to fill a
472
+ * structure with the default values.
473
+ * @retval int The status code. This function returns zero if the
474
+ * minimization process terminates without an error. A
475
+ * non-zero value indicates an error.
476
+ */
477
+ int lbfgs(
478
+ int n,
479
+ lbfgsfloatval_t *x,
480
+ lbfgsfloatval_t *ptr_fx,
481
+ lbfgs_evaluate_t proc_evaluate,
482
+ lbfgs_progress_t proc_progress,
483
+ void *instance,
484
+ lbfgs_parameter_t *param
485
+ );
486
+
487
+ /**
488
+ * Initialize L-BFGS parameters to the default values.
489
+ *
490
+ * Call this function to fill a parameter structure with the default values
491
+ * and overwrite parameter values if necessary.
492
+ *
493
+ * @param param The pointer to the parameter structure.
494
+ */
495
+ void lbfgs_parameter_init(lbfgs_parameter_t *param);
496
+
497
+ /**
498
+ * Allocate an array for variables.
499
+ *
500
+ * This function allocates an array of variables for the convenience of
501
+ * ::lbfgs function; the function has a requreiemt for a variable array
502
+ * when libLBFGS is built with SSE/SSE2 optimization routines. A user does
503
+ * not have to use this function for libLBFGS built without SSE/SSE2
504
+ * optimization.
505
+ *
506
+ * @param n The number of variables.
507
+ */
508
+ lbfgsfloatval_t* lbfgs_malloc(int n);
509
+
510
+ /**
511
+ * Free an array of variables.
512
+ *
513
+ * @param x The array of variables allocated by ::lbfgs_malloc
514
+ * function.
515
+ */
516
+ void lbfgs_free(lbfgsfloatval_t *x);
517
+
518
+ /** @} */
519
+
520
+ #ifdef __cplusplus
521
+ }
522
+ #endif/*__cplusplus*/
523
+
524
+
525
+
526
+ /**
527
+ @mainpage libLBFGS: a library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS)
528
+
529
+ @section intro Introduction
530
+
531
+ This library is a C port of the implementation of Limited-memory
532
+ Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method written by Jorge Nocedal.
533
+ The original FORTRAN source code is available at:
534
+ http://www.ece.northwestern.edu/~nocedal/lbfgs.html
535
+
536
+ The L-BFGS method solves the unconstrainted minimization problem,
537
+
538
+ <pre>
539
+ minimize F(x), x = (x1, x2, ..., xN),
540
+ </pre>
541
+
542
+ only if the objective function F(x) and its gradient G(x) are computable. The
543
+ well-known Newton's method requires computation of the inverse of the hessian
544
+ matrix of the objective function. However, the computational cost for the
545
+ inverse hessian matrix is expensive especially when the objective function
546
+ takes a large number of variables. The L-BFGS method iteratively finds a
547
+ minimizer by approximating the inverse hessian matrix by information from last
548
+ m iterations. This innovation saves the memory storage and computational time
549
+ drastically for large-scaled problems.
550
+
551
+ Among the various ports of L-BFGS, this library provides several features:
552
+ - <b>Optimization with L1-norm (Orthant-Wise Limited-memory Quasi-Newton
553
+ (OWL-QN) method)</b>:
554
+ In addition to standard minimization problems, the library can minimize
555
+ a function F(x) combined with L1-norm |x| of the variables,
556
+ {F(x) + C |x|}, where C is a constant scalar parameter. This feature is
557
+ useful for estimating parameters of sparse log-linear models (e.g.,
558
+ logistic regression and maximum entropy) with L1-regularization (or
559
+ Laplacian prior).
560
+ - <b>Clean C code</b>:
561
+ Unlike C codes generated automatically by f2c (Fortran 77 into C converter),
562
+ this port includes changes based on my interpretations, improvements,
563
+ optimizations, and clean-ups so that the ported code would be well-suited
564
+ for a C code. In addition to comments inherited from the original code,
565
+ a number of comments were added through my interpretations.
566
+ - <b>Callback interface</b>:
567
+ The library receives function and gradient values via a callback interface.
568
+ The library also notifies the progress of the optimization by invoking a
569
+ callback function. In the original implementation, a user had to set
570
+ function and gradient values every time the function returns for obtaining
571
+ updated values.
572
+ - <b>Thread safe</b>:
573
+ The library is thread-safe, which is the secondary gain from the callback
574
+ interface.
575
+ - <b>Cross platform.</b> The source code can be compiled on Microsoft Visual
576
+ Studio 2010, GNU C Compiler (gcc), etc.
577
+ - <b>Configurable precision</b>: A user can choose single-precision (float)
578
+ or double-precision (double) accuracy by changing ::LBFGS_FLOAT macro.
579
+ - <b>SSE/SSE2 optimization</b>:
580
+ This library includes SSE/SSE2 optimization (written in compiler intrinsics)
581
+ for vector arithmetic operations on Intel/AMD processors. The library uses
582
+ SSE for float values and SSE2 for double values. The SSE/SSE2 optimization
583
+ routine is disabled by default.
584
+
585
+ This library is used by:
586
+ - <a href="http://www.chokkan.org/software/crfsuite/">CRFsuite: A fast implementation of Conditional Random Fields (CRFs)</a>
587
+ - <a href="http://www.chokkan.org/software/classias/">Classias: A collection of machine-learning algorithms for classification</a>
588
+ - <a href="http://www.public.iastate.edu/~gdancik/mlegp/">mlegp: an R package for maximum likelihood estimates for Gaussian processes</a>
589
+ - <a href="http://infmath.uibk.ac.at/~matthiasf/imaging2/">imaging2: the imaging2 class library</a>
590
+ - <a href="http://search.cpan.org/~laye/Algorithm-LBFGS-0.16/">Algorithm::LBFGS - Perl extension for L-BFGS</a>
591
+ - <a href="http://www.cs.kuleuven.be/~bernd/yap-lbfgs/">YAP-LBFGS (an interface to call libLBFGS from YAP Prolog)</a>
592
+
593
+ @section download Download
594
+
595
+ - <a href="https://github.com/downloads/chokkan/liblbfgs/liblbfgs-1.10.tar.gz">Source code</a>
596
+ - <a href="https://github.com/chokkan/liblbfgs">GitHub repository</a>
597
+
598
+ libLBFGS is distributed under the term of the
599
+ <a href="http://opensource.org/licenses/mit-license.php">MIT license</a>.
600
+
601
+ @section changelog History
602
+ - Version 1.10 (2010-12-22):
603
+ - Fixed compiling errors on Mac OS X; this patch was kindly submitted by
604
+ Nic Schraudolph.
605
+ - Reduced compiling warnings on Mac OS X; this patch was kindly submitted
606
+ by Tamas Nepusz.
607
+ - Replaced memalign() with posix_memalign().
608
+ - Updated solution and project files for Microsoft Visual Studio 2010.
609
+ - Version 1.9 (2010-01-29):
610
+ - Fixed a mistake in checking the validity of the parameters "ftol" and
611
+ "wolfe"; this was discovered by Kevin S. Van Horn.
612
+ - Version 1.8 (2009-07-13):
613
+ - Accepted the patch submitted by Takashi Imamichi;
614
+ the backtracking method now has three criteria for choosing the step
615
+ length:
616
+ - ::LBFGS_LINESEARCH_BACKTRACKING_ARMIJO: sufficient decrease (Armijo)
617
+ condition only
618
+ - ::LBFGS_LINESEARCH_BACKTRACKING_WOLFE: regular Wolfe condition
619
+ (sufficient decrease condition + curvature condition)
620
+ - ::LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE: strong Wolfe condition
621
+ - Updated the documentation to explain the above three criteria.
622
+ - Version 1.7 (2009-02-28):
623
+ - Improved OWL-QN routines for stability.
624
+ - Removed the support of OWL-QN method in MoreThuente algorithm because
625
+ it accidentally fails in early stages of iterations for some objectives.
626
+ Because of this change, <b>the OW-LQN method must be used with the
627
+ backtracking algorithm (::LBFGS_LINESEARCH_BACKTRACKING)</b>, or the
628
+ library returns ::LBFGSERR_INVALID_LINESEARCH.
629
+ - Renamed line search algorithms as follows:
630
+ - ::LBFGS_LINESEARCH_BACKTRACKING: regular Wolfe condition.
631
+ - ::LBFGS_LINESEARCH_BACKTRACKING_LOOSE: regular Wolfe condition.
632
+ - ::LBFGS_LINESEARCH_BACKTRACKING_STRONG: strong Wolfe condition.
633
+ - Source code clean-up.
634
+ - Version 1.6 (2008-11-02):
635
+ - Improved line-search algorithm with strong Wolfe condition, which was
636
+ contributed by Takashi Imamichi. This routine is now default for
637
+ ::LBFGS_LINESEARCH_BACKTRACKING. The previous line search algorithm
638
+ with regular Wolfe condition is still available as
639
+ ::LBFGS_LINESEARCH_BACKTRACKING_LOOSE.
640
+ - Configurable stop index for L1-norm computation. A member variable
641
+ ::lbfgs_parameter_t::orthantwise_end was added to specify the index
642
+ number at which the library stops computing the L1 norm of the
643
+ variables. This is useful to prevent some variables from being
644
+ regularized by the OW-LQN method.
645
+ - A sample program written in C++ (sample/sample.cpp).
646
+ - Version 1.5 (2008-07-10):
647
+ - Configurable starting index for L1-norm computation. A member variable
648
+ ::lbfgs_parameter_t::orthantwise_start was added to specify the index
649
+ number from which the library computes the L1 norm of the variables.
650
+ This is useful to prevent some variables from being regularized by the
651
+ OWL-QN method.
652
+ - Fixed a zero-division error when the initial variables have already
653
+ been a minimizer (reported by Takashi Imamichi). In this case, the
654
+ library returns ::LBFGS_ALREADY_MINIMIZED status code.
655
+ - Defined ::LBFGS_SUCCESS status code as zero; removed unused constants,
656
+ LBFGSFALSE and LBFGSTRUE.
657
+ - Fixed a compile error in an implicit down-cast.
658
+ - Version 1.4 (2008-04-25):
659
+ - Configurable line search algorithms. A member variable
660
+ ::lbfgs_parameter_t::linesearch was added to choose either MoreThuente
661
+ method (::LBFGS_LINESEARCH_MORETHUENTE) or backtracking algorithm
662
+ (::LBFGS_LINESEARCH_BACKTRACKING).
663
+ - Fixed a bug: the previous version did not compute psuedo-gradients
664
+ properly in the line search routines for OWL-QN. This bug might quit
665
+ an iteration process too early when the OWL-QN routine was activated
666
+ (0 < ::lbfgs_parameter_t::orthantwise_c).
667
+ - Configure script for POSIX environments.
668
+ - SSE/SSE2 optimizations with GCC.
669
+ - New functions ::lbfgs_malloc and ::lbfgs_free to use SSE/SSE2 routines
670
+ transparently. It is uncessary to use these functions for libLBFGS built
671
+ without SSE/SSE2 routines; you can still use any memory allocators if
672
+ SSE/SSE2 routines are disabled in libLBFGS.
673
+ - Version 1.3 (2007-12-16):
674
+ - An API change. An argument was added to lbfgs() function to receive the
675
+ final value of the objective function. This argument can be set to
676
+ \c NULL if the final value is unnecessary.
677
+ - Fixed a null-pointer bug in the sample code (reported by Takashi Imamichi).
678
+ - Added build scripts for Microsoft Visual Studio 2005 and GCC.
679
+ - Added README file.
680
+ - Version 1.2 (2007-12-13):
681
+ - Fixed a serious bug in orthant-wise L-BFGS.
682
+ An important variable was used without initialization.
683
+ - Version 1.1 (2007-12-01):
684
+ - Implemented orthant-wise L-BFGS.
685
+ - Implemented lbfgs_parameter_init() function.
686
+ - Fixed several bugs.
687
+ - API documentation.
688
+ - Version 1.0 (2007-09-20):
689
+ - Initial release.
690
+
691
+ @section api Documentation
692
+
693
+ - @ref liblbfgs_api "libLBFGS API"
694
+
695
+ @section sample Sample code
696
+
697
+ @include sample.c
698
+
699
+ @section ack Acknowledgements
700
+
701
+ The L-BFGS algorithm is described in:
702
+ - Jorge Nocedal.
703
+ Updating Quasi-Newton Matrices with Limited Storage.
704
+ <i>Mathematics of Computation</i>, Vol. 35, No. 151, pp. 773--782, 1980.
705
+ - Dong C. Liu and Jorge Nocedal.
706
+ On the limited memory BFGS method for large scale optimization.
707
+ <i>Mathematical Programming</i> B, Vol. 45, No. 3, pp. 503-528, 1989.
708
+
709
+ The line search algorithms used in this implementation are described in:
710
+ - John E. Dennis and Robert B. Schnabel.
711
+ <i>Numerical Methods for Unconstrained Optimization and Nonlinear
712
+ Equations</i>, Englewood Cliffs, 1983.
713
+ - Jorge J. More and David J. Thuente.
714
+ Line search algorithm with guaranteed sufficient decrease.
715
+ <i>ACM Transactions on Mathematical Software (TOMS)</i>, Vol. 20, No. 3,
716
+ pp. 286-307, 1994.
717
+
718
+ This library also implements Orthant-Wise Limited-memory Quasi-Newton (OWL-QN)
719
+ method presented in:
720
+ - Galen Andrew and Jianfeng Gao.
721
+ Scalable training of L1-regularized log-linear models.
722
+ In <i>Proceedings of the 24th International Conference on Machine
723
+ Learning (ICML 2007)</i>, pp. 33-40, 2007.
724
+
725
+ Special thanks go to:
726
+ - Yoshimasa Tsuruoka and Daisuke Okanohara for technical information about
727
+ OWL-QN
728
+ - Takashi Imamichi for the useful enhancements of the backtracking method
729
+ - Kevin S. Van Horn, Nic Schraudolph, and Tamas Nepusz for bug fixes
730
+
731
+ Finally I would like to thank the original author, Jorge Nocedal, who has been
732
+ distributing the effieicnt and explanatory implementation in an open source
733
+ licence.
734
+
735
+ @section reference Reference
736
+
737
+ - <a href="http://www.ece.northwestern.edu/~nocedal/lbfgs.html">L-BFGS</a> by Jorge Nocedal.
738
+ - <a href="http://research.microsoft.com/en-us/downloads/b1eb1016-1738-4bd5-83a9-370c9d498a03/default.aspx">Orthant-Wise Limited-memory Quasi-Newton Optimizer for L1-regularized Objectives</a> by Galen Andrew.
739
+ - <a href="http://chasen.org/~taku/software/misc/lbfgs/">C port (via f2c)</a> by Taku Kudo.
740
+ - <a href="http://www.alglib.net/optimization/lbfgs.php">C#/C++/Delphi/VisualBasic6 port</a> in ALGLIB.
741
+ - <a href="http://cctbx.sourceforge.net/">Computational Crystallography Toolbox</a> includes
742
+ <a href="http://cctbx.sourceforge.net/current_cvs/c_plus_plus/namespacescitbx_1_1lbfgs.html">scitbx::lbfgs</a>.
743
+ */
744
+
745
+ #endif/*__LBFGS_H__*/