{"id":264134,"date":"2015-08-24T11:12:02","date_gmt":"2015-08-24T07:12:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=264134"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=264134","title":{"rendered":"\u041e\u0434\u043d\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0439 \u043f\u0435\u0440\u0446\u0435\u043f\u0442\u0440\u043e\u043d \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445"},"content":{"rendered":"<p>             \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0451 \u0447\u0430\u0449\u0435 \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0438 \u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. \u00ab\u041d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u0443\u0437\u044b\u043a\u0443\u00bb, \u00ab\u041d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043b\u0430 \u0441\u0442\u0438\u043b\u044c \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u044c\u0435\u0440\u0443\u00bb, \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u043c\u0443, \u0438 \u043d\u0430 \u0432\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u043a \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0430\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u043d\u0435 \u0438\u043c\u0435\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u043d\u0430\u0432\u044b\u043a\u043e\u0432.<\/p>\n<p>  \u041a \u0441\u0432\u043e\u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0430-\u043b\u044f \u00abHello world\u00bb. \u0414\u0430, \u0435\u0441\u0442\u044c <a href=\"https:\/\/www.coursera.org\/learn\/machine-learning\">coursera<\/a> \u0438 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0439 Andrew Ng, \u0435\u0441\u0442\u044c <a href=\"http:\/\/geektimes.ru\/post\/40137\/\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043f\u0440\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 (\u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442 \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u0441\u0430\u043c\u044b\u0445 \u043e\u0441\u043d\u043e\u0432), \u043d\u043e \u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441 \u043a\u043e\u0434\u043e\u043c. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0446\u0435\u043f\u0442\u0440\u043e\u043d \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u00abAND\u00bb \u0438\u043b\u0438 \u00abOR\u00bb \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043b\u044e\u0431\u0438\u043c\u043e\u043c \u044f\u0437\u044b\u043a\u0435 C++. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0435\u0442\u0438: <br \/>  1) \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f C++.<br \/>  2) \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u044b <a href=\"http:\/\/arma.sourceforge.net\/\">Armadillo<\/a>.<br \/>  \u0412 ArchLinux \u043e\u043d\u0430 \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e:  <\/p>\n<pre><code class=\"bash\">yaourt -S armadillo <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430: CMakeLists.txt \u0438 Main.cpp.<\/p>\n<p>  CMakeLists.txt \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cmake\">project(Perc) cmake_minimum_required(VERSION 3.2) set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -std=c++11&quot;) set(CMAKE_BUILD_TYPE Debug) set(EXECUTABLE_NAME &quot;Perc&quot;) file(GLOB SRC     &quot;*.h&quot;     &quot;*.cpp&quot; )  #Subdirectories option(USE_CLANG &quot;build application with clang&quot; ON)  find_package(Armadillo REQUIRED) include_directories(${ARMADILLO_INCLUDE_DIRS})  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY &quot;${CMAKE_CURRENT_SOURCE_DIR}\/bin&quot;) add_executable(${EXECUTABLE_NAME} ${SRC} ) TARGET_LINK_LIBRARIES(  ${EXECUTABLE_NAME}  ${ARMADILLO_LIBRARIES} ) <\/code><\/pre>\n<p>  Main.cpp:   <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;armadillo&gt;  using namespace std; using namespace arma;  int main(int argc, char** argv)   {   mat A = randu&lt;mat&gt;(4,5);   mat B = randu&lt;mat&gt;(4,5);      cout &lt;&lt; A*B.t() &lt;&lt; endl;      return 0;   } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u0441\u0435 \u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e.  <\/p>\n<pre><code class=\"bash\">cmake make .\/bin\/NeuroBot <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c!<\/p>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c AND \u0430 \u0447\u0442\u043e \u0435\u0441\u0442\u044c OR? \u0422\u0430\u043a \u043e\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/robocraft.ru\/files\/neuronet\/neuron.png\"\/><\/p>\n<p>  \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043d\u0435\u0439\u0440\u043e\u043d, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u043e \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043f\u0442 \u0441\u0435\u0442\u0438. \u041e\u0431\u043e \u0432\u0441\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<br \/>  x1 \u0438 x2 \u0438 x&#8230;- \u043d\u0430\u0448\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u00abAND\u00bb<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b7b\/f76\/c64\/b7bf76c6452f41f4918bf977e9656309.png\"\/><\/p>\n<p>  \u041d\u0430\u0448\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 A \u0438 B, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0430 4 \u0445 2, \u0442\u0430\u043a \u043a\u0430\u043a \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  w1 \u0438 w2 \u2014 \u00ab\u0432\u0435\u0441\u0430\u00bb, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0443\u0447\u0430\u0442\u044c. \u041e\u0431\u044b\u0447\u043d\u043e \u0432\u0435\u0441\u043e\u0432 \u043d\u0430 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0432\u0445\u043e\u0434\u043e\u0432, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0445 3 ( + \u0431\u0438\u0430\u0441).<\/p>\n<p>  \u041e\u043f\u044f\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0430: 3&#215;1.<\/p>\n<p>  Y \u2014 \u0432\u044b\u0445\u043e\u0434, \u044d\u0442\u043e \u043d\u0430\u0448 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 Q. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 4\u04451. \u041c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D0%B5%D0%BA%D1%82%D0%BE%D1%80%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F_(%D0%BF%D0%B0%D1%80%D0%B0%D0%BB%D0%BB%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5_%D0%B2%D1%8B%D1%87%D0%B8%D1%81%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F)\">\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/a>.<\/p>\n<p>  \u042f\u0447\u0435\u0439\u043a\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u2014 \u044d\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044c w1 \u0438 w2. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9B%D0%BE%D0%B3%D0%B8%D1%81%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B0%D1%8F_%D1%80%D0%B5%D0%B3%D1%80%D0%B5%D1%81%D1%81%D0%B8%D1%8F\">\u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f<\/a>. \u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f w1 \u0438 w2 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%93%D1%80%D0%B0%D0%B4%D0%B8%D0%B5%D0%BD%D1%82%D0%BD%D1%8B%D0%B9_%D1%81%D0%BF%D1%83%D1%81%D0%BA\">\u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430<\/a>.<\/p>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a? \u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 0 \/ 1. \u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f (\u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430) \u0441\u0442\u0440\u043e\u0438\u0442 \u0433\u043b\u0430\u0434\u043a\u0443\u044e \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u0443\u044e \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0443\u044e, \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0431\u0443\u043a\u0432\u044b \u00abS\u00bb:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/robocraft.ru\/files\/neuronet\/and_or_xor.png\" alt=\"image\"\/> <\/p>\n<p>  \u0428\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f, \u043d\u043e \u043e\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u0430\u0441\u0442\u0440\u0430\u043d\u043d\u0435\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0441\u0442\u0440\u0435\u043c\u0443\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u0434\u043e\u043b\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 (\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/5\/5b\/Gradient_descent_method.png\" alt=\"image\"\/><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435!<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<br \/>  1) \u0417\u0430\u0434\u0430\u0435\u043c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0435  <\/p>\n<pre><code class=\"cpp\">const int n = 2; \/\/\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432     const int epoches = 100; \/\/\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043f\u043e\u0445, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043c\u044b &quot;\u043f\u043e\u0434\u0433\u043e\u043d\u044f\u0435\u043c&quot; w1 \u0438 w2     double lr = 1.0; \/\/\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f     mat samples({             0.0, 0.0, 1.0,             1.0, 0.0, 1.0,             0.0, 1.0, 1.0,             1.0, 1.0, 1.0         });     samples.set_size(4, 3);     \/\/\u041e\u0442\u0432\u0435\u0442\u044b     mat targets{0.0, 0.0, 0.0, 1.0};     targets.set_size(4, 1);     mat w; w.set_size(3,1);     \/\/\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0432\u0435\u0441\u044b \u043e\u0442 -1 \u0434\u043e 1     w.transform([](double val)     {         double f = (double)rand() \/ RAND_MAX;         val= 1.0 + f * (-1.0 - 1.0);         return val;     });  <\/code><\/pre>\n<p>  2) \u041f\u043e\u043a\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043f\u043e\u0445 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u043b\u043e \u043a \u043a\u043e\u043d\u0446\u0443 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431: \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438), \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0432\u0435\u0441\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 <img decoding=\"async\" src=\"http:\/\/robocraft.ru\/files\/neuronet\/s.png\" alt=\"image\"\/>, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044e (\u0441\u0438\u0433\u043c\u043e\u0438\u0434\u0430 \u2014 sig), <img decoding=\"async\" src=\"http:\/\/robocraft.ru\/files\/neuronet\/fx.png\" alt=\"image\"\/> \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430.   <\/p>\n<pre><code class=\"cpp\">for(int i = 0; i &lt; epoches; i++)     {         mat z = samples * w; \/\/Summator         auto outputs = sig(z);         \/\/Gradient Descend         w -= (lr*((outputs - targets) % sig_der(outputs)).t() * (samples) \/ samples.size ()).t();         std::cout &lt;&lt; outputs &lt;&lt; std::endl &lt;&lt; std::endl;     } <\/code><\/pre>\n<p>  3) \u0412 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0410\u043a\u0441\u043e\u043d), \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.  <\/p>\n<pre><code class=\"cpp\"> \/\/Activate function     mat a = samples * w;     mat result = round(sig(a));     std::cout &lt;&lt; result; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0446\u0435\u043f\u0442\u0440\u043e\u043d \u0433\u043e\u0442\u043e\u0432. \u0418\u0437\u043c\u0435\u043d\u0438\u0442\u0435 Y \u043d\u0430 \u00abOR\u00bb \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f, \u0442\u043e \u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0448\u0443, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0439\u043d\u044b\u0439 \u043f\u0435\u0440\u0446\u0435\u043f\u0442\u0440\u043e\u043d \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 XOR, \u043e\u0431\u044a\u044f\u0441\u043d\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0438 \u043c\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u043c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043e\u0434.<\/p>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Main.cpp <a href=\"https:\/\/gist.github.com\/Warezovvv\/0c1e25723be1e600d8f2\">gist.github.com\/Warezovvv\/0c1e25723be1e600d8f2<\/a>.             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/265301\/\"> http:\/\/habrahabr.ru\/post\/265301\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0451 \u0447\u0430\u0449\u0435 \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0438 \u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. \u00ab\u041d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u0443\u0437\u044b\u043a\u0443\u00bb, \u00ab\u041d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043b\u0430 \u0441\u0442\u0438\u043b\u044c \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u044c\u0435\u0440\u0443\u00bb, \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u043c\u0443, \u0438 \u043d\u0430 \u0432\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u043a \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0430\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u043d\u0435 \u0438\u043c\u0435\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u043d\u0430\u0432\u044b\u043a\u043e\u0432.<\/p>\n<p>  \u041a \u0441\u0432\u043e\u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0430-\u043b\u044f \u00abHello world\u00bb. \u0414\u0430, \u0435\u0441\u0442\u044c <a href=\"https:\/\/www.coursera.org\/learn\/machine-learning\">coursera<\/a> \u0438 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0439 Andrew Ng, \u0435\u0441\u0442\u044c <a href=\"http:\/\/geektimes.ru\/post\/40137\/\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a> \u043f\u0440\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 (\u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442 \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u0441\u0430\u043c\u044b\u0445 \u043e\u0441\u043d\u043e\u0432), \u043d\u043e \u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441 \u043a\u043e\u0434\u043e\u043c. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0446\u0435\u043f\u0442\u0440\u043e\u043d \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u00abAND\u00bb \u0438\u043b\u0438 \u00abOR\u00bb \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043b\u044e\u0431\u0438\u043c\u043e\u043c \u044f\u0437\u044b\u043a\u0435 C++. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-264134","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264134"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264134\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}