You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/recipes_generation.ru.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -796,11 +796,13 @@ _<small>➔ вывод:</small>_
796
796
> ▪︎ 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.
797
797
> ```
798
798
799
-
### Add padding to sequences
799
+
### Подгонка последовательностей к одной длине
800
800
801
-
We need all recipes to have the same length for training. To do that we'll use [tf.keras.preprocessing.sequence.pad_sequences](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/sequence/pad_sequences) utility to add a stop word to the end of each recipe and to make them have the same length.
801
+
ℹ️ _Как синоним подгонки по длине мы также будем использовать слово "паддинг"_
802
802
803
-
Let's check the recipes lengths:
803
+
Все рецепты должны иметь одинаковую длину перед тренировкой модели. Для паддинга рецептов мы воспользуемся утилитой [tf.keras.preprocessing.sequence.pad_sequences](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/sequence/pad_sequences). С помощью этой функции мы добавим стоп-символ в конец каждого рецепта так, что все рецепты будут одинаковой длины.
804
+
805
+
На данный момент длины первых 10-и рецептов выглядят следующим образом:
804
806
805
807
```python
806
808
for recipe_index, recipe in enumerate(dataset_vectorized[:10]):
After the padding all recipes in the dataset now have the same length and RNN will also be able to learn where each recipe stops (by observing the presence of a `STOP_SIGN`).
869
+
После подгонки каждый рецепт в наборе данных имеет одинаковую длину и стоп-символ в конце.
870
+
871
+
Длина рецепта на данный момент на один символ больше запланированной (`2001` вместо `2000`). Это сделано по той причине, что ниже из каждого рецепта мы будем формировать входную последовательность `X` (длиной в `2000`) и выходную последовательность `Y` (длиной в `2000`), которые будут сдвинуты друг относительно друга на `1` символ.
868
872
869
-
Here is an example of how a first recipe looks like after the padding.
All recipes now end with one or many `␣` signs. We expect our LSTM model to learn that whenever it sees the `␣` stop-character it means that the recipe is ended. Once the network will learn this concept it will put stop-character at the end of every newly generated recipe.
899
+
Все рецепты сейчас заканчиваются одним или несколькими символами `␣`. Ожидается, что наша LSTM модель научится предлагать этот символ как следующий рекомендуемый, если она будет считать, что текст рецепта уже закончен.
0 commit comments