{"id":305878,"date":"2020-06-25T09:00:23","date_gmt":"2020-06-25T09:00:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305878"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305878","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u043a\u0443\u043b\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TensorFlow \u0438 \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 (\u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f)"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508136\/\">\n<h2 id=\"tldr\">TL;DR<\/h2>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043b LSTM <em>(Long short-term memory)<\/em> \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c <em>(RNN)<\/em> \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0438\u0437 <em>~100k<\/em> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f TensorFlow. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 \u043c\u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c <em>&quot;\u0421\u043b\u0438\u0432\u043e\u0447\u043d\u0443\u044e \u0441\u043e\u0434\u0443 \u0441 \u043b\u0443\u043a\u043e\u043c&quot;<\/em>, <em>&quot;\u041a\u043b\u0443\u0431\u043d\u0438\u0447\u043d\u044b\u0439 \u0441\u0443\u043f \u0438\u0437 \u0441\u043b\u043e\u0435\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430&quot;<\/em>, <em>&quot;\u0427\u0430\u0439 \u0441\u043e \u0432\u043a\u0443\u0441\u043e\u043c \u0446\u0443\u043a\u0438\u043d\u0438&quot;<\/em> \u0438 <em>&quot;\u041b\u043e\u0441\u043e\u0441\u0435\u0432\u044b\u0439 \u043c\u0443\u0441\u0441 \u0438\u0437 \u0433\u043e\u0432\u044f\u0434\u0438\u043d\u044b&quot;<\/em> \u200d.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0430\u0439\u0442\u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/trekhleb.github.io\/machine-learning-experiments\/#\/experiments\/RecipeGenerationRNN\" rel=\"nofollow\"><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432: \u0414\u0435\u043c\u043e<\/strong><\/a> \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.<\/li>\n<li>\u200d <a href=\"https:\/\/github.com\/trekhleb\/machine-learning-experiments\/blob\/master\/experiments\/recipe_generation_rnn\/recipe_generation_rnn.ipynb\" rel=\"nofollow\"><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432: \u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430<\/strong><\/a> \u2014 Jupyter \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0441 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/li>\n<li>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/github.com\/trekhleb\/machine-learning-experiments\" rel=\"nofollow\"><strong> Interactive Machine Learning Experiments<\/strong><\/a> \u2014 \u0434\u0440\u0443\u0433\u0438\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a &quot;\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432&quot;, &quot;\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u044d\u0441\u043a\u0438\u0437\u043e\u0432&quot;, &quot;\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439&quot; \u0438 \u0442.\u0434.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u0435\u0442\u0430\u043b\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 LSTM \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.tensorflow.org\/\" rel=\"nofollow\">TensorFlow 2<\/a> \u0438 <a href=\"https:\/\/www.tensorflow.org\/guide\/keras\" rel=\"nofollow\">Keras API<\/a>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/413\/999\/0ec\/4139990ec63f03c35fab15d60ea74eff.gif\" alt=\"Cooking recipes generator demo\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"chemu-zhe-nasha-model-v-itoge-nauchitsya\">\u0427\u0435\u043c\u0443 \u0436\u0435 \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u0441\u044f<\/h2>\n<p>  <\/p>\n<p>\u0417\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0448\u0430 RNN \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0443\u0447\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u044b \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0439 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u0438 (\u0432\u043e\u0442 \u0431\u044b \u0441\u0430\u043c\u043e\u043c\u0443 \u0442\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0447\u0438\u0442\u044c \u044f\u0437\u044b\u043a\u0438!). \u041c\u043e\u0434\u0435\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0439\u043c\u0435\u0442, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: <em>\u25d8 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0446\u0435\u043f\u0442\u0430<\/em>, <em>\u2756 \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u0432<\/em> \u0438 <em>\u273c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044e<\/em>. \u0418\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u2014 \u0433\u043b\u0443\u043f\u044b\u0435 \u0438 \u0441\u043c\u0435\u0448\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 (\u043e\u043d\u0438 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u044b\u043b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c): <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\u25d8 [NAME]  Orange Club Tea Sandwich Cookies  \u2756 [INGREDIENTS]  \u2022 1 cup (2 sticks) unsalted butter, softened \u2022 1 cup confectioners' sugar \u2022 1\/2 cup flaxseed meal \u2022 1\/2 cup shelled pumpkin seeds (pecans, blanched and sliced) \u2022 2 teaspoons vanilla extract  \u273c [INSTRUCTIONS]  \ufe0e Preheat oven to 350 degrees F. \ufe0e Combine cake mix, milk, egg and sugar in a large bowl. Stir until combined and smooth but not sticky. Using a spatula, sprinkle the dough biscuits over the bottom of the pan. Sprinkle with sugar, and spread evenly. Bake for 20 minutes. Remove from the oven and cool on a rack. To serve, add the chocolate.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\u25d8 [NAME]  Mushrooms with Lentil Stewed Shallots and Tomatoes  \u2756 [INGREDIENTS]  \u2022 1 tablespoon olive oil \u2022 3 cloves garlic, smashed \u2022 Kosher salt \u2022 1 1\/2 pounds lean ground turkey \u2022 1 cup coarsely peeled tart apples \u2022 2 tablespoons chopped garlic \u2022 1 teaspoon ground cumin \u2022 1\/2 teaspoon cayenne pepper \u2022 1 teaspoon chopped fresh thyme \u2022 3\/4 cup chopped fresh basil \u2022 1\/2 small carrot, halved lengthwise and cut into 1\/2-inch pieces \u2022 1 roasted red pepper, halved and sliced vertically diced and separated into rough chops \u2022 3 tablespoons unsalted butter \u2022 2 cups shredded mozzarella \u2022 1\/4 cup grated parmesan cheese \u2022 1\/4 cup prepared basil pesto  \u273c [INSTRUCTIONS]  \ufe0e Stir the olive oil, garlic, thyme and 1 teaspoon salt in a saucepan; bring to a simmer over medium heat. Remove from the heat. Add the basil and toast the soup for 2 minutes. \ufe0e Meanwhile, heat 4 to 4 inches vegetable oil in the skillet over medium-high heat. Add the olive oil, garlic, 1\/2 teaspoon salt and 1\/2 teaspoon pepper and cook, stirring often, until cooked through, a<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0443\u043c\u0435\u0435\u0442 &quot;\u043f\u0438\u0441\u0430\u0442\u044c&quot; \u043d\u0430 \u0443\u0437\u043a\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u043a\u0443\u043b\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c, \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u0430 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0438\u0445 \u043d\u0430 \u0441\u0435\u043a\u0446\u0438\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u043a\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u0440\u043e\u0441\u0438\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u043f\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0430\u043f\u0435\u043b\u044c\u0441\u0438\u043d\u044b, \u043d\u043e \u0432 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043b\u043e\u0441\u043e\u0441\u044f. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438, \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0435\u0433\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bd0\/d32\/56b\/bd0d3256b5e96aafe4d1ee2392dd3b59.jpg\" alt=\"\u0413\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b, \u0430 \u043d\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435\"><\/p>\n<p>  <\/p>\n<p>\ufe0f _\u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0446\u0435\u043b\u044c\u044e. \u042d\u0442\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u044b <strong>\u043d\u0435<\/strong> \u0434\u043b\u044f \u0433\u043e\u0442\u043e\u0432\u043a\u0438! \u0414\u043b\u044f \u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e <a href=\"https:\/\/www.instagram.com\/home_full_of_recipes\/\" rel=\"nofollow\">\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0435<\/a>._<\/p>\n<p>  <\/p>\n<h2 id=\"teoreticheskaya-baza\">\u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0430\u0437\u0430<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Recurrent_neural_network\" rel=\"nofollow\">\u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 (RNNs)<\/a> \u0438, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Long_short-term_memory\" rel=\"nofollow\">Long short-term memory (LSTM)<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u0438 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u0435\u0437\u043d\u0430\u043a\u043e\u043c\u044b, \u044f \u0431\u044b \u043f\u043e\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0439\u0442\u0438 \u043a\u0443\u0440\u0441 <a href=\"https:\/\/www.coursera.org\/specializations\/deep-learning\" rel=\"nofollow\">Deep Learning Specialization<\/a> \u043d\u0430 Coursera \u043e\u0442 <em>Andrew Ng<\/em>. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u044f <a href=\"http:\/\/karpathy.github.io\/2015\/05\/21\/rnn-effectiveness\/\" rel=\"nofollow\">Unreasonable Effectiveness of Recurrent Neural Networks<\/a> \u043e\u0442 <em>Andrej Karpathy<\/em> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445, <strong>\u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 (RNN)<\/strong> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a \u0440\u0435\u0447\u044c, \u0433\u043e\u043b\u043e\u0441, \u0442\u0435\u043a\u0441\u0442 \u0438\u043b\u0438 \u043c\u0443\u0437\u044b\u043a\u0430. \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430, \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438, \u0441\u0438\u043d\u0442\u0435\u0437\u0430 \u0433\u043e\u043b\u043e\u0441\u0430 \u0438 \u0442.\u0434. \u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c RNN \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u043f\u0430\u043c\u044f\u0442\u044c (state, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u043b\u043e <code>He<\/code>, \u0442\u043e RNN \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043b\u043e\u0432\u043e\u043c \u0431\u0443\u0434\u0435\u0442 <code>speaks<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>speak<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0430\u0437\u0443 <code>He speaks<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u043e \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u043e\u0432\u0435 <code>He<\/code> \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/79e\/174\/934\/79e174934c03239fc046bf55357ce7bd.svg\" alt=\"Recurrent Neural Network\"><\/p>\n<p>  <\/p>\n<blockquote><p>_\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0442\u043e \u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Recurrent_neural_network\" rel=\"nofollow\">Wikipedia<\/a>_<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/11e\/cf2\/0ea\/11ecf20ea5599f22b8bf1c392290aefe.png\" alt=\"Basic architectures of GRU and LSTM cells\"><\/p>\n<p>  <\/p>\n<blockquote><p><em>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0442\u043e \u0441 <a href=\"https:\/\/towardsdatascience.com\/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21\" rel=\"nofollow\">Towards Data Science<\/a><\/em><\/p><\/blockquote>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e RNN (\u0438 LSTM \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438) \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <em>\u0441\u043b\u043e\u0432\u043e-\u0441\u043b\u043e\u0432\u043e<\/em>, \u043d\u043e \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <em>\u0441\u0438\u043c\u0432\u043e\u043b-\u0441\u0438\u043c\u0432\u043e\u043b<\/em>! \u041d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c: \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0432\u0430, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b. \u0412\u0430\u0436\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0438\u0434\u0443\u0442 \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <code>['H', 'e']<\/code>. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u043c LSTM \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c, \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c <code>&lt;stop_word&gt;<\/code> (\u0438\u043c\u0435\u044f \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u043e\u0432\u043e <code>He<\/code>, \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f), \u0438\u043b\u0438 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c <code>l<\/code> (\u0438\u043c\u0435\u044f \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043e\u043d\u0430 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>Hello<\/code>). \u0422\u0430\u043a\u043e\u0439 \u0442\u0438\u043f RNN \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0439 RNN<\/strong> (character-level RNN).<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u043c\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u0443\u0434\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0443\u043b\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 LSTM \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 (\u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u043a\u0432, \u0430 \u043d\u0435 \u0441\u043b\u043e\u0432).<\/p>\n<p>  <\/p>\n<h2 id=\"nabor-dannyh-dlya-trenirovki\">\u041d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0438\u0445 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u041e\u0434\u043d\u0438\u043c\u0438 \u0438\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043f\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.kaggle.com\/kaggle\/recipe-ingredients-dataset\/home\" rel=\"nofollow\">Recipe Ingredients Dataset<\/a> <em>(\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u0432)<\/em><\/li>\n<li><a href=\"http:\/\/pic2recipe.csail.mit.edu\/\" rel=\"nofollow\">Recipe1M+<\/a> <em>(\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435)<\/em><\/li>\n<li><a href=\"https:\/\/www.kaggle.com\/hugodarwood\/epirecipes?select=full_format_recipes.json\" rel=\"nofollow\">Epicurious \u2014 Recipes with Rating and Nutrition<\/a> <em>(\u043e\u043a\u043e\u043b\u043e ~20000 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0435)<\/em><\/li>\n<li><a href=\"https:\/\/eightportions.com\/datasets\/Recipes\/\" rel=\"nofollow\">Recipe box<\/a> <em>(\u043e\u043a\u043e\u043b\u043e ~125,000 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0441 \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u043f\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u2014 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0434\u043e)<\/em><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 &quot;Recipe box&quot;. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u0442\u0430\u043a\u0436\u0435 \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u0430\u043a \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b, \u0442\u0430\u043a \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044e. <\/p>\n<p>  <\/p>\n<h2 id=\"nastraivaem-pesochnicu-dlya-trenirovki-na-tensorflow-i-python\">\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430 TensorFlow \u0438 Python<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432, \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 Python \u043a\u043e\u0434\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043a\u043e\u0434 (Jupyter notebook) \u0432 <a href=\"https:\/\/colab.research.google.com\/github\/trekhleb\/machine-learning-experiments\/blob\/master\/experiments\/recipe_generation_rnn\/recipe_generation_rnn.ipynb\" rel=\"nofollow\">GoogleColab<\/a> <em>(\u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f)<\/em>.<\/li>\n<li>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043a\u043e\u0434 (Jupyter notebook) \u0432 <a href=\"https:\/\/mybinder.org\/v2\/gh\/trekhleb\/machine-learning-experiments\/master?filepath=experiments\/recipe_generation_rnn\/recipe_generation_rnn.ipynb\" rel=\"nofollow\">Binder<\/a> <em>(\u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f)<\/em>.<\/li>\n<li>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/trekhleb\/machine-learning-experiments#how-to-use-this-repository-locally\" rel=\"nofollow\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Jupyter notebook \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e<\/a>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u042f \u0431\u044b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f GoogleColab, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a (\u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435), \u0430 \u0442\u0430\u043a\u0436\u0435 GoogleColab \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 GPU \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"importiruem-zavisimosti\">\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import json  # \u0423\u0442\u0438\u043b\u0438\u0442\u044b. import platform import time import pathlib import os<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e <em>2-\u0439<\/em> \u0432\u0435\u0440\u0441\u0438\u0435\u0439 Tensorflow.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print('Python version:', platform.python_version()) print('Tensorflow version:', tf.__version__) print('Keras version:', tf.keras.__version__)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Python version: 3.7.6 Tensorflow version: 2.1.0 Keras version: 2.2.4-tf<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"zagruzhaem-dannye\">\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/utils\/get_file\" rel=\"nofollow\">tf.keras.utils.get_file<\/a>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>get_file()<\/code> \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u0437\u0430\u0442\u0435\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0442\u043e\u0442 \u0436\u0435 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0432 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. <\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u043a\u044d\u0448\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">CACHE_DIR = '.\/tmp' pathlib.Path(CACHE_DIR).mkdir(exist_ok=True)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435: <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">dataset_file_name = 'recipes_raw.zip' dataset_file_origin = 'https:\/\/storage.googleapis.com\/recipe-box\/recipes_raw.zip'  dataset_file_path = tf.keras.utils.get_file(     fname=dataset_file_name,     origin=dataset_file_origin,     cache_dir=CACHE_DIR,     extract=True,     archive_format='zip' )  print(dataset_file_path)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0443\u0442\u044c \u043a \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c:<\/p>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">.\/tmp\/datasets\/recipes_raw.zip<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0443 \u043d\u0430\u0441 \u0432 \u043a\u044d\u0448\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">!ls -la .\/tmp\/datasets\/<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">total 521128 drwxr-xr-x  7        224 May 13 18:10 . drwxr-xr-x  4        128 May 18 18:00 .. -rw-r--r--  1      20437 May 20 06:46 LICENSE -rw-r--r--  1   53355492 May 13 18:10 recipes_raw.zip -rw-r--r--  1   49784325 May 20 06:46 recipes_raw_nosource_ar.json -rw-r--r--  1   61133971 May 20 06:46 recipes_raw_nosource_epi.json -rw-r--r--  1   93702755 May 20 06:46 recipes_raw_nosource_fn.json<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 <em>3-\u0445<\/em> \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u044d\u0442\u0438\u0445 <em>3-\u0445<\/em> \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043e\u0434\u043d\u0443 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 <code>json<\/code> \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def load_dataset(silent=False):     # \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0432 \u043e\u0434\u0438\u043d \u043d\u0430\u0431\u043e\u0440.     dataset_file_names = [         'recipes_raw_nosource_ar.json',         'recipes_raw_nosource_epi.json',         'recipes_raw_nosource_fn.json',     ]      dataset = []      for dataset_file_name in dataset_file_names:         dataset_file_path = f'{CACHE_DIR}\/datasets\/{dataset_file_name}'          with open(dataset_file_path) as dataset_file:             json_data_dict = json.load(dataset_file)             json_data_list = list(json_data_dict.values())             dict_keys = [key for key in json_data_list[0]]             dict_keys.sort()             dataset += json_data_list              # \u042d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u0432\u044c\u044e \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.             if silent == False:                 print(dataset_file_path)                 print('===========================================')                 print('Number of examples: ', len(json_data_list), '\\n')                 print('Example object keys:\\n', dict_keys, '\\n')                 print('Example object:\\n', json_data_list[0], '\\n')                 print('Required keys:\\n')                 print('  title: ', json_data_list[0]['title'], '\\n')                 print('  ingredients: ', json_data_list[0]['ingredients'], '\\n')                 print('  instructions: ', json_data_list[0]['instructions'])                 print('\\n\\n')      return dataset    dataset_raw = load_dataset() <\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">.\/tmp\/datasets\/recipes_raw_nosource_ar.json =========================================== Number of examples:  39802   Example object keys:  ['ingredients', 'instructions', 'picture_link', 'title']   Example object:  {'title': 'Slow Cooker Chicken and Dumplings', 'ingredients': ['4 skinless, boneless chicken breast halves ADVERTISEMENT', '2 tablespoons butter ADVERTISEMENT', '2 (10.75 ounce) cans condensed cream of chicken soup ADVERTISEMENT', '1 onion, finely diced ADVERTISEMENT', '2 (10 ounce) packages refrigerated biscuit dough, torn into pieces ADVERTISEMENT', 'ADVERTISEMENT'], 'instructions': 'Place the chicken, butter, soup, and onion in a slow cooker, and fill with enough water to cover.\\nCover, and cook for 5 to 6 hours on High. About 30 minutes before serving, place the torn biscuit dough in the slow cooker. Cook until the dough is no longer raw in the center.\\n', 'picture_link': '55lznCYBbs2mT8BTx6BTkLhynGHzM.S'}   Required keys:    title:  Slow Cooker Chicken and Dumplings     ingredients:  ['4 skinless, boneless chicken breast halves ADVERTISEMENT', '2 tablespoons butter ADVERTISEMENT', '2 (10.75 ounce) cans condensed cream of chicken soup ADVERTISEMENT', '1 onion, finely diced ADVERTISEMENT', '2 (10 ounce) packages refrigerated biscuit dough, torn into pieces ADVERTISEMENT', 'ADVERTISEMENT']     instructions:  Place the chicken, butter, soup, and onion in a slow cooker, and fill with enough water to cover. Cover, and cook for 5 to 6 hours on High. About 30 minutes before serving, place the torn biscuit dough in the slow cooker. Cook until the dough is no longer raw in the center.  .\/tmp\/datasets\/recipes_raw_nosource_epi.json =========================================== Number of examples:  25323   Example object keys:  ['ingredients', 'instructions', 'picture_link', 'title']   Example object:  {'ingredients': ['12 egg whites', '12 egg yolks', '1 1\/2 cups sugar', '3\/4 cup rye whiskey', '12 egg whites', '3\/4 cup brandy', '1\/2 cup rum', '1 to 2 cups heavy cream, lightly whipped', 'Garnish: ground nutmeg'], 'picture_link': None, 'instructions': 'Beat the egg whites until stiff, gradually adding in 3\/4 cup sugar. Set aside. Beat the egg yolks until they are thick and pale and add the other 3\/4 cup sugar and stir in rye whiskey. Blend well. Fold the egg white mixture into the yolk mixture and add the brandy and the rum. Beat the mixture well. To serve, fold the lightly whipped heavy cream into the eggnog. (If a thinner mixture is desired, add the heavy cream unwhipped.) Sprinkle the top of the eggnog with the nutmeg to taste.\\nBeat the egg whites until stiff, gradually adding in 3\/4 cup sugar. Set aside. Beat the egg yolks until they are thick and pale and add the other 3\/4 cup sugar and stir in rye whiskey. Blend well. Fold the egg white mixture into the yolk mixture and add the brandy and the rum. Beat the mixture well. To serve, fold the lightly whipped heavy cream into the eggnog. (If a thinner mixture is desired, add the heavy cream unwhipped.) Sprinkle the top of the eggnog with the nutmeg to taste.', 'title': 'Christmas Eggnog '}   Required keys:    title:  Christmas Eggnog      ingredients:  ['12 egg whites', '12 egg yolks', '1 1\/2 cups sugar', '3\/4 cup rye whiskey', '12 egg whites', '3\/4 cup brandy', '1\/2 cup rum', '1 to 2 cups heavy cream, lightly whipped', 'Garnish: ground nutmeg']     instructions:  Beat the egg whites until stiff, gradually adding in 3\/4 cup sugar. Set aside. Beat the egg yolks until they are thick and pale and add the other 3\/4 cup sugar and stir in rye whiskey. Blend well. Fold the egg white mixture into the yolk mixture and add the brandy and the rum. Beat the mixture well. To serve, fold the lightly whipped heavy cream into the eggnog. (If a thinner mixture is desired, add the heavy cream unwhipped.) Sprinkle the top of the eggnog with the nutmeg to taste. Beat the egg whites until stiff, gradually adding in 3\/4 cup sugar. Set aside. Beat the egg yolks until they are thick and pale and add the other 3\/4 cup sugar and stir in rye whiskey. Blend well. Fold the egg white mixture into the yolk mixture and add the brandy and the rum. Beat the mixture well. To serve, fold the lightly whipped heavy cream into the eggnog. (If a thinner mixture is desired, add the heavy cream unwhipped.) Sprinkle the top of the eggnog with the nutmeg to taste.  .\/tmp\/datasets\/recipes_raw_nosource_fn.json =========================================== Number of examples:  60039   Example object keys:  ['ingredients', 'instructions', 'picture_link', 'title']   Example object:  {'instructions': 'Toss ingredients lightly and spoon into a buttered baking dish. Top with additional crushed cracker crumbs, and brush with melted butter. Bake in a preheated at 350 degrees oven for 25 to 30 minutes or until delicately browned.', 'ingredients': ['1\/2 cup celery, finely chopped', '1 small green pepper finely chopped', '1\/2 cup finely sliced green onions', '1\/4 cup chopped parsley', '1 pound crabmeat', '1 1\/4 cups coarsely crushed cracker crumbs', '1\/2 teaspoon salt', '3\/4 teaspoons dry mustard', 'Dash hot sauce', '1\/4 cup heavy cream', '1\/2 cup melted butter'], 'title': &quot;Grammie Hamblet's Deviled Crab&quot;, 'picture_link': None}   Required keys:    title:  Grammie Hamblet's Deviled Crab     ingredients:  ['1\/2 cup celery, finely chopped', '1 small green pepper finely chopped', '1\/2 cup finely sliced green onions', '1\/4 cup chopped parsley', '1 pound crabmeat', '1 1\/4 cups coarsely crushed cracker crumbs', '1\/2 teaspoon salt', '3\/4 teaspoons dry mustard', 'Dash hot sauce', '1\/4 cup heavy cream', '1\/2 cup melted butter']     instructions:  Toss ingredients lightly and spoon into a buttered baking dish. Top with additional crushed cracker crumbs, and brush with melted butter. Bake in a preheated at 350 degrees oven for 25 to 30 minutes or until delicately browned.<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print('Total number of raw examples: ', len(dataset_raw))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Total number of raw examples:  125164<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"predvaritelnaya-obrabotka-nabora-dannyh\">\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<h3 id=\"filtruem-nepolnye-recepty\">\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b<\/h3>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 (<em>name<\/em>, <em>ingredients<\/em> \u0438\u043b\u0438 <em>instructions<\/em>). \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u044d\u0442\u0438\u0445 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0445 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def recipe_validate_required_fields(recipe):     required_keys = ['title', 'ingredients', 'instructions']      if not recipe:         return False      for required_key in required_keys:         if not recipe[required_key]:             return False          if type(recipe[required_key]) == list and len(recipe[required_key]) == 0:             return False      return True<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>recipe_validate_required_fields()<\/code> \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0445 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">dataset_validated = [recipe for recipe in dataset_raw if recipe_validate_required_fields(recipe)]  print('Dataset size BEFORE validation', len(dataset_raw)) print('Dataset size AFTER validation', len(dataset_validated)) print('Number of incomplete recipes', len(dataset_raw) - len(dataset_validated))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Dataset size BEFORE validation 125164 Dataset size AFTER validation 122938 Number of incomplete recipes 2226<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0438\u0437 <code>125164<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 <code>2226<\/code> \u0431\u044b\u043b\u0438 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"konvertirovanie-receptov-iz-obektov-v-stroki\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438<\/h3>\n<p>  <\/p>\n<p>RNN \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u043e\u043d\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u0447\u0438\u0441\u043b\u0430 (\u0438\u043d\u0434\u0435\u043a\u0441\u044b). \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b RNN \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u0447\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u0438 (\u0438\u043c\u044f, \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b \u0438 \u0448\u0430\u0433\u0438 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f) \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 &quot;\u043c\u0430\u044f\u0447\u043a\u0438&quot; \u0438\u043b\u0438 &quot;\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b&quot;, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u044d\u0442\u0438 \u0441\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">STOP_WORD_TITLE = '\u25d8 ' STOP_WORD_INGREDIENTS = '\\n\u2756\\n\\n' STOP_WORD_INSTRUCTIONS = '\\n\u273c\\n\\n'<\/code><\/pre>\n<p>  <\/p>\n<p>The following function converts the recipe object to a string (sequence of characters) for later usage in RNN input.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 (\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432) \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 RNN.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def recipe_to_string(recipe):     # \u042d\u0442\u0430 \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0435 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c.     noize_string = 'ADVERTISEMENT'      title = recipe['title']     ingredients = recipe['ingredients']     instructions = recipe['instructions'].split('\\n')      ingredients_string = ''     for ingredient in ingredients:         ingredient = ingredient.replace(noize_string, '')         if ingredient:             ingredients_string += f'\u2022 {ingredient}\\n'      instructions_string = ''     for instruction in instructions:         instruction = instruction.replace(noize_string, '')         if instruction:             instructions_string += f'\ufe0e {instruction}\\n'      return f'{STOP_WORD_TITLE}{title}\\n{STOP_WORD_INGREDIENTS}{ingredients_string}{STOP_WORD_INSTRUCTIONS}{instructions_string}'<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>recipe_to_string()<\/code> \u043a <code>dataset_validated<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">dataset_stringified = [recipe_to_string(recipe) for recipe in dataset_validated]  print('Stringified dataset size: ', len(dataset_stringified))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Stringified dataset size:  122938<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for recipe_index, recipe_string in enumerate(dataset_stringified[:3]):     print('Recipe #{}\\n---------'.format(recipe_index + 1))     print(recipe_string)     print('\\n')<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Recipe #1 --------- \u25d8 Slow Cooker Chicken and Dumplings  \u2756  \u2022 4 skinless, boneless chicken breast halves  \u2022 2 tablespoons butter  \u2022 2 (10.75 ounce) cans condensed cream of chicken soup  \u2022 1 onion, finely diced  \u2022 2 (10 ounce) packages refrigerated biscuit dough, torn into pieces   \u273c  \ufe0e Place the chicken, butter, soup, and onion in a slow cooker, and fill with enough water to cover. \ufe0e Cover, and cook for 5 to 6 hours on High. About 30 minutes before serving, place the torn biscuit dough in the slow cooker. Cook until the dough is no longer raw in the center.  Recipe #2 --------- \u25d8 Awesome Slow Cooker Pot Roast  \u2756  \u2022 2 (10.75 ounce) cans condensed cream of mushroom soup  \u2022 1 (1 ounce) package dry onion soup mix  \u2022 1 1\/4 cups water  \u2022 5 1\/2 pounds pot roast   \u273c  \ufe0e In a slow cooker, mix cream of mushroom soup, dry onion soup mix and water. Place pot roast in slow cooker and coat with soup mixture. \ufe0e Cook on High setting for 3 to 4 hours, or on Low setting for 8 to 9 hours.  Recipe #3 --------- \u25d8 Brown Sugar Meatloaf  \u2756  \u2022 1\/2 cup packed brown sugar  \u2022 1\/2 cup ketchup  \u2022 1 1\/2 pounds lean ground beef  \u2022 3\/4 cup milk  \u2022 2 eggs  \u2022 1 1\/2 teaspoons salt  \u2022 1\/4 teaspoon ground black pepper  \u2022 1 small onion, chopped  \u2022 1\/4 teaspoon ground ginger  \u2022 3\/4 cup finely crushed saltine cracker crumbs   \u273c  \ufe0e Preheat oven to 350 degrees F (175 degrees C). Lightly grease a 5x9 inch loaf pan. \ufe0e Press the brown sugar in the bottom of the prepared loaf pan and spread the ketchup over the sugar. \ufe0e In a mixing bowl, mix thoroughly all remaining ingredients and shape into a loaf. Place on top of the ketchup. \ufe0e Bake in preheated oven for 1 hour or until juices are clear.<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437 \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u0441\u0442\u0432\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0446\u0435\u043f\u0442 \u0433\u0434\u0435-\u0442\u043e \u0438\u0437 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print(dataset_stringified[50000])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">\u25d8 Herbed Bean Rago\u00fbt   \u2756  \u2022 6 ounces haricots verts (French thin green beans), trimmed and halved crosswise \u2022 1 (1-pound) bag frozen edamame (soybeans in the pod) or 1 1\/4 cups frozen shelled edamame, not thawed \u2022 2\/3 cup finely chopped onion \u2022 2 garlic cloves, minced \u2022 1 Turkish bay leaf or 1\/2 California bay leaf \u2022 2 (3-inch) fresh rosemary sprigs \u2022 1\/2 teaspoon salt \u2022 1\/4 teaspoon black pepper \u2022 1 tablespoon olive oil \u2022 1 medium carrot, cut into 1\/8-inch dice \u2022 1 medium celery rib, cut into 1\/8-inch dice \u2022 1 (15- to 16-ounces) can small white beans, rinsed and drained \u2022 1 1\/2 cups chicken stock or low-sodium broth \u2022 2 tablespoons unsalted butter \u2022 2 tablespoons finely chopped fresh flat-leaf parsley \u2022 1 tablespoon finely chopped fresh chervil (optional) \u2022 Garnish: fresh chervil sprigs  \u273c  \ufe0e Cook haricots verts in a large pot of boiling salted water until just tender, 3 to 4 minutes. Transfer with a slotted spoon to a bowl of ice and cold water, then drain. Add edamame to boiling water and cook 4 minutes. Drain in a colander, then rinse under cold water. If using edamame in pods, shell them and discard pods. Cook onion, garlic, bay leaf, rosemary, salt, and pepper in oil in a 2- to 4-quart heavy saucepan over moderately low heat, stirring, until softened, about 3 minutes. Add carrot and celery and cook, stirring, until softened, about 3 minutes. Add white beans and stock and simmer, covered, stirring occasionally, 10 minutes. Add haricots verts and edamame and simmer, uncovered, until heated through, 2 to 3 minutes. Add butter, parsley, and chervil (if using) and stir gently until butter is melted. Discard bay leaf and rosemary sprigs. \ufe0e Cook haricots verts in a large pot of boiling salted water until just tender, 3 to 4 minutes. Transfer with a slotted spoon to a bowl of ice and cold water, then drain. \ufe0e Add edamame to boiling water and cook 4 minutes. Drain in a colander, then rinse under cold water. If using edamame in pods, shell them and discard pods. \ufe0e Cook onion, garlic, bay leaf, rosemary, salt, and pepper in oil in a 2- to 4-quart heavy saucepan over moderately low heat, stirring, until softened, about 3 minutes. Add carrot and celery and cook, stirring, until softened, about 3 minutes. \ufe0e Add white beans and stock and simmer, covered, stirring occasionally, 10 minutes. Add haricots verts and edamame and simmer, uncovered, until heated through, 2 to 3 minutes. Add butter, parsley, and chervil (if using) and stir gently until butter is melted. Discard bay leaf and rosemary sprigs.<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"filtruem-bolshie-recepty\">\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b<\/h3>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 RNN \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043a \u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u0435. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u044d\u0442\u0430 \u0434\u043b\u0438\u043d\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0435 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u043e\u0433\u043d\u0430\u043d\u044b \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0438\u0437 \u043d\u0438\u0445). \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441, \u043f\u0443\u0441\u043a\u0430\u0439 <code>99<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0438\u043c\u0435\u044e\u0442 \u0434\u043b\u0438\u043d\u0443 <code>1000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0430 <code>1<\/code> \u0440\u0435\u0446\u0435\u043f\u0442 \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 <code>5000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 <code>99<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043a <code>5000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c (\u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0440\u0435\u0446\u0435\u043f\u0442\u0430) \u0438\u0437-\u0437\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e \u0443\u0436 \u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442 \u0435\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0434\u043b\u0438\u043d\u044b \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">recipes_lengths = [] for recipe_text in dataset_stringified:     recipes_lengths.append(len(recipe_text))  plt.hist(recipes_lengths, bins=50) plt.show()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/427\/04f\/5ab\/42704f5abc08216d5d26d0c9347b62e2.png\" alt=\"Recipes lengths 1\"><\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0438\u043c\u0435\u044e\u0442 \u0434\u043b\u0438\u043d\u0443 \u043c\u0435\u043d\u044c\u0448\u0435 <code>5000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">plt.hist(recipes_lengths, range=(0, 8000), bins=50) plt.show()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3cc\/693\/85b\/3cc69385b2215b463ccdb324f0724a68.png\" alt=\"Recipes lengths 2\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432 <code>2000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">MAX_RECIPE_LENGTH = 2000<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 <code>MAX_RECIPE_LENGTH<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def filter_recipes_by_length(recipe_test):     return len(recipe_test) &lt;= MAX_RECIPE_LENGTH   dataset_filtered = [recipe_text for recipe_text in dataset_stringified if filter_recipes_by_length(recipe_text)]  print('Dataset size BEFORE filtering: ', len(dataset_stringified)) print('Dataset size AFTER filtering: ', len(dataset_filtered)) print('Number of eliminated recipes: ', len(dataset_stringified) - len(dataset_filtered))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Dataset size BEFORE filtering:  122938 Dataset size AFTER filtering:  100212 Number of eliminated recipes:  22726<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 <code>22726<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u043d\u043e \u0437\u0430\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0441\u0442\u0430\u043b \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c (\u043f\u043b\u043e\u0442\u043d\u044b\u043c)<br \/>  \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041f\u043e\u0437\u0436\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 &quot;\u043f\u043e\u0434\u043e\u0433\u043d\u0430\u043d&quot; \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043a <code>MAX_RECIPE_LENGTH<\/code> \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0440\u043e\u043a\u0438. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u043f\u043e \u0441\u0443\u0442\u0438, \u0441\u043d\u0438\u0437\u0438\u0442 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 &quot;\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u044c&quot; \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>10<\/code> \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 <code>100<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (<code>90%<\/code> \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0435\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445) \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0447\u0435\u043c <code>50<\/code> \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 <code>100<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (<code>50%<\/code> \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0435\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445).<\/p>\n<p>  <\/p>\n<h3 id=\"parametry-nabora-dannyh\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">TOTAL_RECIPES_NUM = len(dataset_filtered)  print('MAX_RECIPE_LENGTH: ', MAX_RECIPE_LENGTH) print('TOTAL_RECIPES_NUM: ', TOTAL_RECIPES_NUM)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">MAX_RECIPE_LENGTH:  2000 TOTAL_RECIPES_NUM:  100212<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c <code>~100000<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0432 <code>2000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"sozdaem-slovar\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c<\/h2>\n<p>  <\/p>\n<p>\u0420\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u044b\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043d\u0438 \u0441\u043b\u043e\u0432. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 (\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432) \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0438\u0441\u0435\u043b.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c <strong>\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f<\/strong> (\u043d\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f), \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 LSTM (Long Short-Term Memory). \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0434\u043b\u044f \u0441\u043b\u043e\u0432 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u043c \u0441\u0435\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <em>\u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/em> \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <em>\u0441\u043b\u043e\u0432\u0430<\/em> \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e \u044f\u0437\u044b\u043a\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/karpathy.github.io\/2015\/05\/21\/rnn-effectiveness\/\" rel=\"nofollow\">Unreasonable Effectiveness of Recurrent Neural Networks<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/preprocessing\/text\/Tokenizer\" rel=\"nofollow\">tf.keras.preprocessing.text.Tokenizer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <em>\u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/em>. \u042d\u0442\u043e\u0442 \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0446 \u0442\u0435\u043a\u0441\u0442\u0430 \u0440\u0435\u0446\u0435\u043f\u0442\u0430. \u041e\u043d \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">STOP_SIGN = '\u2423'  tokenizer = tf.keras.preprocessing.text.Tokenizer(     char_level=True,     filters='',     lower=False,     split='' )  # \u0421\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043d\u043e \u0442\u043e\u043a\u0435\u043d\u0430\u0439\u0437\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0435\u043c. tokenizer.fit_on_texts([STOP_SIGN])  tokenizer.fit_on_texts(dataset_filtered)  tokenizer.get_config()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">{'num_words': None,  'filters': '',  'lower': False,  'split': '',  'char_level': True,  'oov_token': None,  'document_count': 100213,   'word_counts': '{&quot;\\\\u2423&quot;: 1, &quot;\\\\ud83d\\\\udcd7&quot;: 100212, &quot; &quot;: 17527888, &quot;S&quot;: 270259, &quot;l&quot;: 3815150, &quot;o&quot;: 5987496, &quot;w&quot;: 964459, &quot;C&quot;: 222831, &quot;k&quot;: 890982, &quot;e&quot;: 9296022, &quot;r&quot;: 4760887, &quot;h&quot;: 2922100, &quot;i&quot;: 4911812, &quot;c&quot;: 2883507, &quot;n&quot;: 5304396, &quot;a&quot;: 6067157, &quot;d&quot;: 3099679, &quot;D&quot;: 63999, &quot;u&quot;: 2717050, &quot;m&quot;: 1794411, &quot;p&quot;: 2679164, &quot;g&quot;: 1698670, &quot;s&quot;: 4704222, &quot;\\\\n&quot;: 1955281, &quot;\\\\ud83e\\\\udd55&quot;: 100212, &quot;\\\\u2022&quot;: 922813, &quot;4&quot;: 232607, &quot;,&quot;: 1130487, &quot;b&quot;: 1394803, &quot;t&quot;: 5997722, &quot;v&quot;: 746785, &quot;2&quot;: 493933, &quot;(&quot;: 144985, &quot;1&quot;: 853931, &quot;0&quot;: 145119, &quot;.&quot;: 1052548, &quot;7&quot;: 31098, &quot;5&quot;: 154071, &quot;)&quot;: 144977, &quot;f&quot;: 1042981, &quot;y&quot;: 666553, &quot;\\\\ud83d\\\\udcdd&quot;: 100212, &quot;\\\\u25aa&quot;: 331058, &quot;\\\\ufe0e&quot;: 331058, &quot;P&quot;: 200597, &quot;6&quot;: 51398, &quot;H&quot;: 43936, &quot;A&quot;: 134274, &quot;3&quot;: 213519, &quot;R&quot;: 101253, &quot;x&quot;: 201286, &quot;\/&quot;: 345257, &quot;I&quot;: 81591, &quot;L&quot;: 46138, &quot;8&quot;: 55352, &quot;9&quot;: 17697, &quot;B&quot;: 123813, &quot;M&quot;: 78684, &quot;F&quot;: 104359, &quot;j&quot;: 110008, &quot;-&quot;: 219160, &quot;W&quot;: 61616, &quot;\\\\u00ae&quot;: 10159, &quot;N&quot;: 12808, &quot;q&quot;: 69654, &quot;T&quot;: 101371, &quot;;&quot;: 72045, &quot;\\'&quot;: 26831, &quot;Z&quot;: 2428, &quot;z&quot;: 115883, &quot;G&quot;: 52043, &quot;:&quot;: 31318, &quot;E&quot;: 18582, &quot;K&quot;: 18421, &quot;X&quot;: 385, &quot;\\\\&quot;&quot;: 6445, &quot;O&quot;: 28971, &quot;Y&quot;: 6064, &quot;\\\\u2122&quot;: 538, &quot;Q&quot;: 3904, &quot;J&quot;: 10269, &quot;!&quot;: 3014, &quot;U&quot;: 14132, &quot;V&quot;: 12172, &quot;&amp;&quot;: 1039, &quot;+&quot;: 87, &quot;=&quot;: 113, &quot;%&quot;: 993, &quot;*&quot;: 3243, &quot;\\\\u00a9&quot;: 99, &quot;[&quot;: 30, &quot;]&quot;: 31, &quot;\\\\u00e9&quot;: 6727, &quot;&lt;&quot;: 76, &quot;&gt;&quot;: 86, &quot;\\\\u00bd&quot;: 166, &quot;#&quot;: 168, &quot;\\\\u00f1&quot;: 891, &quot;?&quot;: 327, &quot;\\\\u2019&quot;: 111, &quot;\\\\u00b0&quot;: 6808, &quot;\\\\u201d&quot;: 6, &quot;$&quot;: 84, &quot;@&quot;: 5, &quot;{&quot;: 8, &quot;}&quot;: 9, &quot;\\\\u2013&quot;: 1228, &quot;\\\\u0096&quot;: 7, &quot;\\\\u00e0&quot;: 26, &quot;\\\\u00e2&quot;: 106, &quot;\\\\u00e8&quot;: 846, &quot;\\\\u00e1&quot;: 74, &quot;\\\\u2014&quot;: 215, &quot;\\\\u2044&quot;: 16, &quot;\\\\u00ee&quot;: 415, &quot;\\\\u00e7&quot;: 171, &quot;_&quot;: 26, &quot;\\\\u00fa&quot;: 48, &quot;\\\\u00ef&quot;: 43, &quot;\\\\u201a&quot;: 20, &quot;\\\\u00fb&quot;: 36, &quot;\\\\u00f3&quot;: 74, &quot;\\\\u00ed&quot;: 130, &quot;\\\\u25ca&quot;: 4, &quot;\\\\u00f9&quot;: 12, &quot;\\\\u00d7&quot;: 6, &quot;\\\\u00ec&quot;: 8, &quot;\\\\u00fc&quot;: 29, &quot;\\\\u2031&quot;: 4, &quot;\\\\u00ba&quot;: 19, &quot;\\\\u201c&quot;: 4, &quot;\\\\u00ad&quot;: 25, &quot;\\\\u00ea&quot;: 27, &quot;\\\\u00f6&quot;: 9, &quot;\\\\u0301&quot;: 11, &quot;\\\\u00f4&quot;: 8, &quot;\\\\u00c1&quot;: 2, &quot;\\\\u00be&quot;: 23, &quot;\\\\u00bc&quot;: 95, &quot;\\\\u00eb&quot;: 2, &quot;\\\\u0097&quot;: 2, &quot;\\\\u215b&quot;: 3, &quot;\\\\u2027&quot;: 4, &quot;\\\\u00e4&quot;: 15, &quot;\\\\u001a&quot;: 2, &quot;\\\\u00f8&quot;: 2, &quot;\\\\ufffd&quot;: 20, &quot;\\\\u02da&quot;: 6, &quot;\\\\u00bf&quot;: 264, &quot;\\\\u2153&quot;: 2, &quot;|&quot;: 2, &quot;\\\\u00e5&quot;: 3, &quot;\\\\u00a4&quot;: 1, &quot;\\\\u201f&quot;: 1, &quot;\\\\u00a7&quot;: 5, &quot;\\\\ufb02&quot;: 3, &quot;\\\\u00a0&quot;: 1, &quot;\\\\u01b0&quot;: 2, &quot;\\\\u01a1&quot;: 1, &quot;\\\\u0103&quot;: 1, &quot;\\\\u0300&quot;: 1, &quot;\\\\u00bb&quot;: 6, &quot;`&quot;: 3, &quot;\\\\u0092&quot;: 2, &quot;\\\\u215e&quot;: 1, &quot;\\\\u202d&quot;: 4, &quot;\\\\u00b4&quot;: 2, &quot;\\\\u2012&quot;: 2, &quot;\\\\u00c9&quot;: 40, &quot;\\\\u00da&quot;: 14, &quot;\\\\u20ac&quot;: 1, &quot;\\\\\\\\&quot;: 5, &quot;~&quot;: 1, &quot;\\\\u0095&quot;: 1, &quot;\\\\u00c2&quot;: 2}',   'word_docs': '{&quot;\\\\u2423&quot;: 1, &quot;k&quot;: 97316, &quot;0&quot;: 61954, &quot;o&quot;: 100205, &quot;r&quot;: 100207, &quot;d&quot;: 100194, &quot;u&quot;: 100161, &quot;S&quot;: 89250, &quot;\\\\u25aa&quot;: 100212, &quot;D&quot;: 40870, &quot;1&quot;: 99320, &quot;g&quot;: 99975, &quot;n&quot;: 100198, &quot;b&quot;: 99702, &quot;t&quot;: 100202, &quot;.&quot;: 100163, &quot; &quot;: 100212, &quot;7&quot;: 24377, &quot;3&quot;: 79135, &quot;\\\\ud83d\\\\udcd7&quot;: 100212, &quot;i&quot;: 100207, &quot;5&quot;: 65486, &quot;f&quot;: 98331, &quot;c&quot;: 100190, &quot;4&quot;: 82453, &quot;a&quot;: 100205, &quot;2&quot;: 96743, &quot;v&quot;: 97848, &quot;C&quot;: 83328, &quot;s&quot;: 100204, &quot;\\\\n&quot;: 100212, &quot;6&quot;: 35206, &quot;\\\\ud83d\\\\udcdd&quot;: 100212, &quot;,&quot;: 98524, &quot;\\\\ufe0e&quot;: 100212, &quot;l&quot;: 100206, &quot;e&quot;: 100212, &quot;y&quot;: 96387, &quot;)&quot;: 67614, &quot;p&quot;: 100046, &quot;H&quot;: 31908, &quot;\\\\ud83e\\\\udd55&quot;: 100212, &quot;m&quot;: 99988, &quot;w&quot;: 99227, &quot;(&quot;: 67627, &quot;A&quot;: 60900, &quot;h&quot;: 100161, &quot;\\\\u2022&quot;: 100212, &quot;P&quot;: 79364, &quot;R&quot;: 54040, &quot;9&quot;: 14114, &quot;8&quot;: 37000, &quot;L&quot;: 32101, &quot;x&quot;: 72133, &quot;I&quot;: 46675, &quot;\/&quot;: 89051, &quot;j&quot;: 47438, &quot;F&quot;: 57940, &quot;B&quot;: 64278, &quot;M&quot;: 48332, &quot;-&quot;: 74711, &quot;T&quot;: 53758, &quot;\\\\u00ae&quot;: 5819, &quot;N&quot;: 9981, &quot;W&quot;: 38981, &quot;q&quot;: 36538, &quot;;&quot;: 33863, &quot;G&quot;: 35355, &quot;\\'&quot;: 18120, &quot;z&quot;: 42430, &quot;Z&quot;: 2184, &quot;:&quot;: 18214, &quot;E&quot;: 12161, &quot;K&quot;: 14834, &quot;X&quot;: 321, &quot;\\\\&quot;&quot;: 2617, &quot;O&quot;: 20103, &quot;Y&quot;: 5148, &quot;\\\\u2122&quot;: 448, &quot;Q&quot;: 3142, &quot;J&quot;: 8225, &quot;!&quot;: 2428, &quot;U&quot;: 10621, &quot;V&quot;: 9710, &quot;&amp;&quot;: 749, &quot;+&quot;: 32, &quot;=&quot;: 48, &quot;%&quot;: 717, &quot;*&quot;: 1780, &quot;\\\\u00a9&quot;: 91, &quot;]&quot;: 26, &quot;[&quot;: 25, &quot;\\\\u00e9&quot;: 2462, &quot;&gt;&quot;: 33, &quot;&lt;&quot;: 27, &quot;\\\\u00bd&quot;: 81, &quot;#&quot;: 139, &quot;\\\\u00f1&quot;: 423, &quot;?&quot;: 207, &quot;\\\\u2019&quot;: 64, &quot;\\\\u00b0&quot;: 3062, &quot;\\\\u201d&quot;: 3, &quot;@&quot;: 4, &quot;$&quot;: 49, &quot;{&quot;: 7, &quot;}&quot;: 8, &quot;\\\\u2013&quot;: 491, &quot;\\\\u0096&quot;: 7, &quot;\\\\u00e0&quot;: 22, &quot;\\\\u00e2&quot;: 45, &quot;\\\\u00e8&quot;: 335, &quot;\\\\u00e1&quot;: 38, &quot;\\\\u2014&quot;: 95, &quot;\\\\u2044&quot;: 9, &quot;\\\\u00ee&quot;: 122, &quot;\\\\u00e7&quot;: 120, &quot;_&quot;: 8, &quot;\\\\u00fa&quot;: 25, &quot;\\\\u00ef&quot;: 24, &quot;\\\\u201a&quot;: 10, &quot;\\\\u00fb&quot;: 29, &quot;\\\\u00f3&quot;: 40, &quot;\\\\u00ed&quot;: 52, &quot;\\\\u25ca&quot;: 2, &quot;\\\\u00f9&quot;: 6, &quot;\\\\u00d7&quot;: 4, &quot;\\\\u00ec&quot;: 4, &quot;\\\\u00fc&quot;: 19, &quot;\\\\u2031&quot;: 2, &quot;\\\\u00ba&quot;: 9, &quot;\\\\u201c&quot;: 2, &quot;\\\\u00ad&quot;: 11, &quot;\\\\u00ea&quot;: 4, &quot;\\\\u00f6&quot;: 4, &quot;\\\\u0301&quot;: 6, &quot;\\\\u00f4&quot;: 5, &quot;\\\\u00c1&quot;: 2, &quot;\\\\u00be&quot;: 18, &quot;\\\\u00bc&quot;: 55, &quot;\\\\u00eb&quot;: 2, &quot;\\\\u0097&quot;: 1, &quot;\\\\u215b&quot;: 2, &quot;\\\\u2027&quot;: 3, &quot;\\\\u00e4&quot;: 8, &quot;\\\\u001a&quot;: 1, &quot;\\\\u00f8&quot;: 1, &quot;\\\\ufffd&quot;: 4, &quot;\\\\u02da&quot;: 3, &quot;\\\\u00bf&quot;: 191, &quot;\\\\u2153&quot;: 1, &quot;|&quot;: 2, &quot;\\\\u00e5&quot;: 1, &quot;\\\\u00a4&quot;: 1, &quot;\\\\u201f&quot;: 1, &quot;\\\\u00a7&quot;: 3, &quot;\\\\ufb02&quot;: 1, &quot;\\\\u0300&quot;: 1, &quot;\\\\u01a1&quot;: 1, &quot;\\\\u00a0&quot;: 1, &quot;\\\\u01b0&quot;: 1, &quot;\\\\u0103&quot;: 1, &quot;\\\\u00bb&quot;: 2, &quot;`&quot;: 3, &quot;\\\\u0092&quot;: 2, &quot;\\\\u215e&quot;: 1, &quot;\\\\u202d&quot;: 1, &quot;\\\\u00b4&quot;: 1, &quot;\\\\u2012&quot;: 1, &quot;\\\\u00c9&quot;: 15, &quot;\\\\u00da&quot;: 5, &quot;\\\\u20ac&quot;: 1, &quot;\\\\\\\\&quot;: 5, &quot;~&quot;: 1, &quot;\\\\u0095&quot;: 1, &quot;\\\\u00c2&quot;: 1}',   'index_docs': '{&quot;1&quot;: 100212, &quot;165&quot;: 1, &quot;25&quot;: 97316, &quot;41&quot;: 61954, &quot;5&quot;: 100205, &quot;8&quot;: 100207, &quot;11&quot;: 100194, &quot;14&quot;: 100161, &quot;33&quot;: 89250, &quot;31&quot;: 100212, &quot;58&quot;: 40870, &quot;26&quot;: 99320, &quot;18&quot;: 99975, &quot;6&quot;: 100198, &quot;19&quot;: 99702, &quot;4&quot;: 100202, &quot;21&quot;: 100163, &quot;66&quot;: 24377, &quot;37&quot;: 79135, &quot;51&quot;: 100212, &quot;7&quot;: 100207, &quot;40&quot;: 65486, &quot;22&quot;: 98331, &quot;13&quot;: 100190, &quot;34&quot;: 82453, &quot;3&quot;: 100205, &quot;29&quot;: 96743, &quot;27&quot;: 97848, &quot;35&quot;: 83328, &quot;9&quot;: 100204, &quot;16&quot;: 100212, &quot;62&quot;: 35206, &quot;53&quot;: 100212, &quot;20&quot;: 98524, &quot;32&quot;: 100212, &quot;10&quot;: 100206, &quot;2&quot;: 100212, &quot;28&quot;: 96387, &quot;43&quot;: 67614, &quot;15&quot;: 100046, &quot;64&quot;: 31908, &quot;52&quot;: 100212, &quot;17&quot;: 99988, &quot;23&quot;: 99227, &quot;42&quot;: 67627, &quot;44&quot;: 60900, &quot;12&quot;: 100161, &quot;24&quot;: 100212, &quot;39&quot;: 79364, &quot;50&quot;: 54040, &quot;71&quot;: 14114, &quot;60&quot;: 37000, &quot;63&quot;: 32101, &quot;38&quot;: 72133, &quot;54&quot;: 46675, &quot;30&quot;: 89051, &quot;47&quot;: 47438, &quot;48&quot;: 57940, &quot;45&quot;: 64278, &quot;55&quot;: 48332, &quot;36&quot;: 74711, &quot;49&quot;: 53758, &quot;76&quot;: 5819, &quot;73&quot;: 9981, &quot;59&quot;: 38981, &quot;57&quot;: 36538, &quot;56&quot;: 33863, &quot;61&quot;: 35355, &quot;68&quot;: 18120, &quot;46&quot;: 42430, &quot;84&quot;: 2184, &quot;65&quot;: 18214, &quot;69&quot;: 12161, &quot;70&quot;: 14834, &quot;92&quot;: 321, &quot;79&quot;: 2617, &quot;67&quot;: 20103, &quot;80&quot;: 5148, &quot;90&quot;: 448, &quot;81&quot;: 3142, &quot;75&quot;: 8225, &quot;83&quot;: 2428, &quot;72&quot;: 10621, &quot;74&quot;: 9710, &quot;86&quot;: 749, &quot;105&quot;: 32, &quot;100&quot;: 48, &quot;87&quot;: 717, &quot;82&quot;: 1780, &quot;103&quot;: 91, &quot;115&quot;: 26, &quot;116&quot;: 25, &quot;78&quot;: 2462, &quot;106&quot;: 33, &quot;108&quot;: 27, &quot;98&quot;: 81, &quot;97&quot;: 139, &quot;88&quot;: 423, &quot;93&quot;: 207, &quot;101&quot;: 64, &quot;77&quot;: 3062, &quot;137&quot;: 3, &quot;141&quot;: 4, &quot;107&quot;: 49, &quot;133&quot;: 7, &quot;131&quot;: 8, &quot;85&quot;: 491, &quot;136&quot;: 7, &quot;119&quot;: 22, &quot;102&quot;: 45, &quot;89&quot;: 335, &quot;109&quot;: 38, &quot;95&quot;: 95, &quot;126&quot;: 9, &quot;91&quot;: 122, &quot;96&quot;: 120, &quot;120&quot;: 8, &quot;111&quot;: 25, &quot;112&quot;: 24, &quot;123&quot;: 10, &quot;114&quot;: 29, &quot;110&quot;: 40, &quot;99&quot;: 52, &quot;144&quot;: 2, &quot;129&quot;: 6, &quot;138&quot;: 4, &quot;134&quot;: 4, &quot;117&quot;: 19, &quot;145&quot;: 2, &quot;125&quot;: 9, &quot;146&quot;: 2, &quot;121&quot;: 11, &quot;118&quot;: 4, &quot;132&quot;: 4, &quot;130&quot;: 6, &quot;135&quot;: 5, &quot;153&quot;: 2, &quot;122&quot;: 18, &quot;104&quot;: 55, &quot;154&quot;: 2, &quot;155&quot;: 1, &quot;149&quot;: 2, &quot;147&quot;: 3, &quot;127&quot;: 8, &quot;156&quot;: 1, &quot;157&quot;: 1, &quot;124&quot;: 4, &quot;139&quot;: 3, &quot;94&quot;: 191, &quot;158&quot;: 1, &quot;159&quot;: 2, &quot;150&quot;: 1, &quot;166&quot;: 1, &quot;167&quot;: 1, &quot;142&quot;: 3, &quot;151&quot;: 1, &quot;171&quot;: 1, &quot;169&quot;: 1, &quot;168&quot;: 1, &quot;160&quot;: 1, &quot;170&quot;: 1, &quot;140&quot;: 2, &quot;152&quot;: 3, &quot;161&quot;: 2, &quot;172&quot;: 1, &quot;148&quot;: 1, &quot;162&quot;: 1, &quot;163&quot;: 1, &quot;113&quot;: 15, &quot;128&quot;: 5, &quot;173&quot;: 1, &quot;143&quot;: 5, &quot;174&quot;: 1, &quot;175&quot;: 1, &quot;164&quot;: 1}',   'index_word': '{&quot;1&quot;: &quot; &quot;, &quot;2&quot;: &quot;e&quot;, &quot;3&quot;: &quot;a&quot;, &quot;4&quot;: &quot;t&quot;, &quot;5&quot;: &quot;o&quot;, &quot;6&quot;: &quot;n&quot;, &quot;7&quot;: &quot;i&quot;, &quot;8&quot;: &quot;r&quot;, &quot;9&quot;: &quot;s&quot;, &quot;10&quot;: &quot;l&quot;, &quot;11&quot;: &quot;d&quot;, &quot;12&quot;: &quot;h&quot;, &quot;13&quot;: &quot;c&quot;, &quot;14&quot;: &quot;u&quot;, &quot;15&quot;: &quot;p&quot;, &quot;16&quot;: &quot;\\\\n&quot;, &quot;17&quot;: &quot;m&quot;, &quot;18&quot;: &quot;g&quot;, &quot;19&quot;: &quot;b&quot;, &quot;20&quot;: &quot;,&quot;, &quot;21&quot;: &quot;.&quot;, &quot;22&quot;: &quot;f&quot;, &quot;23&quot;: &quot;w&quot;, &quot;24&quot;: &quot;\\\\u2022&quot;, &quot;25&quot;: &quot;k&quot;, &quot;26&quot;: &quot;1&quot;, &quot;27&quot;: &quot;v&quot;, &quot;28&quot;: &quot;y&quot;, &quot;29&quot;: &quot;2&quot;, &quot;30&quot;: &quot;\/&quot;, &quot;31&quot;: &quot;\\\\u25aa&quot;, &quot;32&quot;: &quot;\\\\ufe0e&quot;, &quot;33&quot;: &quot;S&quot;, &quot;34&quot;: &quot;4&quot;, &quot;35&quot;: &quot;C&quot;, &quot;36&quot;: &quot;-&quot;, &quot;37&quot;: &quot;3&quot;, &quot;38&quot;: &quot;x&quot;, &quot;39&quot;: &quot;P&quot;, &quot;40&quot;: &quot;5&quot;, &quot;41&quot;: &quot;0&quot;, &quot;42&quot;: &quot;(&quot;, &quot;43&quot;: &quot;)&quot;, &quot;44&quot;: &quot;A&quot;, &quot;45&quot;: &quot;B&quot;, &quot;46&quot;: &quot;z&quot;, &quot;47&quot;: &quot;j&quot;, &quot;48&quot;: &quot;F&quot;, &quot;49&quot;: &quot;T&quot;, &quot;50&quot;: &quot;R&quot;, &quot;51&quot;: &quot;\\\\ud83d\\\\udcd7&quot;, &quot;52&quot;: &quot;\\\\ud83e\\\\udd55&quot;, &quot;53&quot;: &quot;\\\\ud83d\\\\udcdd&quot;, &quot;54&quot;: &quot;I&quot;, &quot;55&quot;: &quot;M&quot;, &quot;56&quot;: &quot;;&quot;, &quot;57&quot;: &quot;q&quot;, &quot;58&quot;: &quot;D&quot;, &quot;59&quot;: &quot;W&quot;, &quot;60&quot;: &quot;8&quot;, &quot;61&quot;: &quot;G&quot;, &quot;62&quot;: &quot;6&quot;, &quot;63&quot;: &quot;L&quot;, &quot;64&quot;: &quot;H&quot;, &quot;65&quot;: &quot;:&quot;, &quot;66&quot;: &quot;7&quot;, &quot;67&quot;: &quot;O&quot;, &quot;68&quot;: &quot;\\'&quot;, &quot;69&quot;: &quot;E&quot;, &quot;70&quot;: &quot;K&quot;, &quot;71&quot;: &quot;9&quot;, &quot;72&quot;: &quot;U&quot;, &quot;73&quot;: &quot;N&quot;, &quot;74&quot;: &quot;V&quot;, &quot;75&quot;: &quot;J&quot;, &quot;76&quot;: &quot;\\\\u00ae&quot;, &quot;77&quot;: &quot;\\\\u00b0&quot;, &quot;78&quot;: &quot;\\\\u00e9&quot;, &quot;79&quot;: &quot;\\\\&quot;&quot;, &quot;80&quot;: &quot;Y&quot;, &quot;81&quot;: &quot;Q&quot;, &quot;82&quot;: &quot;*&quot;, &quot;83&quot;: &quot;!&quot;, &quot;84&quot;: &quot;Z&quot;, &quot;85&quot;: &quot;\\\\u2013&quot;, &quot;86&quot;: &quot;&amp;&quot;, &quot;87&quot;: &quot;%&quot;, &quot;88&quot;: &quot;\\\\u00f1&quot;, &quot;89&quot;: &quot;\\\\u00e8&quot;, &quot;90&quot;: &quot;\\\\u2122&quot;, &quot;91&quot;: &quot;\\\\u00ee&quot;, &quot;92&quot;: &quot;X&quot;, &quot;93&quot;: &quot;?&quot;, &quot;94&quot;: &quot;\\\\u00bf&quot;, &quot;95&quot;: &quot;\\\\u2014&quot;, &quot;96&quot;: &quot;\\\\u00e7&quot;, &quot;97&quot;: &quot;#&quot;, &quot;98&quot;: &quot;\\\\u00bd&quot;, &quot;99&quot;: &quot;\\\\u00ed&quot;, &quot;100&quot;: &quot;=&quot;, &quot;101&quot;: &quot;\\\\u2019&quot;, &quot;102&quot;: &quot;\\\\u00e2&quot;, &quot;103&quot;: &quot;\\\\u00a9&quot;, &quot;104&quot;: &quot;\\\\u00bc&quot;, &quot;105&quot;: &quot;+&quot;, &quot;106&quot;: &quot;&gt;&quot;, &quot;107&quot;: &quot;$&quot;, &quot;108&quot;: &quot;&lt;&quot;, &quot;109&quot;: &quot;\\\\u00e1&quot;, &quot;110&quot;: &quot;\\\\u00f3&quot;, &quot;111&quot;: &quot;\\\\u00fa&quot;, &quot;112&quot;: &quot;\\\\u00ef&quot;, &quot;113&quot;: &quot;\\\\u00c9&quot;, &quot;114&quot;: &quot;\\\\u00fb&quot;, &quot;115&quot;: &quot;]&quot;, &quot;116&quot;: &quot;[&quot;, &quot;117&quot;: &quot;\\\\u00fc&quot;, &quot;118&quot;: &quot;\\\\u00ea&quot;, &quot;119&quot;: &quot;\\\\u00e0&quot;, &quot;120&quot;: &quot;_&quot;, &quot;121&quot;: &quot;\\\\u00ad&quot;, &quot;122&quot;: &quot;\\\\u00be&quot;, &quot;123&quot;: &quot;\\\\u201a&quot;, &quot;124&quot;: &quot;\\\\ufffd&quot;, &quot;125&quot;: &quot;\\\\u00ba&quot;, &quot;126&quot;: &quot;\\\\u2044&quot;, &quot;127&quot;: &quot;\\\\u00e4&quot;, &quot;128&quot;: &quot;\\\\u00da&quot;, &quot;129&quot;: &quot;\\\\u00f9&quot;, &quot;130&quot;: &quot;\\\\u0301&quot;, &quot;131&quot;: &quot;}&quot;, &quot;132&quot;: &quot;\\\\u00f6&quot;, &quot;133&quot;: &quot;{&quot;, &quot;134&quot;: &quot;\\\\u00ec&quot;, &quot;135&quot;: &quot;\\\\u00f4&quot;, &quot;136&quot;: &quot;\\\\u0096&quot;, &quot;137&quot;: &quot;\\\\u201d&quot;, &quot;138&quot;: &quot;\\\\u00d7&quot;, &quot;139&quot;: &quot;\\\\u02da&quot;, &quot;140&quot;: &quot;\\\\u00bb&quot;, &quot;141&quot;: &quot;@&quot;, &quot;142&quot;: &quot;\\\\u00a7&quot;, &quot;143&quot;: &quot;\\\\\\\\&quot;, &quot;144&quot;: &quot;\\\\u25ca&quot;, &quot;145&quot;: &quot;\\\\u2031&quot;, &quot;146&quot;: &quot;\\\\u201c&quot;, &quot;147&quot;: &quot;\\\\u2027&quot;, &quot;148&quot;: &quot;\\\\u202d&quot;, &quot;149&quot;: &quot;\\\\u215b&quot;, &quot;150&quot;: &quot;\\\\u00e5&quot;, &quot;151&quot;: &quot;\\\\ufb02&quot;, &quot;152&quot;: &quot;`&quot;, &quot;153&quot;: &quot;\\\\u00c1&quot;, &quot;154&quot;: &quot;\\\\u00eb&quot;, &quot;155&quot;: &quot;\\\\u0097&quot;, &quot;156&quot;: &quot;\\\\u001a&quot;, &quot;157&quot;: &quot;\\\\u00f8&quot;, &quot;158&quot;: &quot;\\\\u2153&quot;, &quot;159&quot;: &quot;|&quot;, &quot;160&quot;: &quot;\\\\u01b0&quot;, &quot;161&quot;: &quot;\\\\u0092&quot;, &quot;162&quot;: &quot;\\\\u00b4&quot;, &quot;163&quot;: &quot;\\\\u2012&quot;, &quot;164&quot;: &quot;\\\\u00c2&quot;, &quot;165&quot;: &quot;\\\\u2423&quot;, &quot;166&quot;: &quot;\\\\u00a4&quot;, &quot;167&quot;: &quot;\\\\u201f&quot;, &quot;168&quot;: &quot;\\\\u00a0&quot;, &quot;169&quot;: &quot;\\\\u01a1&quot;, &quot;170&quot;: &quot;\\\\u0103&quot;, &quot;171&quot;: &quot;\\\\u0300&quot;, &quot;172&quot;: &quot;\\\\u215e&quot;, &quot;173&quot;: &quot;\\\\u20ac&quot;, &quot;174&quot;: &quot;~&quot;, &quot;175&quot;: &quot;\\\\u0095&quot;}',   'word_index': '{&quot; &quot;: 1, &quot;e&quot;: 2, &quot;a&quot;: 3, &quot;t&quot;: 4, &quot;o&quot;: 5, &quot;n&quot;: 6, &quot;i&quot;: 7, &quot;r&quot;: 8, &quot;s&quot;: 9, &quot;l&quot;: 10, &quot;d&quot;: 11, &quot;h&quot;: 12, &quot;c&quot;: 13, &quot;u&quot;: 14, &quot;p&quot;: 15, &quot;\\\\n&quot;: 16, &quot;m&quot;: 17, &quot;g&quot;: 18, &quot;b&quot;: 19, &quot;,&quot;: 20, &quot;.&quot;: 21, &quot;f&quot;: 22, &quot;w&quot;: 23, &quot;\\\\u2022&quot;: 24, &quot;k&quot;: 25, &quot;1&quot;: 26, &quot;v&quot;: 27, &quot;y&quot;: 28, &quot;2&quot;: 29, &quot;\/&quot;: 30, &quot;\\\\u25aa&quot;: 31, &quot;\\\\ufe0e&quot;: 32, &quot;S&quot;: 33, &quot;4&quot;: 34, &quot;C&quot;: 35, &quot;-&quot;: 36, &quot;3&quot;: 37, &quot;x&quot;: 38, &quot;P&quot;: 39, &quot;5&quot;: 40, &quot;0&quot;: 41, &quot;(&quot;: 42, &quot;)&quot;: 43, &quot;A&quot;: 44, &quot;B&quot;: 45, &quot;z&quot;: 46, &quot;j&quot;: 47, &quot;F&quot;: 48, &quot;T&quot;: 49, &quot;R&quot;: 50, &quot;\\\\ud83d\\\\udcd7&quot;: 51, &quot;\\\\ud83e\\\\udd55&quot;: 52, &quot;\\\\ud83d\\\\udcdd&quot;: 53, &quot;I&quot;: 54, &quot;M&quot;: 55, &quot;;&quot;: 56, &quot;q&quot;: 57, &quot;D&quot;: 58, &quot;W&quot;: 59, &quot;8&quot;: 60, &quot;G&quot;: 61, &quot;6&quot;: 62, &quot;L&quot;: 63, &quot;H&quot;: 64, &quot;:&quot;: 65, &quot;7&quot;: 66, &quot;O&quot;: 67, &quot;\\'&quot;: 68, &quot;E&quot;: 69, &quot;K&quot;: 70, &quot;9&quot;: 71, &quot;U&quot;: 72, &quot;N&quot;: 73, &quot;V&quot;: 74, &quot;J&quot;: 75, &quot;\\\\u00ae&quot;: 76, &quot;\\\\u00b0&quot;: 77, &quot;\\\\u00e9&quot;: 78, &quot;\\\\&quot;&quot;: 79, &quot;Y&quot;: 80, &quot;Q&quot;: 81, &quot;*&quot;: 82, &quot;!&quot;: 83, &quot;Z&quot;: 84, &quot;\\\\u2013&quot;: 85, &quot;&amp;&quot;: 86, &quot;%&quot;: 87, &quot;\\\\u00f1&quot;: 88, &quot;\\\\u00e8&quot;: 89, &quot;\\\\u2122&quot;: 90, &quot;\\\\u00ee&quot;: 91, &quot;X&quot;: 92, &quot;?&quot;: 93, &quot;\\\\u00bf&quot;: 94, &quot;\\\\u2014&quot;: 95, &quot;\\\\u00e7&quot;: 96, &quot;#&quot;: 97, &quot;\\\\u00bd&quot;: 98, &quot;\\\\u00ed&quot;: 99, &quot;=&quot;: 100, &quot;\\\\u2019&quot;: 101, &quot;\\\\u00e2&quot;: 102, &quot;\\\\u00a9&quot;: 103, &quot;\\\\u00bc&quot;: 104, &quot;+&quot;: 105, &quot;&gt;&quot;: 106, &quot;$&quot;: 107, &quot;&lt;&quot;: 108, &quot;\\\\u00e1&quot;: 109, &quot;\\\\u00f3&quot;: 110, &quot;\\\\u00fa&quot;: 111, &quot;\\\\u00ef&quot;: 112, &quot;\\\\u00c9&quot;: 113, &quot;\\\\u00fb&quot;: 114, &quot;]&quot;: 115, &quot;[&quot;: 116, &quot;\\\\u00fc&quot;: 117, &quot;\\\\u00ea&quot;: 118, &quot;\\\\u00e0&quot;: 119, &quot;_&quot;: 120, &quot;\\\\u00ad&quot;: 121, &quot;\\\\u00be&quot;: 122, &quot;\\\\u201a&quot;: 123, &quot;\\\\ufffd&quot;: 124, &quot;\\\\u00ba&quot;: 125, &quot;\\\\u2044&quot;: 126, &quot;\\\\u00e4&quot;: 127, &quot;\\\\u00da&quot;: 128, &quot;\\\\u00f9&quot;: 129, &quot;\\\\u0301&quot;: 130, &quot;}&quot;: 131, &quot;\\\\u00f6&quot;: 132, &quot;{&quot;: 133, &quot;\\\\u00ec&quot;: 134, &quot;\\\\u00f4&quot;: 135, &quot;\\\\u0096&quot;: 136, &quot;\\\\u201d&quot;: 137, &quot;\\\\u00d7&quot;: 138, &quot;\\\\u02da&quot;: 139, &quot;\\\\u00bb&quot;: 140, &quot;@&quot;: 141, &quot;\\\\u00a7&quot;: 142, &quot;\\\\\\\\&quot;: 143, &quot;\\\\u25ca&quot;: 144, &quot;\\\\u2031&quot;: 145, &quot;\\\\u201c&quot;: 146, &quot;\\\\u2027&quot;: 147, &quot;\\\\u202d&quot;: 148, &quot;\\\\u215b&quot;: 149, &quot;\\\\u00e5&quot;: 150, &quot;\\\\ufb02&quot;: 151, &quot;`&quot;: 152, &quot;\\\\u00c1&quot;: 153, &quot;\\\\u00eb&quot;: 154, &quot;\\\\u0097&quot;: 155, &quot;\\\\u001a&quot;: 156, &quot;\\\\u00f8&quot;: 157, &quot;\\\\u2153&quot;: 158, &quot;|&quot;: 159, &quot;\\\\u01b0&quot;: 160, &quot;\\\\u0092&quot;: 161, &quot;\\\\u00b4&quot;: 162, &quot;\\\\u2012&quot;: 163, &quot;\\\\u00c2&quot;: 164, &quot;\\\\u2423&quot;: 165, &quot;\\\\u00a4&quot;: 166, &quot;\\\\u201f&quot;: 167, &quot;\\\\u00a0&quot;: 168, &quot;\\\\u01a1&quot;: 169, &quot;\\\\u0103&quot;: 170, &quot;\\\\u0300&quot;: 171, &quot;\\\\u215e&quot;: 172, &quot;\\\\u20ac&quot;: 173, &quot;~&quot;: 174, &quot;\\\\u0095&quot;: 175}'}<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>+1<\/code> \u043a \u0447\u0438\u0441\u043b\u0443 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/preprocessing\/text\/Tokenizer\" rel=\"nofollow\">\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d \u0442\u043e\u043a\u0435\u043d\u0430\u0439\u0437\u0435\u0440\u043e\u043c \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">VOCABULARY_SIZE = len(tokenizer.word_counts) + 1  print('VOCABULARY_SIZE: ', VOCABULARY_SIZE)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">VOCABULARY_SIZE:  176<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print(tokenizer.index_word[5]) print(tokenizer.index_word[20])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">o ,<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b \u0432 \u0438\u043d\u0434\u0435\u043a\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tokenizer.word_index['r']<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">8<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">array_vocabulary = tokenizer.sequences_to_texts([[word_index] for word_index in range(VOCABULARY_SIZE)]) print([char for char in array_vocabulary])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">['', ' ', 'e', 'a', 't', 'o', 'n', 'i', 'r', 's', 'l', 'd', 'h', 'c', 'u', 'p', '\\n', 'm', 'g', 'b', ',', '.', 'f', 'w', '\u2022', 'k', '1', 'v', 'y', '2', '\/', '', '\ufe0e', 'S', '4', 'C', '-', '3', 'x', 'P', '5', '0', '(', ')', 'A', 'B', 'z', 'j', 'F', 'T', 'R', '\u25d8', '\u2756', '\u273c', 'I', 'M', ';', 'q', 'D', 'W', '8', 'G', '6', 'L', 'H', ':', '7', 'O', &quot;'&quot;, 'E', 'K', '9', 'U', 'N', 'V', 'J', '', '\u00b0', '\u00e9', '&quot;', 'Y', 'Q', '*', '!', 'Z', '\u2013', '&amp;', '%', '\u00f1', '\u00e8', '', '\u00ee', 'X', '?', '\u00bf', '\u2014', '\u00e7', '#', '\u00bd', '\u00ed', '=', '\u2019', '\u00e2', '', '\u00bc', '+', '&gt;', '$', '&lt;', '\u00e1', '\u00f3', '\u00fa', '\u00ef', '\u00c9', '\u00fb', ']', '[', '\u00fc', '\u00ea', '\u00e0', '_', '\\xad', '\u00be', '\u201a', '\ufffd', '\u00ba', '\u2044', '\u00e4', '\u00da', '\u00f9', '\u0301', '}', '\u00f6', '{', '\u00ec', '\u00f4', '\\x96', '\u201d', '\u00d7', '\u02da', '\u00bb', '@', '\u00a7', '\\\\', '\u25ca', '\u2031', '\u201c', '\u2027', '\\u202d', '\u215b', '\u00e5', '\ufb02', '`', '\u00c1', '\u00eb', '\\x97', '\\x1a', '\u00f8', '\u2153', '|', '\u01b0', '\\x92', '\u00b4', '\u2012', '\u00c2', '\u2423', '\u00a4', '\u201f', '\\xa0', '\u01a1', '\u0103', '\u0300', '\u215e', '\u20ac', '~', '\\x95']<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u042d\u0442\u043e \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c. \u041e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u043a\u0443\u043b\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b, \u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>tokenizer<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tokenizer.texts_to_sequences(['\u25d8 yes'])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">[[51, 1, 28, 2, 9]]<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"vektorizaciya-dannyh\">\u0412\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<p><em>\u041f\u043e\u0434 \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0440\u043e\u043a) \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432).<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c (\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <code>\u0441\u0438\u043c\u0432\u043e\u043b --&gt; \u0438\u043d\u0434\u0435\u043a\u0441<\/code> and <code>\u0438\u043d\u0434\u0435\u043a\u0441 --&gt; \u0441\u0438\u043c\u0432\u043e\u043b<\/code>) \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u043c\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 (RNN \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u0430, \u0430 \u043d\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b).<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">dataset_vectorized = tokenizer.texts_to_sequences(dataset_filtered)  print('Vectorized dataset size', len(dataset_vectorized))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Vectorized dataset size 100212<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print(dataset_vectorized[0][:10], '...')<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">[51, 1, 33, 10, 5, 23, 1, 35, 5, 5] ...<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def recipe_sequence_to_string(recipe_sequence):     recipe_stringified = tokenizer.sequences_to_texts([recipe_sequence])[0]     print(recipe_stringified)  recipe_sequence_to_string(dataset_vectorized[0])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">\u25d8 Slow Cooker Chicken and Dumplings  \u2756  \u2022 4 skinless, boneless chicken breast halves  \u2022 2 tablespoons butter  \u2022 2 (10.75 ounce) cans condensed cream of chicken soup  \u2022 1 onion, finely diced  \u2022 2 (10 ounce) packages refrigerated biscuit dough, torn into pieces   \u273c  \ufe0e Place the chicken, butter, soup, and onion in a slow cooker, and fill with enough water to cover. \ufe0e Cover, and cook for 5 to 6 hours on High. About 30 minutes before serving, place the torn biscuit dough in the slow cooker. Cook until the dough is no longer raw in the center.<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"podgonka-posledovatelnostey-k-odnoy-dline\">\u041f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u043a \u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u0435<\/h3>\n<p>  <\/p>\n<p><em>\u041a\u0430\u043a \u0441\u0438\u043d\u043e\u043d\u0438\u043c \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e &quot;\u043f\u0430\u0434\u0434\u0438\u043d\u0433&quot;<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0434\u043b\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0414\u043b\u044f \u043f\u0430\u0434\u0434\u0438\u043d\u0433\u0430 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/preprocessing\/sequence\/pad_sequences\" rel=\"nofollow\">tf.keras.preprocessing.sequence.pad_sequences<\/a>. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b \u0432 \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043b\u0438\u043d\u044b \u043f\u0435\u0440\u0432\u044b\u0445 10-\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for recipe_index, recipe in enumerate(dataset_vectorized[:10]):     print('Recipe #{} length: {}'.format(recipe_index + 1, len(recipe)))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Recipe #1 length: 546 Recipe #2 length: 401 Recipe #3 length: 671 Recipe #4 length: 736 Recipe #5 length: 1518 Recipe #6 length: 740 Recipe #7 length: 839 Recipe #8 length: 667 Recipe #9 length: 1264 Recipe #10 length: 854<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c <code>STOP_SIGN<\/code> \u0432 \u043a\u043e\u043d\u0435\u0446 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">dataset_vectorized_padded_without_stops = tf.keras.preprocessing.sequence.pad_sequences(     dataset_vectorized,     padding='post',     truncating='post',     # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c -1 \u0437\u0434\u0435\u0441\u044c \u0438 +1 \u043d\u0438\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0438\u043c\u0435\u043b \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c     # \u043e\u0434\u0438\u043d \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b \u0432 \u043a\u043e\u043d\u0446\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0431\u0443\u0434\u0435\u0442     # \u043e\u0431\u0440\u0435\u0437\u0430\u043d \u043d\u0430 \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 X \u0438 Y.     # (\u0441\u043c. \u043d\u0438\u0436\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443)     maxlen=MAX_RECIPE_LENGTH-1,     value=tokenizer.texts_to_sequences([STOP_SIGN])[0] )  dataset_vectorized_padded = tf.keras.preprocessing.sequence.pad_sequences(     dataset_vectorized_padded_without_stops,     padding='post',     truncating='post',     maxlen=MAX_RECIPE_LENGTH+1,     value=tokenizer.texts_to_sequences([STOP_SIGN])[0] )  for recipe_index, recipe in enumerate(dataset_vectorized_padded[:10]):     print('Recipe #{} length: {}'.format(recipe_index, len(recipe)))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Recipe #0 length: 2001 Recipe #1 length: 2001 Recipe #2 length: 2001 Recipe #3 length: 2001 Recipe #4 length: 2001 Recipe #5 length: 2001 Recipe #6 length: 2001 Recipe #7 length: 2001 Recipe #8 length: 2001 Recipe #9 length: 2001<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0434\u043b\u0438\u043d\u0443 \u0438 \u0441\u0442\u043e\u043f-\u0441\u0438\u043c\u0432\u043e\u043b \u0432 \u043a\u043e\u043d\u0446\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u0438\u043d\u0430 \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430 \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 (<code>2001<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>2000<\/code>). \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e \u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0447\u0442\u043e \u043d\u0438\u0436\u0435 \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>X<\/code> (\u0434\u043b\u0438\u043d\u043e\u0439 \u0432 <code>2000<\/code>) \u0438 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>Y<\/code> (\u0434\u043b\u0438\u043d\u043e\u0439 \u0432 <code>2000<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044b \u0434\u0440\u0443\u0433 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433\u0430 \u043d\u0430 <code>1<\/code> \u0441\u0438\u043c\u0432\u043e\u043b.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u043f\u043e\u0441\u043b\u0435 \u043f\u0430\u0434\u0434\u0438\u043d\u0433\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">recipe_sequence_to_string(dataset_vectorized_padded[0])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">\u25d8 Slow Cooker Chicken and Dumplings  \u2756  \u2022 4 skinless, boneless chicken breast halves  \u2022 2 tablespoons butter  \u2022 2 (10.75 ounce) cans condensed cream of chicken soup  \u2022 1 onion, finely diced  \u2022 2 (10 ounce) packages refrigerated biscuit dough, torn into pieces   \u273c  \ufe0e Place the chicken, butter, soup, and onion in a slow cooker, and fill with enough water to cover. \ufe0e Cover, and cook for 5 to 6 hours on High. About 30 minutes before serving, place the torn biscuit dough in the slow cooker. Cook until the dough is no longer raw in the center. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 <code>\u2423<\/code>. \u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 LSTM \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u0443\u0436\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d.<\/p>\n<p>  <\/p>\n<h3 id=\"konvertiruem-nabor-dannyh-v-tensorflow-dataset\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 TensorFlow dataset<\/h3>\n<p>  <\/p>\n<p>\u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u0430\u043a \u0438 \u0441 NumPy \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c NumPy \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/data\/Dataset\" rel=\"nofollow\">TensorFlow dataset<\/a>. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a <code>batch()<\/code>, <code>shuffle()<\/code>, <code>repeat()<\/code>, <code>prefecth()<\/code> \u0438 \u043f\u0440.:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">dataset = tf.data.Dataset.from_tensor_slices(dataset_vectorized_padded)  print(dataset)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">&lt;TensorSliceDataset shapes: (2001,), types: tf.int32&gt;<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412\u044b\u0432\u0435\u0434\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 TensorFlow:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for recipe in dataset.take(1):     print('Raw recipe:\\n', recipe.numpy(), '\\n\\n\\n')     print('Stringified recipe:\\n')     recipe_sequence_to_string(recipe.numpy())<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Raw recipe:  [ 51   1  33 ... 165 165 165]   Stringified recipe:  \u25d8 Slow Cooker Chicken and Dumplings  \u2756  \u2022 4 skinless, boneless chicken breast halves  \u2022 2 tablespoons butter  \u2022 2 (10.75 ounce) cans condensed cream of chicken soup  \u2022 1 onion, finely diced  \u2022 2 (10 ounce) packages refrigerated biscuit dough, torn into pieces   \u273c  \ufe0e Place the chicken, butter, soup, and onion in a slow cooker, and fill with enough water to cover. \ufe0e Cover, and cook for 5 to 6 hours on High. About 30 minutes before serving, place the torn biscuit dough in the slow cooker. Cook until the dough is no longer raw in the center. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"razbivaem-tekst-receptov-na-vhodnuyu-i-celevuyu-posledovatelnosti\">\u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043d\u0430 <code>\u0432\u0445\u043e\u0434\u043d\u0443\u044e<\/code> \u0438 <code>\u0446\u0435\u043b\u0435\u0432\u0443\u044e<\/code> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p>  <\/p>\n<p>\u041d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b <code>H<\/code> \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u0435\u0442\u0438, \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043c\u044b \u0436\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c (\u043f\u0443\u0441\u043a\u0430\u0439 <code>\u0435<\/code>). \u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043e\u0442 \u043d\u0430\u0441 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430, \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0435 \u043d\u0430 \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b, \u0447\u0442\u043e\u0431\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>\u0432\u0445\u043e\u0434\u043d\u0443\u044e<\/code> \u0438 <code>\u0446\u0435\u043b\u0435\u0432\u0443\u044e<\/code> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 <code>sequence_length<\/code> \u0440\u0430\u0432\u043d\u0430 <code>4<\/code>, \u0430 \u043d\u0430\u0448 \u0442\u0435\u043a\u0441\u0442 \u2014 \u044d\u0442\u043e <code>Hello<\/code>, \u0442\u043e \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 <code>Hell<\/code>, \u0430 \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2014 <code>ello<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def split_input_target(recipe):     input_text = recipe[:-1]     target_text = recipe[1:]      return input_text, target_text  dataset_targeted = dataset.map(split_input_target)  print(dataset_targeted)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">&lt;MapDataset shapes: ((2000,), (2000,)), types: (tf.int32, tf.int32)&gt;<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 tuple \u0438\u0437 \u0434\u0432\u0443\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439: \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for input_example, target_example in dataset_targeted.take(1):     print('Input sequence size:', repr(len(input_example.numpy())))     print('Target sequence size:', repr(len(target_example.numpy())))     print()      input_stringified = tokenizer.sequences_to_texts([input_example.numpy()[:50]])[0]     target_stringified = tokenizer.sequences_to_texts([target_example.numpy()[:50]])[0]      print('Input:  ', repr(''.join(input_stringified)))     print('Target: ', repr(''.join(target_stringified)))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Input sequence size: 2000 Target sequence size: 2000  Input:   '\u25d8   S l o w   C o o k e r   C h i c k e n   a n d   D u m p l i n g s \\n \\n \u2756 \\n \\n \u2022   4   s k i n l e' Target:  '  S l o w   C o o k e r   C h i c k e n   a n d   D u m p l i n g s \\n \\n \u2756 \\n \\n \u2022   4   s k i n l e s'<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0435\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e. \u041d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 <code>\u25d8<\/code> \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 <code>` (\u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435) \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/code> <code>(\u043f\u0440\u043e\u0431\u0435\u043b) \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/code>S` \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0435\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. <\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for i, (input_idx, target_idx) in enumerate(zip(input_example[:10], target_example[:10])):     print('Step {:2d}'.format(i + 1))     print('  input: {} ({:s})'.format(input_idx, repr(tokenizer.sequences_to_texts([[input_idx.numpy()]])[0])))     print('  expected output: {} ({:s})'.format(target_idx, repr(tokenizer.sequences_to_texts([[target_idx.numpy()]])[0])))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Step  1   input: 51 ('\u25d8')   expected output: 1 (' ') Step  2   input: 1 (' ')   expected output: 33 ('S') Step  3   input: 33 ('S')   expected output: 10 ('l') Step  4   input: 10 ('l')   expected output: 5 ('o') Step  5   input: 5 ('o')   expected output: 23 ('w') Step  6   input: 23 ('w')   expected output: 1 (' ') Step  7   input: 1 (' ')   expected output: 35 ('C') Step  8   input: 35 ('C')   expected output: 5 ('o') Step  9   input: 5 ('o')   expected output: 5 ('o') Step 10   input: 5 ('o')   expected output: 25 ('k')<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"razbitie-nabora-dannyh-na-gruppy\">\u0420\u0430\u0437\u0431\u0438\u0442\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u044b<\/h3>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043e\u043a\u043e\u043b\u043e <code>~100000<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 <code>2000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print(dataset_targeted)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">&lt;MapDataset shapes: ((2000,), (2000,)), types: (tf.int32, tf.int32)&gt;<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412\u044b\u0432\u0435\u0434\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print('TOTAL_RECIPES_NUM: ', TOTAL_RECIPES_NUM) print('MAX_RECIPE_LENGTH: ', MAX_RECIPE_LENGTH) print('VOCABULARY_SIZE: ', VOCABULARY_SIZE)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">TOTAL_RECIPES_NUM:  100212 MAX_RECIPE_LENGTH:  2000 VOCABULARY_SIZE:  176<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Backpropagation\" rel=\"nofollow\">backpropagation<\/a> \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u0441\u0440\u0430\u0437\u0443, \u0442\u043e \u0443 \u043d\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u044d\u043f\u043e\u0445\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># Batch size. BATCH_SIZE = 64  # \u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. # \u041f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u0432\u0441\u0435 100000 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e. # \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0447\u043a\u0430\u043c\u0438 \u043f\u043e 1000 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432. SHUFFLE_BUFFER_SIZE = 1000  dataset_train = dataset_targeted \\   # \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u043c \u0440\u0435\u0446\u0435\u043f\u0442\u044b.   .shuffle(SHUFFLE_BUFFER_SIZE) \\   # \u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u044b.   .batch(BATCH_SIZE, drop_remainder=True) \\   # \u0417\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.    .repeat()  print(dataset_train)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">&lt;RepeatDataset shapes: ((64, 2000), (64, 2000)), types: (tf.int32, tf.int32)&gt;<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0418\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u044b\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0432\u0441\u0435 \u0442\u0435\u0445 \u0436\u0435 \u0434\u0432\u0443\u0445 tuples \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043f\u0430\u0447\u043a\u0438 \u043f\u043e <code>64<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for input_text, target_text in dataset_train.take(1):     print('1st batch: input_text:', input_text)     print()     print('1st batch: target_text:', target_text)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">1st batch: input_text: tf.Tensor( [[ 51   1  54 ... 165 165 165]  [ 51   1  64 ... 165 165 165]  [ 51   1  44 ... 165 165 165]  ...  [ 51   1  69 ... 165 165 165]  [ 51   1  55 ... 165 165 165]  [ 51   1  70 ... 165 165 165]], shape=(64, 2000), dtype=int32)  1st batch: target_text: tf.Tensor( [[  1  54   4 ... 165 165 165]  [  1  64   5 ... 165 165 165]  [  1  44   6 ... 165 165 165]  ...  [  1  69   3 ... 165 165 165]  [  1  55   3 ... 165 165 165]  [  1  70   2 ... 165 165 165]], shape=(64, 2000), dtype=int32)<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"sozdaem-model\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/Sequential\" rel=\"nofollow\">tf.keras.Sequential<\/a> \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u043b\u043e\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/layers\/Embedding\" rel=\"nofollow\">tf.keras.layers.Embedding<\/a> \u2014 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u043b\u043e\u0439 (\u043e\u0431\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0441 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <code>embedding_dim<\/code>),<\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/layers\/LSTM\" rel=\"nofollow\">tf.keras.layers.LSTM<\/a> \u2014 \u0441\u043b\u043e\u0439 LSTM, \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0430\u044f \u0441\u0435\u0442\u044c (\u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0439 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/layers\/GRU\" rel=\"nofollow\">GRU<\/a>),<\/li>\n<li><a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/layers\/Dense\" rel=\"nofollow\">tf.keras.layers.Dense<\/a> \u2014 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u043b\u043e\u0439, \u0441 <code>VOCABULARY_SIZE<\/code> \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0445\u043e\u0434\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"razbiraemsya-kak-rabotaet-embedding-layer\">\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 embedding layer<\/h3>\n<p>  <\/p>\n<p>Embedding layer \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c (\u0433\u0440\u0443\u043f\u043f\u0443, \u043f\u0430\u0447\u043a\u0443) \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u043b\u0438\u043d\u043e\u0439 <code>tmp_embedding_size<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tmp_vocab_size = 10 tmp_embedding_size = 5 tmp_input_length = 8 tmp_batch_size = 2  tmp_model = tf.keras.models.Sequential() tmp_model.add(tf.keras.layers.Embedding(   input_dim=tmp_vocab_size,   output_dim=tmp_embedding_size,   input_length=tmp_input_length )) # The model will take as input an integer matrix of size (batch, input_length). # The largest integer (i.e. word index) in the input should be no larger than 9 (tmp_vocab_size). # Now model.output_shape == (None, 10, 64), where None is the batch dimension. tmp_input_array = np.random.randint(   low=0,   high=tmp_vocab_size,   size=(tmp_batch_size, tmp_input_length) ) tmp_model.compile('rmsprop', 'mse') tmp_output_array = tmp_model.predict(tmp_input_array)  print('tmp_input_array shape:', tmp_input_array.shape) print('tmp_input_array:') print(tmp_input_array) print() print('tmp_output_array shape:', tmp_output_array.shape) print('tmp_output_array:') print(tmp_output_array)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">tmp_input_array shape: (2, 8) tmp_input_array: [[2 4 7 5 1 6 9 7]  [3 6 8 1 4 0 1 2]]  tmp_output_array shape: (2, 8, 5) tmp_output_array: [[[-0.02229502 -0.02800617 -0.0120693  -0.01681594 -0.00650246]   [-0.03046973 -0.03920818  0.04956308  0.04417323 -0.00446874]   [-0.0215276   0.01532575 -0.02229529  0.02834387  0.02725342]   [ 0.04567988  0.0141306   0.00877035 -0.02601192  0.00380837]   [ 0.02969306  0.02994296 -0.00233263  0.00716375 -0.00847433]   [ 0.04598364 -0.00704358 -0.01386416  0.01195388 -0.00309662]   [-0.00137572  0.01275543 -0.02348721 -0.04825885  0.00527108]   [-0.0215276   0.01532575 -0.02229529  0.02834387  0.02725342]]   [[ 0.01082945  0.03824175 -0.00450991 -0.02865709  0.02502238]   [ 0.04598364 -0.00704358 -0.01386416  0.01195388 -0.00309662]   [ 0.02275398  0.03806095 -0.03491788  0.04705564  0.00167596]   [ 0.02969306  0.02994296 -0.00233263  0.00716375 -0.00847433]   [-0.03046973 -0.03920818  0.04956308  0.04417323 -0.00446874]   [-0.02909902  0.04426369  0.00150937  0.04579213  0.02559013]   [ 0.02969306  0.02994296 -0.00233263  0.00716375 -0.00847433]   [-0.02229502 -0.02800617 -0.0120693  -0.01681594 -0.00650246]]]<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"model-lstm\">\u041c\u043e\u0434\u0435\u043b\u044c LSTM<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/www.tensorflow.org\/tutorials\/text\/text_generation\" rel=\"nofollow\">Text generation with an RNN<\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043b\u043e\u044f\u0445 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def build_model(vocab_size, embedding_dim, rnn_units, batch_size):     model = tf.keras.models.Sequential()      model.add(tf.keras.layers.Embedding(         input_dim=vocab_size,         output_dim=embedding_dim,         batch_input_shape=[batch_size, None]     ))      model.add(tf.keras.layers.LSTM(         units=rnn_units,         return_sequences=True,         stateful=True,         recurrent_initializer=tf.keras.initializers.GlorotNormal()     ))      model.add(tf.keras.layers.Dense(vocab_size))      return model  model = build_model(   vocab_size=VOCABULARY_SIZE,   embedding_dim=256,   rnn_units=1024,   batch_size=BATCH_SIZE )  model.summary()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Model: &quot;sequential_13&quot; _________________________________________________________________ Layer (type)                 Output Shape              Param #    ================================================================= embedding_13 (Embedding)     (64, None, 256)           45056      _________________________________________________________________ lstm_9 (LSTM)                (64, None, 1024)          5246976    _________________________________________________________________ dense_8 (Dense)              (64, None, 176)           180400     ================================================================= Total params: 5,472,432 Trainable params: 5,472,432 Non-trainable params: 0 _________________________________________________________________<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tf.keras.utils.plot_model(     model,     show_shapes=True,     show_layer_names=True,     to_file='model.png' )<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/69d\/d45\/4b3\/69dd454b38a2cb834ff2399587d6cd92.png\" alt=\"Model architecture\"><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 embedding \u0432\u0435\u043a\u0442\u043e\u0440, \u043f\u043e\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 LSTM, \u0432\u044b\u0432\u043e\u0434 LSTM \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u043b\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c47\/fb3\/afb\/c47fb3afb041ecd74a969c20df71db1c.png\" alt=\"Model architecture\"><\/p>\n<p>  <\/p>\n<blockquote><p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f: <a href=\"https:\/\/www.tensorflow.org\/tutorials\/text\/text_generation\" rel=\"nofollow\">Text generation with an RNN<\/a>.<\/p><\/blockquote>\n<p>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 \u0441\u0435\u0442\u044c\u044e GRU, \u043d\u043e \u043e\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0438 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f \u0441 LSTM.<\/p>\n<p>  <\/p>\n<h2 id=\"testiruem-interfeys-modeli-pered-trenirovkoy\">\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <em>\u043d\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f<\/em> \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">for input_example_batch, target_example_batch in dataset_train.take(1):     example_batch_predictions = model(input_example_batch)     print(example_batch_predictions.shape, &quot;# (batch_size, sequence_length, vocab_size)&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">(64, 2000, 176) # (batch_size, sequence_length, vocab_size)<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u043c\u043d\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0434\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c sampling \u043f\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print('Prediction for the 1st letter of the batch 1st sequense:') print(example_batch_predictions[0, 0])<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Prediction for the 1st letter of the batch 1st sequense: tf.Tensor( [-9.0643829e-03 -1.9503604e-03  9.3381782e-04  3.7442446e-03  -2.0541784e-03 -7.4054599e-03 -7.1884273e-03  2.6014952e-03   4.8721582e-03  3.0045470e-04  2.6016519e-04 -4.1374690e-03   5.3856964e-03  2.6284808e-03 -5.6002503e-03  2.6019611e-03  -1.9491187e-03 -3.1097094e-04  6.3465843e-03  1.4640498e-03   2.4560774e-03 -3.1256995e-03  1.4104056e-03  2.5478401e-04   5.4266443e-03 -4.1188141e-03  3.6904984e-03 -5.8337618e-03   3.6372752e-03 -3.1899021e-05  3.2178329e-03  1.5033322e-04   5.2770867e-04 -8.1920059e-04 -2.2364906e-03 -2.3271297e-03   4.4109682e-03  4.2381673e-04  1.0532180e-03 -1.4208974e-03  -3.2446394e-03 -4.5869066e-03  4.3250201e-04 -4.3490473e-03   3.7889536e-03 -9.2122913e-04  7.8936084e-04 -9.7079907e-04   1.7070504e-03 -2.5260956e-03  6.7904620e-03  1.5470090e-03  -9.4337866e-04 -1.5072266e-03  6.8939931e-04 -1.0795534e-03  -3.1912089e-03  2.3665284e-03  1.7737487e-03 -2.3504677e-03  -6.8649277e-04  9.6421910e-04 -4.1204207e-03 -3.8750230e-03   1.9077851e-03  4.7145790e-05 -2.9846188e-03  5.8050319e-03  -5.6210475e-04 -2.5910907e-04  5.2890396e-03 -5.8653783e-03  -6.0040038e-06  2.3905798e-03 -2.9405006e-03  2.0132761e-03  -3.5594390e-03  4.0282350e-04  4.7719614e-03 -2.4438011e-03  -1.1028582e-03  2.0007135e-03 -1.6961874e-03 -4.2196750e-03  -3.5689408e-03 -4.1934610e-03 -8.5307617e-04  1.5773368e-04  -1.4612130e-03  9.5826073e-04  4.0543079e-04 -2.3562380e-04  -1.5394683e-03  3.6650903e-03  3.5997448e-03  2.2390878e-03  -6.8982318e-04  1.4068574e-03 -2.0531749e-03 -1.5443334e-03  -1.8235333e-03 -3.2099178e-03  1.6660831e-03  1.2230751e-03   3.8084832e-03  6.9559496e-03  5.7684043e-03  3.1751506e-03   7.4234616e-04  1.1971325e-04 -2.7798198e-03  2.1485630e-03   4.0362971e-03  6.4410735e-05  1.7432809e-03  3.2334479e-03  -6.1469898e-03 -2.2205685e-03 -1.0864032e-03 -2.0876178e-07   2.3065242e-03 -1.5816523e-03 -2.1492387e-03 -4.4033155e-03   1.1003019e-03 -9.7132073e-04 -6.3941808e-04  3.0277157e-03   2.9096641e-03 -2.4778468e-03 -2.9532036e-03  7.7463314e-04   2.7473709e-03 -7.6333171e-04 -8.1811845e-03 -1.3959130e-03   3.2840301e-03  6.0461317e-03 -1.3022404e-04 -9.4000692e-04  -2.0096730e-04  3.3895797e-03  2.9710699e-03  1.9046264e-03   2.5092331e-03 -2.0799250e-04 -2.2211851e-04 -3.4621451e-05   1.9962704e-03 -2.3159904e-03  2.9832027e-03  3.3852295e-03   3.4411502e-04 -1.9019389e-03 -3.6734296e-04 -1.4232489e-03   2.6938838e-03 -2.8015859e-03 -5.7366290e-03  8.0239226e-04  -6.2909431e-04  1.1508183e-03 -1.5899434e-04 -5.9326587e-04  -4.1618512e-04  5.2454891e-03  1.2823739e-03 -1.7550631e-03  -3.0120560e-03 -3.8433261e-03 -9.6873334e-04  1.9963509e-03   1.8154597e-03  4.7434499e-03  1.7146189e-03  1.1544267e-03], shape=(176,), dtype=float32)<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 <code>example_batch_predictions<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 (\u043c\u0430\u0441\u0441\u0438\u0432) \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c. \u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <code>15<\/code> \u044d\u0442\u043e\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u043f\u0443\u0441\u043a\u0430\u0439, \u0440\u0430\u0432\u043d\u0430 <code>0.3<\/code>, \u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <code>25<\/code> \u0440\u0430\u0432\u043d\u0430 <code>1.1<\/code> \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>25<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e (\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b (\u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445), \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u043e \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u0435\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0431\u044b \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0446\u0435\u043f\u0442 \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 (\u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445). \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <strong>sampling<\/strong> \u043f\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/random\/categorical\" rel=\"nofollow\">tf.random.categorical()<\/a>. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u0435\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 &quot;\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c&quot; \u0438\u043b\u0438 &quot;\u0438\u043c\u043f\u0440\u043e\u0432\u0438\u0437\u0430\u0446\u0438\u044e&quot; \u0432 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u0430 \u0441\u0438\u043c\u0432\u043e\u043b <code>H<\/code>. \u041f\u043e\u0441\u043b\u0435 \u0441\u0435\u043c\u043f\u043b\u0438\u043d\u0433\u0430, \u043d\u0430\u0448\u0430 \u0441\u0435\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0432\u043e <code>He<\/code>, \u043d\u043e \u0438 \u0441\u043b\u043e\u0432\u0430 <code>Hello<\/code>, <code>Hi<\/code> \u0438 \u0442.\u043f.<\/p>\n<p>  <\/p>\n<h3 id=\"razbiraemsya-kak-rabotaet-funkciya-tfrandomcategorical\">\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>tf.random.categorical()<\/code><\/h3>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>tf.random.categorical()<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>logits<\/code>. \u041b\u043e\u0433\u0438\u0442\u044b \u2014 \u044d\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e <code>[batch_size, num_classes]<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u044f\u0434 \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <code>[i, :]<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f). \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>0<\/code> \u043d\u0438\u0437\u043a\u0430\u044f, \u043d\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>2<\/code> \u2014 \u0432\u044b\u0448\u0435. \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0435\u043c\u043f\u043b\u0438\u043d\u0433 \u043f\u043e \u044d\u0442\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0443\u0441\u043a\u0430\u0439, <code>5<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u0443\u0434\u0443\u0442 \u0443\u0447\u0442\u0435\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>tf.random.categorical()<\/code> \u0438 \u043e\u043d\u0430 \u0432\u044b\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0442\u0435\u043d\u0437\u043e\u0440 \u0441 5-\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>2<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0447\u0430\u0449\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tmp_logits = [   [-0.95, 0, 0.95], ];  tmp_samples = tf.random.categorical(     logits=tmp_logits,     num_samples=5 )  print(tmp_samples)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">tf.Tensor([[2 1 2 2 1]], shape=(1, 5), dtype=int64)<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"sempling-po-predskazaniyam-lstm-modeli\">\u0421\u044d\u043c\u043f\u043b\u0438\u043d\u0433 \u043f\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f\u043c LSTM \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">sampled_indices = tf.random.categorical(     logits=example_batch_predictions[0],     num_samples=1 )  sampled_indices = tf.squeeze(     input=sampled_indices,     axis=-1 ).numpy()  sampled_indices.shape<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">(2000,)<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u044b\u0445 <code>100<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0440\u0435\u0446\u0435\u043f\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">sampled_indices[:100]<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">array([ 64,  21,  91, 126, 170,  42, 146,  54, 125, 164,  60, 171,   9,         87, 129,  28, 146, 103,  41, 101, 147,   3, 134, 171,   8, 170,        105,   5,  44, 173,   5, 105,  17, 138, 165,  32,  88,  96, 145,         83,  33,  65, 172, 162,   8,  29, 147,  58,  81, 153, 150,  56,        156,  38, 144, 134,  13,  40,  17,  50,  27,  35,  39, 112,  63,        139, 151, 133,  68,  29,  91,   2,  70, 112, 135,  31,  26, 156,        118,  71,  49, 104,  75,  27, 164,  41, 117, 124,  18, 137,  59,        160, 158, 119, 173,  50,  78,  45, 121, 118])<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0435\u0449\u0435 <em>\u043d\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f<\/em> \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0446\u0435\u043f\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">print('Input:\\n', repr(''.join(tokenizer.sequences_to_texts([input_example_batch[0].numpy()[:50]])))) print() print('Next char prediction:\\n', repr(''.join(tokenizer.sequences_to_texts([sampled_indices[:50]]))))<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Input:  '\u25d8   R e s t a u r a n t - S t y l e   C o l e s l a w   I \\n \\n \u2756 \\n \\n \u2022   1   ( 1 6   o u n c e )   p'  Next char prediction:  'H . \u00ee \u2044 \u0103 ( \u201c I \u00ba \u00c2 8 \u0300 s % \u00f9 y \u201c  0 \u2019 \u2027 a \u00ec \u0300 r \u0103 + o A \u20ac o + m \u00d7 \u2423 \ufe0e \u00f1 \u00e7 \u2031 ! S : \u215e \u00b4 r 2 \u2027 D Q \u00c1'<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"treniruem-model\">\u0422\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>  <\/p>\n<h3 id=\"optimizator-i-funkciya-poter\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c<\/h3>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/optimizers\/Adam\" rel=\"nofollow\">tf.keras.optimizers.Adam<\/a>, \u0430 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/losses\/sparse_categorical_crossentropy\" rel=\"nofollow\">tf.keras.losses.sparse_categorical_crossentropy()<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c. # \u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430: scalar_loss = fn(y_true, y_pred). def loss(labels, logits):     entropy = tf.keras.losses.sparse_categorical_crossentropy(       y_true=labels,       y_pred=logits,       from_logits=True     )      return entropy  example_batch_loss = loss(target_example_batch, example_batch_predictions)  print(&quot;Prediction shape: &quot;, example_batch_predictions.shape, &quot; # (batch_size, sequence_length, vocab_size)&quot;) print(&quot;scalar_loss.shape:      &quot;, example_batch_loss.shape) print(&quot;scalar_loss:      &quot;, example_batch_loss.numpy().mean())<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Prediction shape:    (64, 2000, 176)  # (batch_size, sequence_length, vocab_size) scalar_loss.shape:   (64, 2000) scalar_loss:         5.1618285<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">adam_optimizer = tf.keras.optimizers.Adam(learning_rate=0.001)  model.compile(     optimizer=adam_optimizer,     loss=loss )<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastraivaem-kolbeki\">\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0431\u0435\u043a\u0438<\/h3>\n<p>  <\/p>\n<h4 id=\"rannyaya-ostanovka\">\u0420\u0430\u043d\u043d\u044f\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043b\u0431\u0435\u043a\u043e\u043c <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/callbacks\/EarlyStopping\" rel=\"nofollow\">tf.keras.callbacks.EarlyStopping<\/a>. \u041e\u043d \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u0445\u0443\u0434\u0448\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u044d\u043f\u043e\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">early_stopping_callback = tf.keras.callbacks.EarlyStopping(     patience=5,     monitor='loss',     restore_best_weights=True,     verbose=1 )<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"kontrolnye-tochki\">\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043b\u0431\u0435\u043a\u0430 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/callbacks\/ModelCheckpoint\" rel=\"nofollow\">tf.keras.callbacks.ModelCheckpoint<\/a>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0431\u0435\u0437 \u0435\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># Create a checkpoints directory. checkpoint_dir = 'tmp\/checkpoints' os.makedirs(checkpoint_dir, exist_ok=True)  checkpoint_prefix = os.path.join(checkpoint_dir, 'ckpt_{epoch}') checkpoint_callback=tf.keras.callbacks.ModelCheckpoint(     filepath=checkpoint_prefix,     save_weights_only=True )<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"treniruem-model-1\">\u0422\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h3>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 <code>500<\/code> \u044d\u043f\u043e\u0445 \u0441 <code>1500<\/code> \u0448\u0430\u0433\u0430\u043c\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u044d\u043f\u043e\u0445\u0443. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0443, \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u0437 <code>64<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432. \u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0438\u0437 <code>64<\/code> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 (\u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 <code>2000<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432). <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0441 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043f\u043e\u0445 \u0434\u043e, \u0441\u043a\u0430\u0436\u0435\u043c, <code>20<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0448\u0430\u0433\u043e\u0432 \u043d\u0430 \u044d\u043f\u043e\u0445\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u044d\u0442\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445. \u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0441\u0432\u043e\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0448\u0430\u0433\u043e\u0432 \u0438 \u044d\u043f\u043e\u0445) \u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">EPOCHS = 500 INITIAL_EPOCH = 1 STEPS_PER_EPOCH = 1500  print('EPOCHS:          ', EPOCHS) print('INITIAL_EPOCH:   ', INITIAL_EPOCH) print('STEPS_PER_EPOCH: ', STEPS_PER_EPOCH)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">EPOCHS:           500 INITIAL_EPOCH:    1 STEPS_PER_EPOCH:  1500<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">history = model.fit(     x=dataset_train,     epochs=EPOCHS,     steps_per_epoch=STEPS_PER_EPOCH,     initial_epoch=INITIAL_EPOCH,     callbacks=[         checkpoint_callback,         early_stopping_callback     ] )  # Saving the trained model to file (to be able to re-use it later). model_name = 'recipe_generation_rnn_raw.h5' model.save(model_name, save_format='h5')<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"vizualiziruem-process-trenirovki\">\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">def render_training_history(training_history):     loss = training_history.history['loss']      plt.title('Loss')     plt.xlabel('Epoch')     plt.ylabel('Loss')     plt.plot(loss, label='Training set')     plt.legend()     plt.grid(linestyle='--', linewidth=1, alpha=0.5)     plt.show()  render_training_history(history)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ea6\/a65\/0f1\/ea6a650f1d217420032f640487956e78.png\" alt=\"Model training progress (first 10 epochs)\"><\/p>\n<p>  <\/p>\n<p><em>\u041d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0441\u0432\u0435\u0440\u0445\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0435 10 \u0448\u0430\u0433\u043e\u0432 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438.<\/em><\/p>\n<p>  <\/p>\n<p>\u0418\u0437 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"generiruem-recepty\">\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0446\u0435\u043f\u0442\u044b<\/h2>\n<p>  <\/p>\n<h3 id=\"vosstanavlivaem-model-iz-sohranennyh-kontrolnyh-tochek\">\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430\u043d\u043e\u0432\u043e, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0441 <code>batch_size<\/code> \u0440\u0430\u0432\u043d\u044b\u043c <code>1<\/code>. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u044b \u0438\u0437 <code>64<\/code> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u042d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0430. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tf.train.latest_checkpoint(checkpoint_dir)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">'tmp\/checkpoints\/ckpt_1'<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0441 <code>batch_size<\/code> \u0440\u0430\u0432\u043d\u044b\u043c <code>1<\/code> \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0430\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0437\u0430\u043d\u043e\u0432\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">simplified_batch_size = 1  model_simplified = build_model(vocab_size, embedding_dim, rnn_units, simplified_batch_size) model_simplified.load_weights(tf.train.latest_checkpoint(checkpoint_dir)) model_simplified.build(tf.TensorShape([simplified_batch_size, None]))  model_simplified.summary()<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Model: &quot;sequential_6&quot; _________________________________________________________________ Layer (type)                 Output Shape              Param #    ================================================================= embedding_6 (Embedding)      (1, None, 256)            45056      _________________________________________________________________ lstm_5 (LSTM)                (1, None, 1024)           5246976    _________________________________________________________________ dense_5 (Dense)              (1, None, 176)            180400     ================================================================= Total params: 5,472,432 Trainable params: 5,472,432 Non-trainable params: 0 _________________________________________________________________<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0432\u043c\u0435\u0441\u0442\u043e 64-\u0445):<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">model_simplified.input_shape<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">(1, None)<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"cikl-prognozirovaniya\">\u0426\u0438\u043a\u043b \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0438\u043a\u043b\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0432\u044b\u0431\u043e\u0440\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f RNN \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/li>\n<li>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u043c\u043f\u043b\u0438\u043d\u0433\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0442\u0440\u043e\u043a\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/47e\/18c\/bb8\/47e18cbb8b1bcf3590ff8231b4978b36.png\" alt=\"Prediction loop\"><\/p>\n<p>  <\/p>\n<blockquote><p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.tensorflow.org\/tutorials\/text\/text_generation\" rel=\"nofollow\">Text generation with an RNN<\/a> .<\/p><\/blockquote>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>temperature<\/code> \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0447\u0435\u0442\u043a\u0438\u043c \u0438\u043b\u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442. \u041d\u0438\u0437\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>temperature<\/code> \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443. \u0411\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>temperature<\/code> \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443. \u041c\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <code>temperature<\/code> \u043d\u0438\u0436\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def generate_text(model, start_string, num_generate = 1000, temperature=1.0):     # Evaluation step (generating text using the learned model)      padded_start_string = STOP_WORD_TITLE + start_string      # Converting our start string to numbers (vectorizing).     input_indices = np.array(tokenizer.texts_to_sequences([padded_start_string]))      # Empty string to store our results.     text_generated = []      # Here batch size == 1.     model.reset_states()     for char_index in range(num_generate):         predictions = model(input_indices)         # remove the batch dimension         predictions = tf.squeeze(predictions, 0)          # Using a categorical distribution to predict the character returned by the model.         predictions = predictions \/ temperature         predicted_id = tf.random.categorical(             predictions,             num_samples=1         )[-1, 0].numpy()          # We pass the predicted character as the next input to the model         # along with the previous hidden state.         input_indices = tf.expand_dims([predicted_id], 0)          next_character = tokenizer.sequences_to_texts(input_indices.numpy())[0]          text_generated.append(next_character)      return (padded_start_string + ''.join(text_generated))<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"eksperimentiruem-s-parametrom-temperature\">\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>temperature<\/code><\/h3>\n<p>  <\/p>\n<p>\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>generate_text()<\/code> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>generate_combinations()<\/code> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <code>56<\/code> \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>temperature<\/code>. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f <code>temperature<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def generate_combinations(model):     recipe_length = 1000     try_letters = ['', '\\n', 'A', 'B', 'C', 'O', 'L', 'Mushroom', 'Apple', 'Slow', 'Christmass', 'The', 'Banana', 'Homemade']     try_temperature = [1.0, 0.8, 0.4, 0.2]      for letter in try_letters:         for temperature in try_temperature:             generated_text = generate_text(                 model,                 start_string=letter,                 num_generate = recipe_length,                 temperature=temperature             )             print(f'Attempt: &quot;{letter}&quot; + {temperature}')             print('-----------------------------------')             print(generated_text)             print('\\n\\n') <\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u043e\u0439, \u043d\u0438\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 <code>56<\/code> \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">generate_combinations(model_simplified)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u2794 \u0432\u044b\u0432\u043e\u0434:<\/em> <\/p>\n<p>  <\/p>\n<blockquote>\n<pre><code class=\"plaintext\">Attempt: &quot;A&quot; + 1.0 ----------------------------------- \u25d8 Azzeric Sweet Potato Puree  \u2756  \u2022 24 large baking potatoes, such as Carn or Marinara or 1 (14-ounce) can pot wine \u2022 1\/4 pound unsalted butter, cut into small pieces \u2022 1\/2 cup coarsely chopped scallions  \u273c  \ufe0e Bring a large pot of water to a boil, place a large nonstick skillet over medium-high heat, add All Naucocal Volves. Reduce heat to medium and cook the potatoes until just cooked through, bubbles before adding the next layer, about 10 to 12 minutes. Remove ground beans and reserve. Reserve the crumb mixture for about 6 greased. Let cool 2 minutes. Strain soak into a glass pitcher. Let cool in ice. Add short-goodfish to the batter and stir to dissolve. Pour in the cheese mixture and whisk until smooth. Set aside for 20 seconds more. Remove dumplings and cheese curds. Spread 1\/3 cup of the mixture on each circle for seal ballo. Transfer mixture into a greased 9-by-11-inch baking dish and chill for 20 minutes. \ufe0e Bake, covered, for 30 minutes. Serve warm. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423  Attempt: &quot;A&quot; + 0.4 ----------------------------------- \u25d8 Apricot &quot;Cookie&quot; Cakes  \u2756  \u2022 1 cup all-purpose flour \u2022 1 cup corn flour \u2022 1 cup sugar \u2022 1 tablespoon baking powder \u2022 1 teaspoon salt \u2022 1 teaspoon ground cinnamon \u2022 1 cup grated Parmesan \u2022 1 cup pecans, chopped \u2022 1\/2 cup chopped pecans \u2022 1\/2 cup raisins  \u273c  \ufe0e Preheat oven to 350 degrees F. \ufe0e Butter and flour a 9 by 13-inch baking dish. In a medium bowl, whisk together the flour, sugar, baking powder, baking soda and salt. In a small bowl, whisk together the eggs, sugar, and eggs. Add the flour mixture to the butter mixture and mix until just combined. Stir in the raisins and pecans and transfer to the prepared pan. Spread the batter over the top of the crust. Bake for 15 minutes. Reduce the oven temperature to 350 degrees F, and bake until the cupcakes are set and the top is golden brown, about 20 minutes more. Transfer the cake to a wire rack to cool to room temperature. Refrigerate until ready to serve. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423  Attempt: &quot;A&quot; + 0.2 ----------------------------------- \u25d8 Alternative to the Fondant  \u2756  \u2022 1 cup sugar \u2022 1 cup water \u2022 1 cup heavy cream \u2022 1 teaspoon vanilla extract \u2022 1\/2 cup heavy cream \u2022 1\/2 cup heavy cream \u2022 1 teaspoon vanilla extract \u2022 1\/2 cup chopped pecans  \u273c  \ufe0e In a saucepan over medium heat, combine the sugar, sugar, and corn syrup. Cook over medium heat until the sugar is dissolved. Remove from the heat and stir in the vanilla. Refrigerate until cold. Stir in the chocolate chips and the chocolate chips. Serve immediately. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423  Attempt: &quot;B&quot; + 0.4 ----------------------------------- \u25d8 Battered French Toast with Bacon, Bacon, and Caramelized Onions and Pecorino  \u2756  \u2022 1\/2 pound squid (shredded carrots) \u2022 1 small onion, diced \u2022 1 small green pepper, seeded and cut into strips \u2022 1 red bell pepper, stemmed, seeded and cut into 1\/4-inch dice \u2022 1 small onion, chopped \u2022 1 green bell pepper, chopped \u2022 1 cup chicken stock \u2022 1 cup heavy cream \u2022 1\/2 cup shredded sharp Cheddar \u2022 1 teaspoon ground cumin \u2022 1 teaspoon salt \u2022 1 teaspoon freshly ground black pepper  \u273c  \ufe0e Preheat the oven to 350 degrees F. \ufe0e For the bacon mixture: In a large bowl, combine the cheese, sour cream, mustard, salt, pepper, and hot sauce. Stir together and mix well. Fold in the milk and set aside. \ufe0e For the filling: In a large bowl, mix the flour and salt and pepper, to taste. Add the beaten eggs and mix to combine. Set aside. \ufe0e For the topping: Mix the cream cheese with the mayonnaise, salt and pepper in a medium bowl. Add the chicken and toss to coat the other side. Transfer the mixture to the prepared  Attempt: &quot;C&quot; + 1.0 ----------------------------------- \u25d8 Crema battered Salmon  \u2756  \u2022 1 cup fresh cranberries (from 4 tablespoons left of 4 egg whites) \u2022 3 teaspoons sugar \u2022 1 tablespoon unsalted butter \u2022 2 tablespoons truffle oil \u2022 Coarse salt \u2022 Freshly ground black pepper  \u273c  \ufe0e Place cornmeal in a small serving bowl, and combine it. Drizzle milk over the plums and season with salt and pepper. Let stand for about 5 minutes, until firm. Serve immediately. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423  Attempt: &quot;C&quot; + 0.8 ----------------------------------- \u25d8 Classic Iseasteroles  \u2756  \u2022 3 cups milk \u2022 3\/4 cup coconut milk \u2022 1\/2 cup malted maple syrup \u2022 1\/2 teaspoon salt \u2022 3 cups sugar \u2022 4 1-inch strawberries, sliced into 1\/4-inch pieces \u2022 1\/2 teaspoon ground cinnamon  \u273c  \ufe0e Place the cherries in a small saucepan; sprinkle with the sugar. Bring to a simmer over medium-low heat, then remove from the heat. Let stand until the coconut fluffy, about 15 to 20 minutes. Drain the coconut oil in a stream, whisking until combined. Add the cream, espresso and cocoa powder and stir to combine. Cover and refrigerate until ready to serve. Makes 10 to 12 small springs in the same fat from the surface of the bowl, which using paper colors, and freeze overnight. \ufe0e Meanwhile, combine the cream, sugar, vanilla and salt in a medium saucepan. Cook over medium heat until the sugar dissolves and the sugar melts and begins to boil, about 5 minutes. Remove from the heat and stir in the vanilla. \ufe0e To serve, carefully remove the pops from the casserole and put them in  Attempt: &quot;C&quot; + 0.4 ----------------------------------- \u25d8 Cinnamon Corn Cakes with Coconut Flour and Saffron Sauce  \u2756  \u2022 3 cups shredded sharp Cheddar \u2022 1 cup grated Parmesan \u2022 2 cups shredded sharp Cheddar \u2022 1 cup grated Parmesan \u2022 1 cup shredded part-skim mozzarella cheese \u2022 1 cup grated Parmesan \u2022 1 cup grated Parmesan \u2022 1 cup grated Parmesan \u2022 1 teaspoon kosher salt \u2022 1\/2 teaspoon freshly ground black pepper  \u273c  \ufe0e Preheat the oven to 400 degrees F. Line a baking sheet with a silpat and preheat the oven to 350 degrees F. \ufe0e In a large bowl, combine the masa harina, cumin, cayenne, and salt and pepper. Dredge the pasta in the flour and then dip in the egg mixture, then dip in the eggs, then dip in the egg mixture and then dredge in the breadcrumbs. Place the breaded cheese on a sheet tray. Bake until the crust is golden brown and the filling is bubbling, about 25 to 30 minutes. Remove from the oven and serve hot. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423  Attempt: &quot;L&quot; + 0.4 ----------------------------------- \u25d8 Lighted Flan with Chocolate and Pecans  \u2756  \u2022 2 cups milk \u2022 1 cup sugar \u2022 1 teaspoon vanilla extract \u2022 1 cup heavy cream \u2022 1\/2 cup heavy cream \u2022 1 tablespoon powdered sugar \u2022 1 teaspoon vanilla extract \u2022 1\/2 cup heavy cream \u2022 1\/2 teaspoon ground cinnamon \u2022 1\/2 teaspoon ground nutmeg \u2022 1\/2 cup chopped pecans  \u273c  \ufe0e Watch how to make this recipe. \ufe0e In a small saucepan, combine the sugar, salt, and a pinch of salt. Cook over medium heat, stirring occasionally, until the sugar has dissolved. Remove from the heat and set aside to cool. Remove the cherries from the refrigerator and place in the freezer for 1 hour. \ufe0e In a blender, combine the milk, sugar, vanilla, salt and water. Blend until smooth. Pour the mixture into a 9-by-13-inch glass baking dish and set aside. \ufe0e In a small saucepan, combine the remaining 2 cups sugar, the vanilla, and 2 cups water. Bring the mixture to a boil, and then reduce the heat to low. Cook until the sugar is dissolved, about 5 minutes. Remove from the heat an  Attempt: &quot;L&quot; + 0.2 ----------------------------------- \u25d8 Lighted Fondanta with Chocolate and Cream Cheese Frosting  \u2756  \u2022 1 cup heavy cream \u2022 1 tablespoon sugar \u2022 1 tablespoon vanilla extract \u2022 1 teaspoon vanilla extract \u2022 1 cup heavy cream \u2022 1 cup heavy cream \u2022 1\/2 cup sugar \u2022 1 teaspoon vanilla extract \u2022 1 teaspoon vanilla extract \u2022 1\/2 cup chopped pistachios  \u273c  \ufe0e Preheat the oven to 350 degrees F. \ufe0e In a large bowl, combine the cream cheese, sugar, eggs, vanilla, and salt. Stir until smooth. Pour the mixture into the prepared baking dish. Sprinkle with the remaining 1\/2 cup sugar and bake for 15 minutes. Reduce the heat to 350 degrees F and bake until the crust is golden brown, about 15 minutes more. Remove from the oven and let cool completely. Spread the chocolate chips on the parchment paper and bake until the chocolate is melted and the top is golden brown, about 10 minutes. Set aside to cool. \ufe0e In a medium bowl, whisk together the egg yolks, sugar, and vanilla until smooth. Stir in the cream and continue to beat until the chocolate  Attempt: &quot;Mushroom&quot; + 1.0 ----------------------------------- \u25d8 Mushroom and Bacon Soup with Jumbo Sugar Coating  \u2756  \u2022 2 tablespoons vegetable oil \u2022 1 2\/3 pounds red cabbage, shredded, about 4 cups of excess pasted dark ends of fat, and pocked or firm \u2022 2 red bell peppers, cored, seeded and diced \u2022 1 poblano pepper, chopped \u2022 3 medium carrots, finely chopped \u2022 1\/2 medium pinch saffron \u2022 4 cups water \u2022 2 cups mushrooms or 1\/2 cup frozen Sojo Bean red \u2022 Salt and freshly ground black pepper \u2022 1 pound andouille sausage \u2022 1 gallon vegetable broth \u2022 Chopped fresh parsley, cilantro leaves, for garnish  \u273c  \ufe0e In a large Dutch oven for gas burner, heat oil over moderate heat. Add the leeks to the pot, scraping the bottom of the skillet. Add the beans and sausage and sprinkle the reserved potatoes with some orange juice cooked sausage (such as The Sauce.) Add roasted vegetables and pinto beans, mozzarella, basil and bamboo shoots. Simmer rice until soup is absorbed, 15 to 20 minutes. \ufe0e Bring another pan of water to a boil and cook shrimp for 5 minutes. While onions  Attempt: &quot;Mushroom&quot; + 0.8 ----------------------------------- \u25d8 Mushrooms with Lentil Stewed Shallots and Tomatoes  \u2756  \u2022 1 tablespoon olive oil \u2022 3 cloves garlic, smashed \u2022 Kosher salt \u2022 1 1\/2 pounds lean ground turkey \u2022 1 cup coarsely peeled tart apples \u2022 2 tablespoons chopped garlic \u2022 1 teaspoon ground cumin \u2022 1\/2 teaspoon cayenne pepper \u2022 1 teaspoon chopped fresh thyme \u2022 3\/4 cup chopped fresh basil \u2022 1\/2 small carrot, halved lengthwise and cut into 1\/2-inch pieces \u2022 1 roasted red pepper, halved and sliced vertically diced and separated into rough chops \u2022 3 tablespoons unsalted butter \u2022 2 cups shredded mozzarella \u2022 1\/4 cup grated parmesan cheese \u2022 1\/4 cup prepared basil pesto  \u273c  \ufe0e Stir the olive oil, garlic, thyme and 1 teaspoon salt in a saucepan; bring to a simmer over medium heat. Remove from the heat. Add the basil and toast the soup for 2 minutes. \ufe0e Meanwhile, heat 4 to 4 inches vegetable oil in the skillet over medium-high heat. Add the olive oil, garlic, 1\/2 teaspoon salt and 1\/2 teaspoon pepper and cook, stirring often, until cooked through, a  Attempt: &quot;Mushroom&quot; + 0.4 ----------------------------------- \u25d8 Mushroom Ravioli with Chickpeas and Shiitake Mushrooms and Sun-Dried Tomatoes  \u2756  \u2022 1 pound zucchini \u2022 1 cup chicken broth \u2022 1 cup fresh basil leaves \u2022 1\/2 cup chopped fresh basil leaves \u2022 1\/2 cup grated Parmesan \u2022 1 teaspoon salt \u2022 1\/2 teaspoon freshly ground black pepper \u2022 1 teaspoon chopped fresh thyme \u2022 1 teaspoon fresh lemon juice \u2022 2 cups chicken broth \u2022 1\/2 cup grated Parmesan \u2022 1\/2 cup grated Parmigiano-Reggiano  \u273c  \ufe0e Preheat oven to 450 degrees F. \ufe0e Place the bread cubes in a large bowl. Add the basil, parsley, olive oil, parsley, thyme, basil, salt and pepper and toss to coat. Spread the mixture out on a baking sheet and bake until the sausages are cooked through, about 20 minutes. Serve immediately. \ufe0e In a small saucepan, bring the chicken stock to a boil. Reduce the heat to low and cook the soup until the liquid is absorbed. Remove from the heat and stir in the parsley, shallots and season with salt and pepper. Serve immediately. \u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423\u2423  Attempt: &quot;Mushroom&quot; + 0.2 ----------------------------------- \u25d8 Mushroom and Spicy Sausage Stuffing  \u2756  \u2022 1 tablespoon olive oil \u2022 1 medium onion, chopped \u2022 2 cloves garlic, minced \u2022 1 cup frozen peas \u2022 1 cup frozen peas \u2022 1\/2 cup chopped fresh parsley \u2022 1\/2 cup grated Parmesan \u2022 1\/2 cup grated Parmesan \u2022 1 teaspoon salt \u2022 1\/2 teaspoon freshly ground black pepper \u2022 1 cup shredded mozzarella \u2022 1\/2 cup grated Parmesan \u2022 1 cup shredded mozzarella \u2022 1 cup shredded mozzarella cheese  \u273c  \ufe0e Preheat the oven to 350 degrees F. \ufe0e Bring a large pot of salted water to a boil. Add the pasta and cook until al dente, about 6 minutes. Drain and reserve. \ufe0e Meanwhile, heat the olive oil in a large skillet over medium-high heat. Add the shallots and saute until tender, about 3 minutes. Add the garlic and cook for 1 minute. Add the sausage and cook until the shallots are tender, about 3 minutes. Add the sausage and cook until tender, about 2 minutes. Add the garlic and cook, stirring, until the garlic is lightly browned, about 1 minute. Add the sausage and cook until the s<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"interaktivnaya-demonstraciya-modeli\">\u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/trekhleb.github.io\/machine-learning-experiments\/#\/experiments\/RecipeGenerationRNN\" rel=\"nofollow\"><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432<\/strong><\/a> \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043e\u0439. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/413\/999\/0ec\/4139990ec63f03c35fab15d60ea74eff.gif\" alt=\"Recipe generator demo\"><\/p>\n<p>  <\/p>\n<h2 id=\"plany-po-uluchsheniyu-modeli\">\u041f\u043b\u0430\u043d\u044b \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0441\u0435 \u0435\u0449\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u044e\u0430\u043d\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c\/\u0440\u0435\u0448\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 &quot;\u0418\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b&quot;.<\/li>\n<li>\u0420\u0430\u0437\u0434\u0435\u043b\u044b \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b \u0438 \u044d\u0442\u0430\u043f\u044b \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f) \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0441\u043a\u0430\u0436\u0435\u043c, <code>mushrooms<\/code> \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043d\u0438 \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u0430, \u043d\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0430\u0445 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/508136\/\"> https:\/\/habr.com\/ru\/post\/508136\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508136\/\">\n<h2 id=\"tldr\">TL;DR<\/h2>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u043b LSTM <em>(Long short-term memory)<\/em> \u0440\u0435\u043a\u0443\u0440\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c <em>(RNN)<\/em> \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0438\u0437 <em>~100k<\/em> \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f TensorFlow. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 \u043c\u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c <em>&quot;\u0421\u043b\u0438\u0432\u043e\u0447\u043d\u0443\u044e \u0441\u043e\u0434\u0443 \u0441 \u043b\u0443\u043a\u043e\u043c&quot;<\/em>, <em>&quot;\u041a\u043b\u0443\u0431\u043d\u0438\u0447\u043d\u044b\u0439 \u0441\u0443\u043f \u0438\u0437 \u0441\u043b\u043e\u0435\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430&quot;<\/em>, <em>&quot;\u0427\u0430\u0439 \u0441\u043e \u0432\u043a\u0443\u0441\u043e\u043c \u0446\u0443\u043a\u0438\u043d\u0438&quot;<\/em> \u0438 <em>&quot;\u041b\u043e\u0441\u043e\u0441\u0435\u0432\u044b\u0439 \u043c\u0443\u0441\u0441 \u0438\u0437 \u0433\u043e\u0432\u044f\u0434\u0438\u043d\u044b&quot;<\/em> \u200d.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0430\u0439\u0442\u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/trekhleb.github.io\/machine-learning-experiments\/#\/experiments\/RecipeGenerationRNN\" rel=\"nofollow\"><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432: \u0414\u0435\u043c\u043e<\/strong><\/a> \u2014 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u043f\u0440\u044f\u043c\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.<\/li>\n<li>\u200d <a href=\"https:\/\/github.com\/trekhleb\/machine-learning-experiments\/blob\/master\/experiments\/recipe_generation_rnn\/recipe_generation_rnn.ipynb\" rel=\"nofollow\"><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432: \u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430<\/strong><\/a> \u2014 Jupyter \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0441 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/li>\n<li>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/github.com\/trekhleb\/machine-learning-experiments\" rel=\"nofollow\"><strong> Interactive Machine Learning Experiments<\/strong><\/a> \u2014 \u0434\u0440\u0443\u0433\u0438\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a &quot;\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432&quot;, &quot;\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u044d\u0441\u043a\u0438\u0437\u043e\u0432&quot;, &quot;\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439&quot; \u0438 \u0442.\u0434.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u0435\u0442\u0430\u043b\u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 LSTM \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.tensorflow.org\/\" rel=\"nofollow\">TensorFlow 2<\/a> \u0438 <a href=\"https:\/\/www.tensorflow.org\/guide\/keras\" rel=\"nofollow\">Keras API<\/a>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/413\/999\/0ec\/4139990ec63f03c35fab15d60ea74eff.gif\" alt=\"Cooking recipes generator demo\"><\/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-305878","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305878","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=305878"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305878\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}