From 0f6efb8be60c6d483cfc5556955d531a77d0a38f Mon Sep 17 00:00:00 2001 From: Shin Date: Wed, 28 Jan 2015 18:37:04 +0100 Subject: [PATCH] preparing documentation --- .gitignore | 3 + Doxyfile | 6 +- doc/customdoxygen.css | 255 ++++++++++++++++++++++++++++++ doc/footer.html | 26 +++ doc/header.html | 42 +++++ doc/html/doxy-boot.js | 120 ++++++++++++++ src/NeuralNetwork/FeedForward.cpp | 2 +- src/NeuralNetwork/FeedForward.h | 28 +++- 8 files changed, 476 insertions(+), 6 deletions(-) create mode 100644 doc/customdoxygen.css create mode 100644 doc/footer.html create mode 100644 doc/header.html create mode 100644 doc/html/doxy-boot.js diff --git a/.gitignore b/.gitignore index 8977362..be90243 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ NN.kdev4 .kdev4 *.o *.a +*.so *.nm +/doc/html/* +!/doc/html/doxy-boot.js diff --git a/Doxyfile b/Doxyfile index 456c411..028e42f 100644 --- a/Doxyfile +++ b/Doxyfile @@ -628,13 +628,13 @@ HTML_FILE_EXTENSION = .html # each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = +HTML_HEADER = ./doc/header.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = +HTML_FOOTER = ./doc/footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to @@ -645,6 +645,8 @@ HTML_FOOTER = HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = ./doc/customdoxygen.css + # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) diff --git a/doc/customdoxygen.css b/doc/customdoxygen.css new file mode 100644 index 0000000..7bf2f5e --- /dev/null +++ b/doc/customdoxygen.css @@ -0,0 +1,255 @@ +h1, .h1, h2, .h2, h3, .h3{ + font-weight: 200 !important; +} + +#navrow1, #navrow2, #navrow3, #navrow4, #navrow5{ + border-bottom: 1px solid #EEEEEE; +} + +.adjust-right { +margin-left: 30px !important; +font-size: 1.15em !important; +} +.navbar{ + border: 0px solid #222 !important; +} + + +/* Sticky footer styles +-------------------------------------------------- */ +html, +body { + height: 100%; + /* The html and body elements cannot have any padding or margin. */ +} + +/* Wrapper for page content to push down footer */ +#wrap { + min-height: 100%; + height: auto; + /* Negative indent footer by its height */ + margin: 0 auto -60px; + /* Pad bottom by footer height */ + padding: 0 0 60px; +} + +/* Set the fixed height of the footer here */ +#footer { + font-size: 0.9em; + padding: 8px 0px; + background-color: #f5f5f5; +} + +.footer-row { + line-height: 44px; +} + +#footer > .container { + padding-left: 15px; + padding-right: 15px; +} + +.footer-follow-icon { + margin-left: 3px; + text-decoration: none !important; +} + +.footer-follow-icon img { + width: 20px; +} + +.footer-link { + padding-top: 5px; + display: inline-block; + color: #999999; + text-decoration: none; +} + +.footer-copyright { + text-align: center; +} + + +@media (min-width: 992px) { + .footer-row { + text-align: left; + } + + .footer-icons { + text-align: right; + } +} +@media (max-width: 991px) { + .footer-row { + text-align: center; + } + + .footer-icons { + text-align: center; + } +} + +/* DOXYGEN Code Styles +----------------------------------- */ + + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 4px 6px; + margin: 4px 8px 4px 2px; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + diff --git a/doc/footer.html b/doc/footer.html new file mode 100644 index 0000000..f2fa204 --- /dev/null +++ b/doc/footer.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + diff --git a/doc/header.html b/doc/header.html new file mode 100644 index 0000000..d71678c --- /dev/null +++ b/doc/header.html @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + $projectname: $title + $title + + + $treeview + $search + $mathjax + + $extrastylesheet + + + + + + + +
+
+
+
+
+
+ diff --git a/doc/html/doxy-boot.js b/doc/html/doxy-boot.js new file mode 100644 index 0000000..5ee5fa3 --- /dev/null +++ b/doc/html/doxy-boot.js @@ -0,0 +1,120 @@ +$( document ).ready(function() { + + $("div.headertitle").addClass("page-header"); + $("div.title").addClass("h1"); + + $('li > a[href="index.html"] > span').before(" "); + $('li > a[href="modules.html"] > span').before(" "); + $('li > a[href="namespaces.html"] > span').before(" "); + $('li > a[href="annotated.html"] > span').before(" "); + $('li > a[href="classes.html"] > span').before(" "); + $('li > a[href="inherits.html"] > span').before(" "); + $('li > a[href="functions.html"] > span').before(" "); + $('li > a[href="functions_func.html"] > span').before(" "); + $('li > a[href="functions_vars.html"] > span').before(" "); + $('li > a[href="functions_enum.html"] > span').before(" "); + $('li > a[href="functions_eval.html"] > span').before(" "); + $('img[src="ftv2ns.png"]').replaceWith('N '); + $('img[src="ftv2cl.png"]').replaceWith('C '); + + $("ul.tablist").addClass("nav nav-pills nav-justified"); + $("ul.tablist").css("margin-top", "0.5em"); + $("ul.tablist").css("margin-bottom", "0.5em"); + $("li.current").addClass("active"); + $("iframe").attr("scrolling", "yes"); + + $("#nav-path > ul").addClass("breadcrumb"); + + $("table.params").addClass("table"); + $("div.ingroups").wrapInner(""); + $("div.levels").css("margin", "0.5em"); + $("div.levels > span").addClass("btn btn-default btn-xs"); + $("div.levels > span").css("margin-right", "0.25em"); + + $("table.directory").addClass("table table-striped"); + $("div.summary > a").addClass("btn btn-default btn-xs"); + $("table.fieldtable").addClass("table"); + $(".fragment").addClass("well"); + $(".memitem").addClass("panel panel-default"); + $(".memproto").addClass("panel-heading"); + $(".memdoc").addClass("panel-body"); + $("span.mlabel").addClass("label label-info"); + + $("table.memberdecls").addClass("table"); + $("[class^=memitem]").addClass("active"); + + $("div.ah").addClass("btn btn-default"); + $("span.mlabels").addClass("pull-right"); + $("table.mlabels").css("width", "100%") + $("td.mlabels-right").addClass("pull-right"); + + $("div.ttc").addClass("panel panel-primary"); + $("div.ttname").addClass("panel-heading"); + $("div.ttname a").css("color", 'white'); + $("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body"); + + $('#MSearchBox').parent().remove(); + + $('div.fragment.well div.line:first').css('margin-top', '15px'); + $('div.fragment.well div.line:last').css('margin-bottom', '15px'); + + $('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered').each(function(){ + $(this).prepend(''); + $(this).find('tbody > tr:first').prependTo($(this).find('thead')); + + $(this).find('td > span.success').parent().addClass('success'); + $(this).find('td > span.warning').parent().addClass('warning'); + $(this).find('td > span.danger').parent().addClass('danger'); + }); + + + + if($('div.fragment.well div.ttc').length > 0) + { + $('div.fragment.well div.line:first').parent().removeClass('fragment well'); + } + + $('table.memberdecls').find('.memItemRight').each(function(){ + $(this).contents().appendTo($(this).siblings('.memItemLeft')); + $(this).siblings('.memItemLeft').attr('align', 'left'); + }); + + function getOriginalWidthOfImg(img_element) { + var t = new Image(); + t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src; + return t.width; + } + + $('div.dyncontent').find('img').each(function(){ + if(getOriginalWidthOfImg($(this)[0]) > $('#content>div.container').width()) + $(this).css('width', '100%'); + }); + + $(".memitem").removeClass('memitem'); + $(".memproto").removeClass('memproto'); + $(".memdoc").removeClass('memdoc'); + $("span.mlabel").removeClass('mlabel'); + $("table.memberdecls").removeClass('memberdecls'); + $("[class^=memitem]").removeClass('memitem'); + $("span.mlabels").removeClass('mlabels'); + $("table.mlabels").removeClass('mlabels'); + $("td.mlabels-right").removeClass('mlabels-right'); + $(".navpath").removeClass('navpath'); + $("li.navelem").removeClass('navelem'); + $("a.el").removeClass('el'); + $("div.ah").removeClass('ah'); + $("div.header").removeClass("header"); + + $('.mdescLeft').each(function(){ + if($(this).html()==" ") { + $(this).siblings('.mdescRight').attr('colspan', 2); + $(this).remove(); + } + }); + $('td.memItemLeft').each(function(){ + if($(this).siblings('.memItemRight').html()=="") { + $(this).attr('colspan', 2); + $(this).siblings('.memItemRight').remove(); + } + }); +}); \ No newline at end of file diff --git a/src/NeuralNetwork/FeedForward.cpp b/src/NeuralNetwork/FeedForward.cpp index e06e9a4..ef566a5 100644 --- a/src/NeuralNetwork/FeedForward.cpp +++ b/src/NeuralNetwork/FeedForward.cpp @@ -33,7 +33,7 @@ FFNeuron& FFLayer::operator[](const size_t& neuron) } -FeedForward::FeedForward(std::initializer_list s, double lam, std::function weightInit): ACyclicNetwork(lam),layers(s.size()) +FeedForward::FeedForward(std::initializer_list s, double lam, FeedForwardInitializer weightInit): ACyclicNetwork(lam),layers(s.size()) { transfer = new TransferFunction::TransferFunction*[s.size()]; weights= new float**[s.size()]; diff --git a/src/NeuralNetwork/FeedForward.h b/src/NeuralNetwork/FeedForward.h index 95f6021..1d3ee97 100644 --- a/src/NeuralNetwork/FeedForward.h +++ b/src/NeuralNetwork/FeedForward.h @@ -4,9 +4,9 @@ #include "../Problem" #include "../Solution" #include "Network" + #include "TransferFunction/Sigmoid.h" #include "TransferFunction/TransferFunction.h" -#include "TransferFunction/HyperbolicTangent.h" #include #include @@ -78,16 +78,38 @@ namespace NeuralNetwork float lambda; }; + /** + * @brief typedef for FeedForward network initializating function + */ + typedef std::function FeedForwardInitializer; + + /** + * @author Tomas Cernik (Tom.Cernik@gmail.com) + * @brief Class representing FeedForward network + * @see ACyclicNetwork + */ class FeedForward:public ACyclicNetwork { public: + /** + * @brief Constructor for FeedForward + * @param s is initiaizer for layers (it's sizes) + * @param lam is parametr for TransferFunction + * @param weightInit is weight initializer function + */ FeedForward(std::initializer_list s, double lam=Shin::NeuralNetwork::lambda, - std::function weightInit= + FeedForwardInitializer weightInit= [](const size_t&, const size_t &, const size_t &)->float{ return 1.0-((float)(rand()%2001))/1000.0;} ); virtual ~FeedForward(); + /** + * @brief we don't want to allow network to be copied + */ FeedForward(const FeedForward &f) = delete; //TODO + /** + * @brief we don't want to allow network to be copied + */ FeedForward operator=(const FeedForward &f)=delete; virtual Solution solve(const Problem& p) override; @@ -103,7 +125,7 @@ namespace NeuralNetwork float **inputs=nullptr; TransferFunction::TransferFunction **transfer=nullptr; size_t *layerSizes=nullptr; - size_t layers; + size_t layers;/**< Number of layers */ }; }