{"id":339052,"date":"2022-09-29T21:00:06","date_gmt":"2022-09-29T21:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=339052"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=339052","title":{"rendered":"<span>\u041f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043f\u043e \u0414\u041d\u041a \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u043d\u0430 PyTorch<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/690562\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/dg\/qk\/o0\/dgqko00xc8zp-j2vxomvhc0bbby.png\" data-src=\"https:\/\/habrastorage.org\/webt\/dg\/qk\/o0\/dgqko00xc8zp-j2vxomvhc0bbby.png\"\/><br \/>  <\/a>  <\/p>\n<p>\u0412\u0438\u0434\u0438\u043c\u043e, \u0430\u0441\u0442\u0440\u043e\u043b\u043e\u0433\u0438 \u0425\u0430\u0431\u0440\u0430 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u0434\u0435\u043d\u044c Python \u0432\u00a0\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b\u00a0\u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0430\u0441\u043f\u0438\u0440\u0430\u043d\u0442 \u042d\u0440\u0438\u043d \u0423\u0438\u043b\u0441\u043e\u043d \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c \u0443\u043c\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439\u00a0\u0414\u041d\u041a. \u0417\u0430\u00a0\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u00a0\u043a\u0430\u0442\u00a0\u2014 \u043a\u00a0\u0441\u0442\u0430\u0440\u0442\u0443 \u043d\u0430\u0448\u0435\u0433\u043e <u><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;amp;utm_medium=habr&amp;amp;utm_campaign=article&amp;amp;utm_content=data-science_dspr_290922&amp;amp;utm_term=lead\">\u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430 \u043f\u043e\u00a0Data Science<\/a><\/u>.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u041d\u041a\u00a0\u2014 \u043f\u043e\u0442\u043e\u043a \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u00a0\u0432\u0438\u0434\u0435 \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 <code>ACTG<\/code>. \u0422\u0435\u043c \u043d\u0435\u00a0\u043c\u0435\u043d\u0435\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0438\u00a0\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u043d\u044e\u0430\u043d\u0441\u044b \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430\u00a0\u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0433\u043e\u0434\u044b \u0432\u00a0\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0414\u041d\u041a \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u00a0\u0441\u0442\u0430\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0414\u041d\u041a \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u0412\u00a0\u0438\u0445\u00a0\u0447\u0438\u0441\u043b\u0435 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 (CNN), \u0441\u0435\u0442\u0438 \u0441\u00a0\u0434\u043e\u043b\u0433\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u00a0\u043a\u0440\u0430\u0442\u043a\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e (LSTM) \u0438\u00a0\u0434\u0430\u0436\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0433\u0435\u043d\u043e\u043c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u00a0\u0414\u041d\u041a. \u0421\u0430\u043c\u043e\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0432\u00a0\u044d\u0442\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445\u00a0\u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0438\u00a0\u043c\u043e\u0442\u0438\u0432\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0414\u041d\u041a \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435\u00a0\u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043e\u043c\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b. \u041d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0438\u0445\u00a0\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u044c \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u00a0\u0433\u0435\u043d\u043e\u043c\u0438\u043a\u0435 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0437\u043c\u0430 \u0432\u0441\u0435\u043c, \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a \u0441\u00a0\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438!<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0430\u0441\u043f\u0438\u0440\u0430\u043d\u0442, \u0443\u0432\u043b\u0435\u0447\u0451\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 <a href=\"https:\/\/onezero.medium.com\/the-light-side-of-genetic-engineering-a65c5863b4d8?sk=c5dbb65ef31dad8ed13076e63a476019\">\u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0440\u043e\u0434\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u00a0\u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438<\/a>, \u044f\u00a0\u0441\u00a0\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u043c \u0438\u0437\u0443\u0447\u0438\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PyTorch \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0414\u041d\u041a.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043f\u043e\u00a0PyTorch \u043d\u0435\u043c\u0430\u043b\u043e, \u043d\u043e\u00a0\u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437\u00a0\u043d\u0438\u0445 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439 \u0438\u00a0\u044f\u0437\u044b\u043a\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0414\u041d\u041a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u00a0\u0446\u0435\u043b\u043e\u043c \u0440\u044f\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0432\u00a0PyTorch \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044f\u0432\u043b\u0435\u043d\u0438\u0439 <a href=\"https:\/\/github.com\/FunctionLab\/selene\">1<\/a>, <a href=\"https:\/\/github.com\/davek44\/Basset\">2<\/a>, <a href=\"https:\/\/github.com\/jerryji1993\/DNABERT\">3<\/a>, \u043d\u043e\u00a0\u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0440\u0443\u0434\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u00a0PyTorch \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u0438\u00a0\u0431\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441\u00a0\u0414\u041d\u041a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f\u00a0\u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u044d\u0442\u043e \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043d\u0430\u00a0\u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0414\u041d\u041a \u043d\u0430\u0439\u0434\u0443\u0442 \u0435\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u00a0\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435\u00a0<a href=\"https:\/\/github.com\/erinhwilson\/dna-pytorch-tutorial\">\u0431\u043b\u043e\u043a\u043d\u043e\u0442\u0430 Jupyter<\/a>. \u041f\u0440\u043e\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043b\u0430\u043d \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u00a0\u043a\u0440\u0430\u0442\u043a\u043e\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u043e\u043d\u044f\u0442\u0438\u0439 \u0438\u00a0Github gists \u0432\u00a0\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <\/p>\n<blockquote><p><a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_290922&amp;utm_term=main\"><img decoding=\"async\" width=\"204\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/f6\/9k\/pb\/f69kpbgli09iefmogqonicvz8ew.png\" align=\"left\" title=\"\u0421\u043a\u0438\u0434\u043a\u0430 45% \u043f\u043e \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 HABR\" alt=\"\u0411\u0430\u043d\u043d\u0435\u0440\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/f6\/9k\/pb\/f69kpbgli09iefmogqonicvz8ew.png\"\/><\/a><br \/>  <strong>\u041d\u0430\u0443\u0447\u0438\u043c \u0440\u0435\u0448\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u00a0\u043f\u0440\u043e\u043a\u0430\u0447\u0430\u043b\u0438 \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u0438\u043b\u0438 \u0441\u0442\u0430\u043b\u0438 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u043c IT-\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u043c:<\/strong>  <\/p>\n<ul>\n<li><u><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_290922&amp;utm_term=main\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u0443\u0440\u0441 \u043f\u043e Data Science<\/a><\/u>. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u0439 \u0437\u0430 24 \u043c\u0435\u0441\u044f\u0446\u0430.<\/li>\n<li><u><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_290922&amp;utm_term=main\">\u00abFullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python\u00bb<\/a><\/u>. \u0421\u0442\u0430\u043d\u044c\u0442\u0435 \u043d\u0435\u0437\u0430\u043c\u0435\u043d\u0438\u043c\u044b\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u043c-\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u043e\u043c \u0437\u0430 15 \u043c\u0435\u0441\u044f\u0446\u0435\u0432.<\/li>\n<li><u><a href=\"https:\/\/skillfactory.ru\/start-it-specialist-proforientaciya?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_start_290922&amp;utm_term=main\">\u00ab\u0423\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \u0432 IT\u00bb<\/a><\/u>. \u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432: \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 9 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u0439 \u0438 \u043e\u0441\u0432\u043e\u0439\u0442\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0430\u043c.<\/li>\n<\/ul>\n<\/blockquote>\n<p>  <\/p>\n<h2>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a \u0432\u00a0PyTorch<\/h2>\n<p>  <\/p>\n<p>\u0412\u00a0\u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a PyTorch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u00a0\u0432\u0432\u043e\u0434\u0438\u0442 \u0438\u0445\u00a0\u0432\u00a0\u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0431\u0430\u043b\u043b \u043f\u043e\u00a0\u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u043b\u0430\u043d \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430<\/strong><\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u0438\u043d\u0442\u0435\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0414\u041d\u041a.<\/li>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u00a0PyTorch.<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u00a0PyTorch.<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0446\u0438\u043a\u043b\u0430.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u00a0\u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.<\/li>\n<li>\u0418\u0442\u043e\u0433\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441\u043e\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0438\u00a0\u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c (CNN).<\/li>\n<li>\u042d\u043f\u043e\u0445\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/li>\n<li>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u00a0\u043d\u0430\u0431\u043e\u0440\u044b train\/val\/test.<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u0438\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u0440\u0438\u0432\u044b\u0445 \u043f\u043e\u0442\u0435\u0440\u044c train \u0438\u00a0val.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441\u00a0\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u043c\u0438 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438. \u042d\u0442\u043e:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u044b \u0432\u00a0\u0414\u041d\u041a.<\/li>\n<li>\u0420\u0435\u0433\u0443\u043b\u044f\u0442\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0442\u0438\u0432.<\/li>\n<li>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0442\u0438\u0432\u043e\u0432\u00a0\u0414\u041d\u041a.<\/li>\n<\/ul>\n<p>  <\/p>\n<blockquote>\n<p>\u042f\u00a0\u043d\u0435\u00a0\u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b. \u042f\u00a0\u0432\u0441\u0451 \u0435\u0449\u0451 \u0443\u0447\u0443\u0441\u044c, \u0438\u00a0\u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043c\u043e\u0451 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438. \u0423\u0432\u0435\u0440\u0435\u043d\u0430, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u0435\u0435.<\/p>\n<\/blockquote>\n<p>  <\/p>\n<h2>1. \u0421\u0438\u043d\u0442\u0435\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0414\u041d\u041a<\/h2>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0443\u0447\u0451\u043d\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u043b \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f, \u0441\u0438\u043b\u0443 \u044d\u043a\u0441\u043f\u0440\u0435\u0441\u0441\u0438\u0438 \u0433\u0435\u043d\u043e\u0432, \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u043a\u0442\u043e\u0440\u0430 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u043f\u0446\u0438\u0438 \u0438\u00a0\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u0423\u00a0\u043d\u0430\u0441 \u0432\u0441\u0451 \u043f\u0440\u043e\u0449\u0435. \u0412\u00a0\u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u044b\u00a0\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0438\u00a0\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0438\u00a0\u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u0430\u043b\u043b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435. \u041d\u043e\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u0430\u0436\u0435 \u043d\u0435\u00a0\u0432\u00a0\u044d\u0442\u043e\u043c. \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b PyTorch \u0438\u00a0\u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u00a0\u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0414\u041d\u041a).<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443\u00a0\u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u00a0\u0414\u041d\u041a. \u041d\u0430\u0447\u0438\u0441\u043b\u0438\u043c \u0435\u0439\u00a0\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0430\u043b\u043b\u043e\u0432 \u0437\u0430\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434:<\/p>\n<p>  <\/p>\n<ul>\n<li>A\u00a0(\u0430\u0434\u0435\u043d\u0438\u043d) = +20 \u0431\u0430\u043b\u043b\u043e\u0432.<\/li>\n<li>C\u00a0(\u0446\u0438\u0442\u043e\u0437\u0438\u043d) = +17 \u0431\u0430\u043b\u043b\u043e\u0432.<\/li>\n<li>G\u00a0(\u0433\u0443\u0430\u043d\u0438\u043d) = +14 \u0431\u0430\u043b\u043b\u043e\u0432.<\/li>\n<li>T\u00a0(\u0442\u0438\u043c\u0438\u043d) = +11 \u0431\u0430\u043b\u043b\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u0430 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0431\u0430\u043b\u043b \u0438\u00a0\u0443\u0441\u0440\u0435\u0434\u043d\u044f\u0435\u043c\u00a0\u0435\u0433\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<p><code>AAAAAAAA<\/code> \u0434\u0430\u0451\u0442 \u043d\u0430\u043c <code>20,0<\/code><\/p>\n<p>  <\/p>\n<blockquote>\n<p><code>mean(20 + 20 + 20 + 20 + 20 + 20 + 20 + 20) = 20,0<\/code><\/p>\n<\/blockquote>\n<p>  <\/p>\n<p><code>ACAAAAAA<\/code> \u0434\u0430\u0451\u0442 <code>19,625<\/code><\/p>\n<p>  <\/p>\n<blockquote>\n<p><code>mean(20 + 17 + 20 + 20 + 20 + 20 + 20 + 20) = 19,625<\/code><\/p>\n<\/blockquote>\n<p>  <\/p>\n<p>\u0411\u0430\u043b\u043b\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0434\u043b\u044f \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u00a0\u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438 \u0432\u00a0\u044d\u0442\u043e\u043c\u00a0\u043d\u0435\u0442! \u041c\u044b\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c \u0431\u0430\u043b\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0PyTorch.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u00a0\u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0445 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 (CNN) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u00ab\u043c\u043e\u0442\u0438\u0432\u044b\u00bb \u0438\u043b\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b\u00a0\u0414\u041d\u041a. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0430\u043a\u0446\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u00a0\u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043d\u0430\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u043b\u043e\u0432 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442: \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0442\u0438\u0432\u044b, \u0432\u043b\u0438\u044f\u044e\u0449\u0438\u0435 \u043d\u0430\u00a0\u044d\u043a\u0441\u043f\u0440\u0435\u0441\u0441\u0438\u044e \u0433\u0435\u043d\u043e\u0432. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 <code>+10<\/code> \u0431\u0430\u043b\u043b\u043e\u0432 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043c\u043e\u0442\u0438\u0432\u0430 <code>TAT<\/code> \u0432\u00a0\u043b\u044e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u0430 \u0438\u043b\u0438 <code>-10<\/code> \u0431\u0430\u043b\u043b\u043e\u0432 \u043f\u0440\u0438\u00a0\u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043c\u043e\u0442\u0438\u0432\u0430 <code>GCG<\/code>. \u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u043a\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043d\u0435\u00a0\u0438\u043c\u0435\u0435\u0442. \u042f\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0432\u0430\u043c \u043d\u0430\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438\u00a0\u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/uf\/jj\/gd\/ufjjgdm_q0b6-ieybrsnysp52ke.png\" data-src=\"https:\/\/habrastorage.org\/webt\/uf\/jj\/gd\/ufjjgdm_q0b6-ieybrsnysp52ke.png\"\/><br \/>  <em>\u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0431\u0430\u043b\u043b\u043e\u0432 \u0434\u043b\u044f \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0414\u041d\u041a<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def kmers(k):     '''Generate a list of all k-mers for a given k'''          return [''.join(x) for x in product(['A','C','G','T'], repeat=k)]      seqs8 = kmers(8) print('Total 8mers:',len(seqs8)) # prints: Total 8mers: 65536  score_dict = {     'A':20,     'C':17,     'G':14,     'T':11 }                    def score_seqs_motif(seqs):     '''     Calculate the scores for a list of sequences based on      the above score_dict     '''     data = []     for seq in seqs:         # get the average score by nucleotide         score = np.mean([score_dict[base] for base in seq])                  # give a + or - bump if this k-mer has a specific motif         if 'TAT' in seq:             score += 10         if 'GCG' in seq:             score -= 10         data.append([seq,score])              df = pd.DataFrame(data, columns=['seq','score'])     return df      mer8 = score_seqs_motif(seqs8) <\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0442\u0440\u043e\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u043b\u043b\u043e\u0432 \u0434\u043b\u044f \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u00a0\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u043d\u0430\u00a03 \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0\u043c\u043e\u0442\u0438\u0432\u043e\u043c <code>GCG<\/code> (~5 \u0431\u0430\u043b\u043b\u043e\u0432);<\/li>\n<li>\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0435\u0437 \u043c\u043e\u0442\u0438\u0432\u043e\u0432 (~15 \u0431\u0430\u043b\u043b\u043e\u0432);<\/li>\n<li>\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0\u043c\u043e\u0442\u0438\u0432\u043e\u043c <code>TAT<\/code> (~25 \u0431\u0430\u043b\u043b\u043e\u0432).<\/li>\n<\/ul>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/49\/f-\/mq\/49f-mqwzdzikfqbidnqkiqa0qbs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/49\/f-\/mq\/49f-mqwzdzikfqbidnqkiqa0qbs.png\"\/><br \/>  <em>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u043b\u043b\u043e\u0432 \u0434\u043b\u044f \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u043b \u043f\u043e\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a.<\/p>\n<p>  <\/p>\n<h2>2. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u00a0PyTorch<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u043b, \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u0435\u0439\u00a0\u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u00a0\u0432\u0438\u0434\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0447\u0438\u0441\u0435\u043b. \u041f\u043e\u044f\u0441\u043d\u044e \u043d\u0430\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u0443\u0441\u0442\u044c \u043c\u044b\u00a0\u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0441\u00a0\u043a\u043e\u0448\u043a\u0430\u043c\u0438 \u0438\u00a0\u0431\u0435\u0437 \u043a\u043e\u0448\u0435\u043a \u043d\u0430\u00a0\u0434\u0432\u0430 \u043d\u0430\u0431\u043e\u0440\u0430. \u0421\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0451\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u00a0\u0438\u0437\u0443\u0447\u0430\u0435\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u00a0\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u0448\u0430\u0447\u044c\u0438\u043c \u0443\u0448\u0430\u043c \u0438\u043b\u0438 \u043d\u043e\u0441\u0443 \u0441\u00a0\u0443\u0441\u0430\u043c\u0438).<\/p>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u00a0\u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0447\u0438\u0441\u0435\u043b \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a (\u0441\u0442\u0440\u043e\u043a\u0438 ACGT). \u041d\u043e\u00a0\u043a\u0430\u043a\u00a0\u0436\u0435 \u043d\u0430\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437\u00a0\u043d\u0430\u0448\u0435\u0439 \u0414\u041d\u041a \u00ab\u043a\u043e\u0448\u043a\u0443\u00bb?<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437\u00a0\u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439\u00a0\u2014 \u043f\u0440\u044f\u043c\u043e\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 [one-hot encoding] \u0414\u041d\u041a \u0441\u00a0\u043e\u0434\u043d\u0438\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434 \u043a\u0430\u043a \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u043b\u0438\u043d\u043e\u0439 4, \u0433\u0434\u0435 \u0432\u00a0\u0442\u0440\u0451\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u0445 \u0441\u0442\u043e\u044f\u0442 \u043d\u0443\u043b\u0438, \u0430\u00a0\u0432\u00a0\u043e\u0434\u043d\u043e\u0439\u00a0\u2014 \u0435\u0434\u0438\u043d\u0438\u0446\u0430. \u041c\u0435\u0441\u0442\u043e \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442\u00a0\u0442\u0438\u043f\u0430 \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/dg\/qk\/o0\/dgqko00xc8zp-j2vxomvhc0bbby.png\" data-src=\"https:\/\/habrastorage.org\/webt\/dg\/qk\/o0\/dgqko00xc8zp-j2vxomvhc0bbby.png\"\/><br \/>  <em>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u044f\u043c\u043e\u043c\u0443 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0414\u041d\u041a \u0442\u0430\u043a\u00a0\u0436\u0435, \u043a\u0430\u043a \u043a\u043e\u0448\u043a\u0443 \u043d\u0430\u00a0\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435!<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def one_hot_encode(seq):     \"\"\"     Given a DNA sequence, return its one-hot encoding     \"\"\"     # Make sure seq has only allowed bases     allowed = set(\"ACTGN\")     if not set(seq).issubset(allowed):         invalid = set(seq) - allowed         raise ValueError(f\"Sequence contains chars not in allowed DNA alphabet (ACGTN): {invalid}\")              # Dictionary returning one-hot encoding for each nucleotide      nuc_d = {'A':[1.0,0.0,0.0,0.0],              'C':[0.0,1.0,0.0,0.0],              'G':[0.0,0.0,1.0,0.0],              'T':[0.0,0.0,0.0,1.0],              'N':[0.0,0.0,0.0,0.0]}          # Create array from nucleotide sequence     vec=np.array([nuc_d[x] for x in seq])              return vec    # look at DNA seq of 8 As a8 = one_hot_encode(\"AAAAAAAA\") print(\"AAAAAAAA:\\n\",a8)  # prints: # AAAAAAAA: # [[1. 0. 0. 0.] # [1. 0. 0. 0.] # [1. 0. 0. 0.] # [1. 0. 0. 0.] # [1. 0. 0. 0.] # [1. 0. 0. 0.] # [1. 0. 0. 0.] # [1. 0. 0. 0.]]  # look at DNA seq of random nucleotides s = one_hot_encode(\"AGGTACCT\") print(\"AGGTACCT:\\n\",s) print(\"shape:\",s.shape)  # prints: # AGGTACCT: # [[1. 0. 0. 0.] # [0. 0. 1. 0.] # [0. 0. 1. 0.] # [0. 0. 0. 1.] # [1. 0. 0. 0.] # [0. 1. 0. 0.] # [0. 1. 0. 0.] # [0. 0. 0. 1.]] # shape: (8, 4) <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440\u044b train, val \u0438\u00a0test. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>quick_split<\/code> \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432\u00a0\u043a\u0430\u0434\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 pandas \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f (\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0438\u00a0\u0432\u00a0sklearn).<\/p>\n<p>  <\/p>\n<blockquote>\n<p>\u0412\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u043d\u0435\u00a0\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441\u00a0\u0441\u0438\u043d\u0442\u0435\u0437\u043e\u043c, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u0412\u0441\u0451 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442\u00a0\u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412\u00a0\u043d\u0430\u0443\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 train\/test \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u00a0\u0445\u0440\u043e\u043c\u043e\u0441\u043e\u043c\u0435 \u0438\u043b\u0438 \u043f\u043e\u00a0\u0434\u0440\u0443\u0433\u0438\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u043e\u043c\u0430.<\/p>\n<\/blockquote>\n<pre><code class=\"python\">def quick_split(df, split_frac=0.8):     '''     Given a df of samples, randomly split indices between     train and test at the desired fraction     '''     cols = df.columns # original columns, use to clean up reindexed cols     df = df.reset_index()      # shuffle indices     idxs = list(range(df.shape[0]))     random.shuffle(idxs)      # split shuffled index list by split_frac     split = int(len(idxs)*split_frac)     train_idxs = idxs[:split]     test_idxs = idxs[split:]          # split dfs and return     train_df = df[df.index.isin(train_idxs)]     test_df = df[df.index.isin(test_idxs)]              return train_df[cols], test_df[cols]           full_train_df, test_df = quick_split(mer8) train_df, val_df = quick_split(full_train_df)  print(\"Train:\", train_df.shape) print(\"Val:\", val_df.shape) print(\"Test:\", test_df.shape)  # prints:  # Train: (41942, 2) # Val: (10486, 2) # Test: (13108, 2) <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u00a0PyTorch \u0432\u0430\u0436\u043d\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <a href=\"https:\/\/pytorch.org\/tutorials\/beginner\/basics\/data_tutorial.html\">DataLoader \u0438\u00a0Dataset<\/a>. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u044d\u0442\u043e\u043c, \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0437\u0440\u044f\u0434\u043d\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0442\u044c, \u0430\u00a0\u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0447\u0435\u0441\u0430\u0442\u044c \u043a\u0438\u043f\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u00a0\u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e\u00a0StackOverflow!<\/p>\n<p>  <\/p>\n<p>Dataset \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u00a0\u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b X\u00a0\u0438\u00a0\u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0443 Y\u00a0\u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0430\u0435\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. DataLoader \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 Dataset \u0438\u00a0\u0440\u044f\u0434 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u00a0\u0441\u0435\u0440\u0438\u0438 \u0438\u00a0\u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from torch.utils.data import Dataset, DataLoader  ## Here is a custom defined Dataset object specialized for one-hot encoded DNA:  class SeqDatasetOHE(Dataset):     '''     Dataset for one-hot-encoded sequences     '''     def __init__(self,                  df,                  seq_col='seq',                  target_col='score'                 ):         # +--------------------+         # | Get the X examples |         # +--------------------+         # extract the DNA from the appropriate column in the df         self.seqs = list(df[seq_col].values)         self.seq_len = len(self.seqs[0])                  # one-hot encode sequences, then stack in a torch tensor         self.ohe_seqs = torch.stack([torch.tensor(one_hot_encode(x)) for x in self.seqs])              # +------------------+         # | Get the Y labels |         # +------------------+         self.labels = torch.tensor(list(df[target_col].values)).unsqueeze(1)              def __len__(self): return len(self.seqs)          def __getitem__(self,idx):         # Given an index, return a tuple of an X with it's associated Y         # This is called inside DataLoader         seq = self.ohe_seqs[idx]         label = self.labels[idx]                  return seq, label   ## Here is how I constructed DataLoaders from Datasets.  def build_dataloaders(train_df,                       test_df,                       seq_col='seq',                       target_col='score',                       batch_size=128,                       shuffle=True                      ):     '''     Given a train and test df with some batch construction     details, put them into custom SeqDatasetOHE() objects.      Give the Datasets to the DataLoaders and return.     '''          # create Datasets         train_ds = SeqDatasetOHE(train_df,seq_col=seq_col,target_col=target_col)     test_ds = SeqDatasetOHE(test_df,seq_col=seq_col,target_col=target_col)      # Put DataSets into DataLoaders     train_dl = DataLoader(train_ds, batch_size=batch_size, shuffle=shuffle)     test_dl = DataLoader(test_ds, batch_size=batch_size)          return train_dl,test_dl           train_dl, val_dl = build_dataloaders(train_df, val_df) <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b DataLoader \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u043c \u0446\u0438\u043a\u043b\u0435!<\/p>\n<p>  <\/p>\n<h2>3. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 PyTorch<\/h2>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u00a0\u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0435\u043d\u043e\u043c\u0430 \u043e\u043d\u00a0\u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0441\u0435\u0431\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u044f\u00a0\u0432\u0437\u044f\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># very simple linear model class DNA_Linear(nn.Module):     def __init__(self, seq_len):         super().__init__()         self.seq_len = seq_len         # the 4 is for our one-hot encoded vector length 4!         self.lin = nn.Linear(4*seq_len, 1)      def forward(self, xb):         # reshape to flatten sequence dimension         xb = xb.view(xb.shape[0],self.seq_len*4)         # Linear wraps up the weights\/bias dot product operations         out = self.lin(xb)         return out  # basic CNN model class DNA_CNN(nn.Module):     def __init__(self,                  seq_len,                  num_filters=32,                  kernel_size=3):         super().__init__()         self.seq_len = seq_len                  self.conv_net = nn.Sequential(             # 4 is for the 4 nucleotides             nn.Conv1d(4, num_filters, kernel_size=kernel_size),             nn.ReLU(inplace=True),             nn.Flatten(),             nn.Linear(num_filters*(seq_len-kernel_size+1), 1)         )       def forward(self, xb):         # permute to put channel in correct order         # (batch_size x 4channel x seq_len)         xb = xb.permute(0,2,1)                   #print(xb.shape)         out = self.conv_net(xb)         return out <\/code><\/pre>\n<p>  <\/p>\n<blockquote>\n<p>\u042d\u0442\u043e \u043d\u0435\u00a0\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e\u00a0\u043d\u0430\u0434\u043e\u00a0\u0436\u0435 \u0441\u00a0\u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c (\u0435\u0449\u0451 \u0440\u0430\u0437, \u043c\u044b\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0447\u0438\u043c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c PyTorch \u0432\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0414\u041d\u041a).<\/p>\n<\/blockquote>\n<p>  <\/p>\n<ul>\n<li>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u043b \u043f\u043e\u00a0\u0432\u0435\u0441\u0443 \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043e\u0432 \u043d\u0430\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438.<\/li>\n<li>\u041c\u043e\u0434\u0435\u043b\u044c \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 32 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0441\u00a0\u0434\u043b\u0438\u043d\u043e\u0439 (<code>kernel_size<\/code>) 3 \u0434\u043b\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u00a0\u043f\u043e\u0438\u0441\u043a\u0430 \u0432\u00a0\u043d\u0435\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432-\u0442\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>4. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0446\u0438\u043a\u043b\u0430<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0446\u0438\u043a\u043b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0421\u043a\u0430\u0436\u0443 \u0447\u0435\u0441\u0442\u043d\u043e, \u044f\u00a0<em>\u043d\u0435\u00a0\u0441\u043b\u0438\u0448\u043a\u043e\u043c-\u0442\u043e<\/em> \u0443\u0432\u0435\u0440\u0435\u043d\u0430 \u0432\u00a0\u044d\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438. \u042f\u00a0\u0434\u043e\u043b\u0433\u043e \u043f\u0440\u043e\u0434\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0435\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b! \u041d\u043e, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0438\u00a0\u0442\u0430\u043a \u0441\u043e\u0439\u0434\u0451\u0442? \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432, \u0435\u0441\u043b\u0438 \u0443\u00a0\u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043c\u044b\u0441\u043b\u0438 \u043d\u0430\u00a0\u044d\u0442\u043e\u0442 \u0441\u0447\u0451\u0442.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435, \u044f\u00a0\u043f\u0440\u0438\u0448\u043b\u0430 \u043a\u00a0\u0442\u0430\u043a\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0441\u0442\u0435\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># adds default optimizer and loss function run_model()     # loops through epochs     fit()         # loop through batches         train_step()             # calc train loss for batch             loss_batch()         val_step()             # calc val loss for batch             loss_batch() <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\"># +--------------------------------+ # | Training and fitting functions | # +--------------------------------+  def loss_batch(model, loss_func, xb, yb, opt=None,verbose=False):     '''     Apply loss function to a batch of inputs. If no optimizer     is provided, skip the back prop step.     '''     if verbose:         print('loss batch ****')         print(\"xb shape:\",xb.shape)         print(\"yb shape:\",yb.shape)         print(\"yb shape:\",yb.squeeze(1).shape)         #print(\"yb\",yb)      # get the batch output from the model given your input batch      # ** This is the model's prediction for the y labels! **     xb_out = model(xb.float())          if verbose:         print(\"model out pre loss\", xb_out.shape)         #print('xb_out', xb_out)         print(\"xb_out:\",xb_out.shape)         print(\"yb:\",yb.shape)         print(\"yb.long:\",yb.long().shape)          loss = loss_func(xb_out, yb.float()) # for MSE\/regression     # __FOOTNOTE 2__          if opt is not None: # if opt         loss.backward()         opt.step()         opt.zero_grad()      return loss.item(), len(xb)      def train_step(model, train_dl, loss_func, device, opt):     '''     Execute 1 set of batched training within an epoch     '''     # Set model to Training mode     model.train()     tl = [] # train losses     ns = [] # batch sizes, n          # loop through train DataLoader     for xb, yb in train_dl:         # put on GPU         xb, yb = xb.to(device),yb.to(device)                  # provide opt so backprop happens         t, n = loss_batch(model, loss_func, xb, yb, opt=opt)                  # collect train loss and batch sizes         tl.append(t)         ns.append(n)          # average the losses over all batches         train_loss = np.sum(np.multiply(tl, ns)) \/ np.sum(ns)          return train_loss  def val_step(model, val_dl, loss_func, device):     '''     Execute 1 set of batched validation within an epoch     '''     # Set model to Evaluation mode     model.eval()     with torch.no_grad():         vl = [] # val losses         ns = [] # batch sizes, n                  # loop through validation DataLoader         for xb, yb in val_dl:             # put on GPU             xb, yb = xb.to(device),yb.to(device)              # Do NOT provide opt here, so backprop does not happen             v, n = loss_batch(model, loss_func, xb, yb)              # collect val loss and batch sizes             vl.append(v)             ns.append(n)      # average the losses over all batches     val_loss = np.sum(np.multiply(vl, ns)) \/ np.sum(ns)          return val_loss      def fit(epochs, model, loss_func, opt, train_dl, val_dl,device,patience=1000):     '''     Fit the model params to the training data, eval on unseen data.     Loop for a number of epochs and keep train of train and val losses      along the way     '''     # keep track of losses     train_losses = []         val_losses = []          # loop through epochs     for epoch in range(epochs):         # take a training step         train_loss = train_step(model,train_dl,loss_func,device,opt)         train_losses.append(train_loss)          # take a validation step         val_loss = val_step(model,val_dl,loss_func,device)         val_losses.append(val_loss)                  print(f\"E{epoch} | train loss: {train_loss:.3f} | val loss: {val_loss:.3f}\")      return train_losses, val_losses   def run_model(train_dl,val_dl,model,device,               lr=0.01, epochs=50,                lossf=None,opt=None              ):     '''     Given train and val DataLoaders and a NN model, fit the mode to the training     data. By default, use MSE loss and an SGD optimizer     '''     # define optimizer     if opt:         optimizer = opt     else: # if no opt provided, just use SGD         optimizer = torch.optim.SGD(model.parameters(), lr=lr)          # define loss function     if lossf:         loss_func = lossf     else: # if no loss function provided, just use MSE         loss_func = torch.nn.MSELoss()          # run the training loop     train_losses, val_losses = fit(                                 epochs,                                  model,                                  loss_func,                                  optimizer,                                  train_dl,                                  val_dl,                                  device)      return train_losses, val_losses <\/code><\/pre>\n<p>  <\/p>\n<h2>5. \u0417\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u044b\u0442\u0430\u0435\u043c \u043d\u0430 \u043d\u0430\u0448\u0438\u0445 \u043e\u043a\u0442\u0430\u043c\u0435\u0440\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># use GPU if available DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')  # get the sequence length from the first seq in the df seq_len = len(train_df['seq'].values[0])  # create Linear model object model_lin = DNA_Linear(seq_len) model_lin.to(DEVICE) # put on GPU  # run the model with default settings! lin_train_losses, lin_val_losses = run_model(     train_dl,      val_dl,      model_lin,     DEVICE ) <\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0435\u0440\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u00a0\u043f\u043e\u0442\u0435\u0440\u044f\u0445 train \u0438\u00a0val \u0438\u00a0\u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def quick_loss_plot(data_label_list,loss_type=\"MSE Loss\",sparse_n=0):     '''     For each train\/test loss trajectory, plot loss by epoch     '''     for i,(train_data,test_data,label) in enumerate(data_label_list):             plt.plot(train_data,linestyle='--',color=f\"C{i}\", label=f\"{label} Train\")         plt.plot(test_data,color=f\"C{i}\", label=f\"{label} Val\",linewidth=3.0)      plt.legend()     plt.ylabel(loss_type)     plt.xlabel(\"Epoch\")     plt.legend(bbox_to_anchor=(1,1),loc='upper left')     plt.show()       lin_data_label = (lin_train_losses,lin_val_losses,\"Lin\") quick_loss_plot([lin_data_label]) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/4c\/pv\/ba\/4cpvbae4-5jh-y5dj8mbgoyeft0.png\" data-src=\"https:\/\/habrastorage.org\/webt\/4c\/pv\/ba\/4cpvbae4-5jh-y5dj8mbgoyeft0.png\"\/><br \/>  <em>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u043a\u0440\u0438\u0432\u044b\u0445 \u043f\u043e\u0442\u0435\u0440\u044c<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0438\u0432\u043d\u0451\u0441 \u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a \u0434\u043b\u044f \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">seq_len = len(train_df['seq'].values[0])  # create Linear model object model_cnn = DNA_CNN(seq_len) model_cnn.to(DEVICE) # put on GPU  # run the model with default settings! cnn_train_losses, cnn_val_losses = run_model(     train_dl,      val_dl,      model_cnn,     DEVICE )  cnn_data_label = (cnn_train_losses,cnn_val_losses,\"CNN\") quick_loss_plot([lin_data_label,cnn_data_label]) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/q6\/o7\/qa\/q6o7qargch7t2svilz-jmtd5cdk.png\" data-src=\"https:\/\/habrastorage.org\/webt\/q6\/o7\/qa\/q6o7qargch7t2svilz-jmtd5cdk.png\"\/><br \/>  <em>\u041a\u0440\u0438\u0432\u044b\u0435 \u043f\u043e\u0442\u0435\u0440\u044c \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 (CNN)<\/em><\/p>\n<p>  <\/p>\n<p>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e CNN \u043c\u043e\u0436\u0435\u0442 \u0443\u043b\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u041f\u0440\u043e\u0433\u043e\u043d\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># oracle dict of true score for each seq oracle = dict(mer8[['seq','score']].values)  def quick_seq_pred(model, desc, seqs, oracle):     '''     Given a model and some sequences, get the model's predictions     for those sequences and compare to the oracle (true) output     '''     print(f\"__{desc}__\")     for dna in seqs:         s = torch.tensor(one_hot_encode(dna)).unsqueeze(0).to(DEVICE)         pred = model(s.float())         actual = oracle[dna]         diff = pred.item() - actual         print(f\"{dna}: pred:{pred.item():.3f} actual:{actual:.3f} ({diff:.3f})\")  def quick_8mer_pred(model, oracle):     seqs1 = (\"poly-X seqs\",['AAAAAAAA', 'CCCCCCCC','GGGGGGGG','TTTTTTTT'])     seqs2 = (\"other seqs\", ['AACCAACA','CCGGTGAG','GGGTAAGG', 'TTTCGTTT'])     seqsTAT = (\"with TAT motif\", ['TATAAAAA','CCTATCCC','GTATGGGG','TTTATTTT'])     seqsGCG = (\"with GCG motif\", ['AAGCGAAA','CGCGCCCC','GGGCGGGG','TTGCGTTT'])     TATGCG =  (\"both TAT and GCG\",['ATATGCGA','TGCGTATT'])      for desc,seqs in [seqs1, seqs2, seqsTAT, seqsGCG, TATGCG]:         quick_seq_pred(model, desc, seqs, oracle)         print()          # Ask the trained Linear model to make  # predictions for some 8-mers quick_8mer_pred(model_lin, oracle)  # prints: # __poly-X seqs__ # AAAAAAAA: pred:23.230 actual:20.000 (3.230) # CCCCCCCC: pred:13.582 actual:17.000 (-3.418) # GGGGGGGG: pred:7.006 actual:14.000 (-6.994) # TTTTTTTT: pred:17.767 actual:11.000 (6.767)  # __other seqs__ # AACCAACA: pred:18.818 actual:18.875 (-0.057) # CCGGTGAG: pred:12.205 actual:15.125 (-2.920) # GGGTAAGG: pred:13.826 actual:15.125 (-1.299) # TTTCGTTT: pred:14.815 actual:12.125 (2.690)  # __with TAT motif__ # TATAAAAA: pred:22.146 actual:27.750 (-5.604) # CCTATCCC: pred:16.931 actual:25.875 (-8.944) # GTATGGGG: pred:12.141 actual:24.000 (-11.859) # TTTATTTT: pred:18.266 actual:22.125 (-3.859)  # __with GCG motif__ # AAGCGAAA: pred:16.736 actual:8.125 (8.611) # CGCGCCCC: pred:12.346 actual:6.250 (6.096) # GGGCGGGG: pred:7.907 actual:4.375 (3.532) # TTGCGTTT: pred:12.839 actual:2.500 (10.339)  # __both TAT and GCG__ # ATATGCGA: pred:15.664 actual:15.875 (-0.211) # TGCGTATT: pred:14.771 actual:13.625 (1.146) <\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0437\u00a0\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c G\u00a0\u0438\u00a0\u0437\u0430\u0432\u044b\u0448\u0430\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c\u00a0T. \u041f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u043e\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u00a0\u0437\u0430\u043c\u0435\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0<code>GCG<\/code> \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u0438\u0435 \u0431\u0430\u043b\u043b\u044b, \u0430\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0<code>TAT<\/code>\u00a0\u2014 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0438\u0435. \u041d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u00a0\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0436\u0434\u0443 <code>GCG<\/code> \u0438\u00a0<code>GAG<\/code>, \u043e\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043d\u0438\u0436\u0430\u0435\u0442 \u0431\u0430\u043b\u043b \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0G. \u0418\u0437\u00a0\u043d\u0430\u0448\u0435\u0439 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0431\u0430\u043b\u043b\u043e\u0432 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u00a0\u0442\u0430\u043a. \u0414\u0435\u043b\u043e \u0442\u0443\u0442 \u043d\u0435\u00a0\u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e G\u00a0\u0432\u0440\u0435\u0434\u043d\u044b \u0438\u043b\u0438, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435, \u0441\u0443\u0431\u0432\u0438\u0442\u0430\u043b\u044c\u043d\u044b, \u0430\u00a0\u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0440\u0435\u0434\u043d\u044b <strong>\u0438\u043c\u0435\u043d\u043d\u043e<\/strong> \u043c\u043e\u0442\u0438\u0432\u044b <code>GCG<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># Ask the trained CNN model to make  # predictions for some 8-mers quick_8mer_pred(model_cnn, oracle)  # prints:  # __poly-X seqs__ # AAAAAAAA: pred:19.722 actual:20.000 (-0.278) # CCCCCCCC: pred:16.620 actual:17.000 (-0.380) # GGGGGGGG: pred:13.771 actual:14.000 (-0.229) # TTTTTTTT: pred:10.767 actual:11.000 (-0.233)  # __other seqs__ # AACCAACA: pred:18.530 actual:18.875 (-0.345) # CCGGTGAG: pred:14.925 actual:15.125 (-0.200) # GGGTAAGG: pred:14.900 actual:15.125 (-0.225) # TTTCGTTT: pred:11.789 actual:12.125 (-0.336)  # __with TAT motif__ # TATAAAAA: pred:26.154 actual:27.750 (-1.596) # CCTATCCC: pred:24.321 actual:25.875 (-1.554) # GTATGGGG: pred:22.870 actual:24.000 (-1.130) # TTTATTTT: pred:20.581 actual:22.125 (-1.544)  # __with GCG motif__ # AAGCGAAA: pred:8.689 actual:8.125 (0.564) # CGCGCCCC: pred:6.531 actual:6.250 (0.281) # GGGCGGGG: pred:5.029 actual:4.375 (0.654) # TTGCGTTT: pred:3.055 actual:2.500 (0.555)  # __both TAT and GCG__ # ATATGCGA: pred:15.178 actual:15.875 (-0.697) # TGCGTATT: pred:12.853 actual:13.625 (-0.772) <\/code><\/pre>\n<p>  <\/p>\n<p>CNN \u043b\u0443\u0447\u0448\u0435 \u0443\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0442\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u043c\u0438 \u043c\u043e\u0442\u0438\u0432\u0430\u043c\u0438! \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0435\u0440\u0435\u0432\u0430\u0440\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441 \u043c\u043e\u0442\u0438\u0432\u0430\u043c\u0438 \u0438 \u0431\u0435\u0437 \u043d\u0438\u0445.<\/p>\n<p>  <\/p>\n<h2>6. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043b\u044e\u0431\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043e\u0446\u0435\u043d\u043a\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u0430\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043f\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u0430\u043c, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d\u0430 <em>\u043d\u0438\u043a\u043e\u0433\u0434\u0430<\/em> \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0430\u0441\u044c \u0432 \u0445\u043e\u0434\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0438\u0434\u043d\u0430 \u043d\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import altair as alt from sklearn.metrics import r2_score  def parity_plot(model_name,df,r2):     '''     Given a dataframe of samples with their true and predicted values,     make a scatterplot.     '''     plt.scatter(df['truth'].values, df['pred'].values, alpha=0.2)          # y=x line     xpoints = ypoints = plt.xlim()     plt.plot(xpoints, ypoints, linestyle='--', color='k', lw=2, scalex=False, scaley=False)      plt.ylim(xpoints)     plt.ylabel(\"Predicted Score\",fontsize=14)     plt.xlabel(\"Actual Score\",fontsize=14)     plt.title(f\"{model_name} (r2:{r2:.3f})\",fontsize=20)     plt.show()      def alt_parity_plot(model,df, r2):     '''     Make an interactive parity plot with altair     '''     chart = alt.Chart(df).mark_circle(size=100,opacity=0.4).encode(         alt.X('truth:Q'),         alt.Y('pred:Q'),         tooltip=['seq:N']     ).properties(         title=f'{model} (r2:{r2:.3f})'     ).interactive()          chart.save(f'alt_out\/parity_plot_{model}.html')     display(chart)  def parity_pred(models, seqs, oracle,alt=False):     '''Given some sequences, get the model's predictions '''     dfs = {} # key: model name, value: parity_df          for model_name,model in models:         print(f\"Running {model_name}\")         data = []         for dna in seqs:             s = torch.tensor(one_hot_encode(dna)).unsqueeze(0).to(DEVICE)             actual = oracle[dna]             pred = model(s.float())             data.append([dna,actual,pred.item()])         df = pd.DataFrame(data, columns=['seq','truth','pred'])         r2 = r2_score(df['truth'],df['pred'])         dfs[model_name] = (r2,df)                  #plot parity plot         if alt: # make an altair plot             alt_parity_plot(model_name, df, r2)         else:             parity_plot(model_name, df, r2)              # generate plots seqs = test_df['seq'].values models = [     (\"Linear\", model_lin),     (\"CNN\", model_cnn) ] parity_pred(models, seqs, oracle) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yd\/dw\/g7\/yddwg7ifdrjli4g38p3hwpakv3q.png\" data-src=\"https:\/\/habrastorage.org\/webt\/yd\/dw\/g7\/yddwg7ifdrjli4g38p3hwpakv3q.png\"\/><\/p>\n<p><em>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438\u00a0\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/em><\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u043d\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0423\u00a0\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0441\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0442\u043e\u0447\u043d\u043e \u043b\u044f\u0433\u0443\u0442 \u043d\u0430\u00a0\u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c <code>y=x<\/code>. \u042d\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u00a0\u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 <code>y=x<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u0437\u0430\u0432\u044b\u0448\u0435\u043d\u044b \u0438\u043b\u0438 \u0437\u0430\u043d\u0438\u0436\u0435\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0438\u044e \u0442\u0440\u0435\u043d\u0434\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u043e \u043e\u0431\u0438\u043b\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u043d\u0438\u0436\u043d\u0435\u0439 \u0438 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f (\u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043c\u043e\u0442\u0438\u0432\u043e\u0432) \u043b\u0435\u0433\u043a\u043e \u0441\u0431\u0438\u0432\u0430\u044e\u0442 \u044d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u0442\u043e\u043b\u043a\u0443.<\/p>\n<p>  <\/p>\n<p>CNN \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0431\u043b\u0438\u0437\u043a\u0438\u0435 \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c, \u0432\u0435\u0434\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0430\u0448\u0435\u0433\u043e CNN \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044f\u0434\u0440\u0430 \u0442\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043c\u043e\u0442\u0438\u0432\u043e\u0432 \u0432\u0434\u043e\u043b\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, CNN\u00a0\u2014 \u0442\u043e\u0436\u0435 \u043d\u0435\u00a0\u0438\u0434\u0435\u0430\u043b. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043d\u043e\u00a0\u0446\u0435\u043b\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u00a0\u0432\u00a0\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0435. \u041c\u044b\u00a0\u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0430\u043c\u0438. \u0418\u00a0\u044f\u00a0\u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0430, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u0441\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435\u00a0\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Altair:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ro\/y6\/j0\/roy6j0bfdim_xwo9sdkofzckvhc.png\" width=\"780\" data-src=\"https:\/\/habrastorage.org\/webt\/ro\/y6\/j0\/roy6j0bfdim_xwo9sdkofzckvhc.png\"\/>  <\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u043d\u0435 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043d\u0430\u0448\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0438\u043c\u0435\u044e\u0442 <em>\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435<\/em> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043c\u043e\u0442\u0438\u0432\u043e\u0432! \u041f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0435 \u0431\u0430\u043b\u043b\u043e\u0432 \u043c\u044b\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u0432\u0430\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00b1 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u00a0\u043e\u0434\u0438\u043d \u043c\u043e\u0442\u0438\u0432. \u0412\u00a0\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438\u00a0\u0436\u0435 \u0440\u0430\u0437\u0443\u043c\u043d\u043e \u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u00ab\u0431\u043e\u043d\u0443\u0441\u043e\u0432\u00bb \u0437\u0430\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0442\u0438\u0432\u043e\u0432. \u0412\u00a0\u0441\u0432\u043e\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u044e \u00ab\u0431\u043e\u043d\u0443\u0441\u00bb \u0437\u0430\u00a01 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043c\u043e\u0442\u0438\u0432\u0430, \u043d\u043e\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0431\u0430\u043b\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0430\u0447\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412\u00a0\u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0434\u043e\u0440\u043e\u0432\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0438\u00a0\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0445\u00a0\u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0437\u0434\u0435\u0441\u044c \u044f\u00a0\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0430\u043d\u0443\u043b\u0430\u00a0\u0435\u0451\u2026 \u0412\u043f\u0440\u043e\u0447\u0435\u043c, R2 0,95\u00a0\u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435\u00a0\u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e.<\/p>\n<p>  <\/p>\n<h2>7. \u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 CNN \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f, \u0447\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u044e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0433\u0440\u0430\u043d\u0438\u0446, \u0446\u0432\u0435\u0442\u0430 \u0438\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0414\u041d\u041a \u043c\u044b \u0438\u0441\u0445\u043e\u0434\u0438\u043c \u0438\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043a\u0430\u043d\u0435\u0440\u044b \u043c\u043e\u0442\u0438\u0432\u043e\u0432. \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 \u0432\u0435\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0414\u041d\u041a. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c <em>\u0442\u043e\u0447\u043d\u043e\u0439<\/em> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u0435 \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 2 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c A; \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u0430\u044f), \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0436\u0435 \u0441 \u043f\u043e\u0447\u0442\u0438 \u0440\u0430\u0432\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043e\u0432 (\u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u0430\u044f, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043d\u0438\u0437\u043a\u0430\u044f).<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043b\u043e\u044f\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u0438 \u043d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u043e\u0439 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d. \u041e\u0434\u043d\u0430\u043a\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0432\u0441\u0451 \u0436\u0435 \u0432\u044b\u044f\u0432\u043b\u044f\u044e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u043a\u0430\u043a \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043f\u043b\u043e\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u044b, \u0442\u0430\u043a \u0438 \u0432 \u0432\u0438\u0434\u0435 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import logomaker  def get_conv_layers_from_model(model):     '''     Given a trained model, extract its convolutional layers     '''     model_children = list(model.children())          # counter to keep count of the conv layers     model_weights = [] # we will save the conv layer weights in this list     conv_layers = [] # we will save the actual conv layers in this list     bias_weights = []     counter = 0       # append all the conv layers and their respective weights to the list     for i in range(len(model_children)):         # get model type of Conv1d         if type(model_children[i]) == nn.Conv1d:             counter += 1             model_weights.append(model_children[i].weight)             conv_layers.append(model_children[i])             bias_weights.append(model_children[i].bias)          # also check sequential objects' children for conv1d         elif type(model_children[i]) == nn.Sequential:             for child in model_children[i]:                 if type(child) == nn.Conv1d:                     counter += 1                     model_weights.append(child.weight)                     conv_layers.append(child)                     bias_weights.append(child.bias)      print(f\"Total convolutional layers: {counter}\")     return conv_layers, model_weights, bias_weights  def view_filters(model_weights, num_cols=8):     model_weights = model_weights[0]     num_filt = model_weights.shape[0]     filt_width = model_weights[0].shape[1]     num_rows = int(np.ceil(num_filt\/num_cols))          # visualize the first conv layer filters     plt.figure(figsize=(20, 17))      for i, filter in enumerate(model_weights):         ax = plt.subplot(num_rows, num_cols, i+1)         ax.imshow(filter.cpu().detach(), cmap='gray')         ax.set_yticks(np.arange(4))         ax.set_yticklabels(['A', 'C', 'G','T'])         ax.set_xticks(np.arange(filt_width))         ax.set_title(f\"Filter {i}\")      plt.tight_layout()     plt.show()      conv_layers, model_weights, bias_weights = get_conv_layers_from_model(model_cnn) view_filters(model_weights) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/u7\/jq\/gf\/u7jqgfme0nnrwj2zythaowf99lw.png\" data-src=\"https:\/\/habrastorage.org\/webt\/u7\/jq\/gf\/u7jqgfme0nnrwj2zythaowf99lw.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043d\u043e\u00a0\u043e\u0431\u044b\u0447\u043d\u043e \u043b\u044e\u0434\u0438 \u043b\u044e\u0431\u044f\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u00a0\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u00a0\u0432\u0438\u0434\u0435 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0442\u0438\u0432\u043e\u0432, \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043c\u043e\u0442\u0438\u0432\u0430 \u043f\u043e\u00a0X, \u0430\u00a0\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043e\u0432 \u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437\u00a0\u043d\u0438\u0445\u00a0\u2014 \u043f\u043e\u00a0Y. \u0427\u0430\u0441\u0442\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0\u0431\u0438\u0442\u044b (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e).<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432\u00a0\u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0435\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432: \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0432\u0435\u0441\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0432\u0434\u043e\u043b\u044c \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0440\u044f\u043c\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u00a0\u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0442 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 (\u0430\u00a0\u0442\u0430\u043a\u0436\u0435 \u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u0435\u0441\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438).<\/p>\n<p>  <\/p>\n<p>\u041c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u0435\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0441\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 (\u0442\u043e\u00a0\u0435\u0441\u0442\u044c \u0434\u0430\u0434\u0443\u0442 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f). \u0421\u043e\u0431\u0438\u0440\u0430\u044f \u043f\u043e\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0414\u041d\u041a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u044e\u0442 \u0441\u0430\u043c\u044b\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u043c\u044b\u00a0\u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0435\u0441\u043e\u0432\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u00ab\u0432\u044b\u0441\u043e\u043a\u043e\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439\u00bb \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u00a0\u0432\u0438\u0434\u0435 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u0430 \u043c\u043e\u0442\u0438\u0432\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/iy\/mb\/w0\/iymbw0wpy_tpmoh7xribmdbr53y.png\" data-src=\"https:\/\/habrastorage.org\/webt\/iy\/mb\/w0\/iymbw0wpy_tpmoh7xribmdbr53y.png\"\/><br \/>  <em>\u0421\u0445\u0435\u043c\u0430, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0441\u0431\u043e\u0440\u0430 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u044b \u043c\u043e\u0442\u0438\u0432\u043e\u0432 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0441\u0432\u0451\u0440\u0442\u043a\u0438<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def get_conv_output_for_seq(seq, conv_layer):     '''     Given an input sequeunce and a convolutional layer,      get the output tensor containing the conv filter      activations along each position in the sequence     '''     # format seq for input to conv layer (OHE, reshape)     seq = torch.tensor(one_hot_encode(seq)).unsqueeze(0).permute(0,2,1).to(DEVICE)      # run seq through conv layer     with torch.no_grad(): # don't want as part of gradient graph         # apply learned filters to input seq         res = conv_layer(seq.float())         return res[0]       def get_filter_activations(seqs, conv_layer,act_thresh=0):     '''     Given a set of input sequences and a trained convolutional layer,      determine the subsequences for which each filter in the conv layer      activate most strongly.           1.) Run seq inputs through conv layer.      2.) Loop through filter activations of the resulting tensor, saving the             position where filter activations were > act_thresh.      3.) Compile a count matrix for each filter by accumulating subsequences which             activate the filter above the threshold act_thresh     '''     # initialize dict of pwms for each filter in the conv layer     # pwm shape: 4 nucleotides X filter width, initialize to 0.0s     num_filters = conv_layer.out_channels     filt_width = conv_layer.kernel_size[0]     filter_pwms = dict((i,torch.zeros(4,filt_width)) for i in range(num_filters))          print(\"Num filters\", num_filters)     print(\"filt_width\", filt_width)          # loop through a set of sequences and collect subseqs where each filter activated     for seq in seqs:         # get a tensor of each conv filter activation along the input seq         res = get_conv_output_for_seq(seq, conv_layer)          # for each filter and it's activation vector         for filt_id,act_vec in enumerate(res):             # collect the indices where the activation level              # was above the threshold             act_idxs = torch.where(act_vec>act_thresh)[0]             activated_positions = [x.item() for x in act_idxs]              # use activated indicies to extract the actual DNA             # subsequences that caused filter to activate             for pos in activated_positions:                 subseq = seq[pos:pos+filt_width]                 #print(\"subseq\",pos, subseq)                 # transpose OHE to match PWM orientation                 subseq_tensor = torch.tensor(one_hot_encode(subseq)).T                  # add this subseq to the pwm count for this filter                 filter_pwms[filt_id] += subseq_tensor                              return filter_pwms  def view_filters_and_logos(model_weights,filter_activations, num_cols=8):     '''     Given some convolutional model weights and filter activation PWMs,      visualize the heatmap and motif logo pairs in a simple grid     '''     model_weights = model_weights[0].squeeze(1)     print(model_weights.shape)      # make sure the model weights agree with the number of filters     assert(model_weights.shape[0] == len(filter_activations))          num_filts = len(filter_activations)     num_rows = int(np.ceil(num_filts\/num_cols))*2+1      # ^ not sure why +1 is needed... complained otherwise          plt.figure(figsize=(20, 17))      j=0 # use to make sure a filter and it's logo end up vertically paired     for i, filter in enumerate(model_weights):         if (i)%num_cols == 0:             j += num_cols          # display raw filter         ax1 = plt.subplot(num_rows, num_cols, i+j+1)         ax1.imshow(filter.cpu().detach(), cmap='gray')         ax1.set_yticks(np.arange(4))         ax1.set_yticklabels(['A', 'C', 'G','T'])         ax1.set_xticks(np.arange(model_weights.shape[2]))         ax1.set_title(f\"Filter {i}\")          # display sequence logo         ax2 = plt.subplot(num_rows, num_cols, i+j+1+num_cols)         filt_df = pd.DataFrame(filter_activations[i].T.numpy(),columns=['A','C','G','T'])         filt_df_info = logomaker.transform_matrix(filt_df,from_type='counts',to_type='information')         logo = logomaker.Logo(filt_df_info,ax=ax2)         ax2.set_ylim(0,2)         ax2.set_title(f\"Filter {i}\")      plt.tight_layout()       # just use some seqs from test_df to activate filters some_seqs = random.choices(seqs, k=3000)  filter_activations = get_filter_activations(some_seqs, conv_layers[0],act_thresh=1) view_filters_and_logos(model_weights,filter_activations)  # prints: # Num filters 32 # filt_width 3 # torch.Size([32, 4, 3]) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/1400\/1*drImfBkrQ1Uj3VJDc_h8CQ.png\" data-src=\"https:\/\/miro.medium.com\/max\/1400\/1*drImfBkrQ1Uj3VJDc_h8CQ.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0418\u0437 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f CNN \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0443\u043b\u043e\u0432\u0438\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0442\u0438\u0432\u044b TAT \u0438 GCG, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u0445.<\/p>\n<p>  <\/p>\n<p>\u041e\u00a0\u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435\u0442 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043c\u043d\u0435\u043d\u0438\u044f. \u0412\u00a0\u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0441\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u044f\u043c\u0438 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043b\u043e\u044f\u0445 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u00a0\u0442\u0430\u043a\u0438\u043c\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 (<a href=\"https:\/\/journals.plos.org\/ploscompbiol\/article?id=10.1371\/journal.pcbi.1007560\">\u041a\u0443 \u0438\u00a0\u042d\u0434\u0434\u0438, 2019<\/a>]). \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u00a0\u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u0435\u0440\u0435\u0448\u043b\u0430 \u043a\u00a0\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438\u00a0\u0434\u0440\u0443\u0433\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043a\u0430\u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0442\u0438\u0432\u044b, \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b!<\/p>\n<p>  <\/p>\n<h2>8. \u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412\u00a0\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 CNN \u0432\u00a0PyTorch \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439\u00a0\u0414\u041d\u041a. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u00a0\u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0438 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432. \u041d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0431\u0430\u043b\u043b\u043e\u0432, \u0441\u043a\u043e\u0440\u0435\u0435, \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0442\u043e\u0440\u043d\u044b\u0445 \u043c\u043e\u0442\u0438\u0432\u043e\u0432 \u0432\u00a0\u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 PyTorch \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c. \u0412\u00a0\u044d\u0442\u043e\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0439 CNN \u0441\u043e\u00a0\u0441\u0434\u0432\u0438\u0433\u043e\u0432\u044b\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438 \u043a\u00a0\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0443 \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0431\u0430\u043b\u043b\u043e\u0432. CNN \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0441\u0435\u0431\u044f \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0432\u044b\u044f\u0432\u0438\u0432\u0448\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0443\u043a\u043b\u0435\u043e\u0442\u0438\u0434\u043e\u0432 (\u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u00a0\u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 CNN \u043a\u00a0\u0414\u041d\u041a \u0432\u00a0\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0437\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0440\u0430\u0431\u043e\u0442:<\/p>\n<p>  <\/p>\n<ul>\n<li>DeepBind: <a href=\"https:\/\/www.nature.com\/articles\/nbt.3300\">Alipanahi et\u00a0al\u00a02015<\/a>.<\/li>\n<li>DeepSea: <a href=\"https:\/\/www.ncbi.nlm.nih.gov\/pmc\/articles\/PMC4768299\/\">Zhou and Troyanskaya 2015<\/a>.<\/li>\n<li>Basset: <a href=\"https:\/\/pubmed.ncbi.nlm.nih.gov\/27197224\/\">Kelley et\u00a0al\u00a02016<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u00a0PyTorch \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0435\u0439 \u0438\u00a0\u0414\u041d\u041a, \u043d\u043e\u00a0\u043c\u0430\u043b\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0441\u00a0\u043c\u0430\u0448\u0438\u043d\u043d\u044b\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <\/p>\n<h2>9. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<h3>\u041f\u0435\u0440\u0432\u043e\u0435<\/h3>\n<p>  <\/p>\n<p>\u0412\u00a0\u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0439. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0414\u041d\u041a\u00a0\u2014 \u043d\u0435\u00a0\u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c Conv1D \u043f\u043e\u00a0\u0432\u0441\u0435\u0439 \u0434\u043b\u0438\u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u0435\u00a0\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044f \u00ab\u0432\u043d\u0438\u0437\u00bb \u0438\u00a0\u00ab\u0432\u0432\u0435\u0440\u0445\u00bb. (\u0421\u0434\u0432\u0438\u0433 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u0438\u00a0\u00ab\u0432\u043d\u0438\u0437\u00bb \u043d\u0435\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446 \u0414\u041d\u041a \u0441\u00a0\u043e\u0434\u043d\u0438\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c. \u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043e\u0442\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u044f\u0434\u044b <code>A<\/code> \u0438\u00a0<code>C<\/code> \u043e\u0442\u00a0<code>G<\/code> \u0438\u00a0<code>T<\/code>\u00a0\u2014 \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u044f\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438).<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043c\u043d\u0435 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043e\u0442\u00a0keras, \u0438\u00a0\u0442\u043e\u0433\u0434\u0430 \u044f\u00a0\u043d\u0430\u0448\u043b\u0430 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f pytorch2keras. \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u00a0\u0441\u043b\u043e\u044f\u043c\u0438 Conv2d \u0438\u00a0\u0432\u044b\u0434\u0430\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u00a0\u0441\u043b\u043e\u044f\u043c Conv1d \u0432\u00a0\u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u043d\u00a0\u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u00a0\u0432\u0430\u043c, \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f CNN \u0432\u00a0Conv2D, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u0435\u0441\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043a\u0430\u043a \u0434\u043b\u044f Conv1D:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class DNA_CNN_2D(nn.Module):     def __init__(self,                  seq_len,                  num_filters=31,                  kernel_size=3,                 ):         super().__init__()         self.seq_len = seq_len                  self.conv_net = nn.Sequential(             nn.Conv2d(1, num_filters, kernel_size=(4,kernel_size)),             # ^^ changed from 4 to 1 channel, moved 4 to kernel_size             nn.ReLU(),             nn.Flatten(),             nn.Linear(num_filters*(seq_len-kernel_size+1), 1)         )       def forward(self, xb):         # reshape view to batch_ssize x 4channel x seq_len         # permute to put channel in correct order         xb = xb.permute(0,2,1).unsqueeze(1)         # ^^ Conv2D input fix                  #print(xb.shape)         out = self.conv_net(xb)         return out <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0412\u0442\u043e\u0440\u043e\u0435<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441\u00a0\u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439, \u0430\u00a0\u043d\u0435\u00a0\u0441\u00a0\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0435\u0439, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u00a0\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0451\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>CrossEntropyLoss<\/code>. \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e <code>CrossEntropyLoss<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0442\u00a0<code>MSELoss<\/code>. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">loss = loss_func(xb_out, yb.long().squeeze (1)) <\/code><\/pre>\n<p>  \u0410 \u043f\u043e\u043a\u0430 \u0443\u0447\u0451\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0442 \u0414\u041d\u041a, \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c \u0432\u0430\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0418\u0418, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0430\u044e\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u043a\u0440\u0443\u0433 \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_290922&amp;utm_term=conc\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist (24\u00a0\u043c\u0435\u0441\u044f\u0446\u0430)<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_290922&amp;utm_term=conc\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u00a0Python (15\u00a0\u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/a><\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0441\u0435 \u043a\u0443\u0440\u0441\u044b, \u043a\u043b\u0438\u043a\u043d\u0438\u0442\u0435\u00a0\u043f\u043e \u0431\u0430\u043d\u043d\u0435\u0440\u0443:<\/p>\n<p>  <a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_290922&amp;utm_term=banner\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cq\/na\/88\/cqna880todtt287i6ffb12uzzwk.png\" data-src=\"https:\/\/habrastorage.org\/webt\/cq\/na\/88\/cqna880todtt287i6ffb12uzzwk.png\"\/><\/a><\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043a\u0443\u0440\u0441\u043e\u0432<\/b>                         <\/p>\n<div class=\"spoiler_text\"><strong>Data Science \u0438\u00a0Machine Learning<\/strong>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/data-analyst-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/matematika-dlya-data-science#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/matematika-i-machine-learning-dlya-data-science?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438\u00a0Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/data-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e\u00a0Data Engineering<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438\u00a0Deep Learning\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/machine-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e\u00a0Machine Learning<\/a><\/li>\n<\/ul>\n<p>  <strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u00a0Python<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/frontend-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<\/ul>\n<p>  <strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/ios-razrabotchik-s-nulya?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_ios_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/android-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<\/ul>\n<p>  <strong>Java \u0438\u00a0C#<\/strong>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/java-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer-testirovshik-po?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430\u00a0JAVA<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/c-sharp-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/game-razrabotchik-na-unity-i-c-sharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430\u00a0Unity<\/a><\/li>\n<\/ul>\n<p>  <strong>\u041e\u0442\u00a0\u043e\u0441\u043d\u043e\u0432\u00a0\u2014 \u0432\u00a0\u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/algoritmy-i-struktury-dannyh?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438\u00a0\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/c-plus-plus-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/cyber-security-etichnij-haker?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_290922&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u00ab\u0411\u0435\u043b\u044b\u0439 \u0445\u0430\u043a\u0435\u0440\u00bb<\/a><\/li>\n<\/ul>\n<p>  <strong>\u0410\u00a0\u0442\u0430\u043a\u0436\u0435<\/strong>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/devops-ingineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_290922&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e\u00a0DevOps<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_290922&amp;utm_term=cat\">\u0412\u0441\u0435 \u043a\u0443\u0440\u0441\u044b<\/a><\/li>\n<\/ul>\n<p>  <\/div>\n<\/p><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/690562\/\"> https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/690562\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/690562\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/dg\/qk\/o0\/dgqko00xc8zp-j2vxomvhc0bbby.png\" data-src=\"https:\/\/habrastorage.org\/webt\/dg\/qk\/o0\/dgqko00xc8zp-j2vxomvhc0bbby.png\"\/><br \/>  <\/a>  <\/p>\n<p>\u0412\u0438\u0434\u0438\u043c\u043e, \u0430\u0441\u0442\u0440\u043e\u043b\u043e\u0433\u0438 \u0425\u0430\u0431\u0440\u0430 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u0434\u0435\u043d\u044c Python \u0432\u00a0\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b\u00a0\u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0430\u0441\u043f\u0438\u0440\u0430\u043d\u0442 \u042d\u0440\u0438\u043d \u0423\u0438\u043b\u0441\u043e\u043d \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c \u0443\u043c\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439\u00a0\u0414\u041d\u041a. \u0417\u0430\u00a0\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043f\u043e\u0434\u00a0\u043a\u0430\u0442\u00a0\u2014 \u043a\u00a0\u0441\u0442\u0430\u0440\u0442\u0443 \u043d\u0430\u0448\u0435\u0433\u043e <u><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;amp;utm_medium=habr&amp;amp;utm_campaign=article&amp;amp;utm_content=data-science_dspr_290922&amp;amp;utm_term=lead\">\u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430 \u043f\u043e\u00a0Data Science<\/a><\/u>.  <\/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-339052","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339052","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=339052"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339052\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=339052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=339052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=339052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}