{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "b518b04cbfe0" }, "source": [ "##### Copyright 2020 The TensorFlow Authors." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "cellView": "form", "execution": { "iopub.execute_input": "2022-12-14T21:28:55.097751Z", "iopub.status.busy": "2022-12-14T21:28:55.097333Z", "iopub.status.idle": "2022-12-14T21:28:55.101145Z", "shell.execute_reply": "2022-12-14T21:28:55.100607Z" }, "id": "906e07f6e562" }, "outputs": [], "source": [ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", "#\n", "# https://www.apache.org/licenses/LICENSE-2.0\n", "#\n", "# Unless required by applicable law or agreed to in writing, software\n", "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", "# See the License for the specific language governing permissions and\n", "# limitations under the License." ] }, { "cell_type": "markdown", "metadata": { "id": "6e083398b477" }, "source": [ "# 前処理レイヤーを使用する" ] }, { "cell_type": "markdown", "metadata": { "id": "64010bd23c2e" }, "source": [ "
![]() | \n",
" ![]() | \n",
" ![]() | \n",
" ![]() | \n",
"
TextVectorization
レイヤーが動作する方法を確認できます。\n",
"\n",
"このようなモデルをトレーニングする場合、最高のパフォーマンスを得るには、入力パイプラインの一部として`TextVectorization`レイヤーを使用する必要があることに注意してください(上記のテキスト分類の例で示すように)。"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "28c2f2ff61fb"
},
"source": [
"### マルチホットエンコーディングを使用した ngram の密な行列としてのテキストのエンコーディング\n",
"\n",
"これは、`Dense`レイヤーに渡されるテキストを前処理する方法です。"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"execution": {
"iopub.execute_input": "2022-12-14T21:29:44.431336Z",
"iopub.status.busy": "2022-12-14T21:29:44.431092Z",
"iopub.status.idle": "2022-12-14T21:29:45.105159Z",
"shell.execute_reply": "2022-12-14T21:29:45.104474Z"
},
"id": "7bae1c223cd8"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:5 out of the last 1567 calls to