{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Multi-layer perceptron name generator" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Data preprocessing\n", "\n", "First, let's import our dependencies:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/ritsuko/.local/lib/python3.10/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "import torch\n", "import torch.nn as nn\n", "import torch.nn.functional as F\n", "import pandas as pd\n", "import numpy as np" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Now we import our dataset:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | name | \n", "gender | \n", "count | \n", "
---|---|---|---|
0 | \n", "Emily | \n", "F | \n", "26539 | \n", "
1 | \n", "Hannah | \n", "F | \n", "21677 | \n", "
2 | \n", "Alexis | \n", "F | \n", "19234 | \n", "
3 | \n", "Sarah | \n", "F | \n", "19112 | \n", "
4 | \n", "Samantha | \n", "F | \n", "19040 | \n", "
\n", " | name | \n", "gender | \n", "count | \n", "
---|---|---|---|
0 | \n", "emily | \n", "F | \n", "26539 | \n", "
1 | \n", "hannah | \n", "F | \n", "21677 | \n", "
2 | \n", "alexis | \n", "F | \n", "19234 | \n", "
3 | \n", "sarah | \n", "F | \n", "19112 | \n", "
4 | \n", "samantha | \n", "F | \n", "19040 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "
16939 | \n", "zohal | \n", "F | \n", "5 | \n", "
16940 | \n", "zophia | \n", "F | \n", "5 | \n", "
16941 | \n", "zuha | \n", "F | \n", "5 | \n", "
16942 | \n", "zuhal | \n", "F | \n", "5 | \n", "
16943 | \n", "zuzu | \n", "F | \n", "5 | \n", "
16944 rows × 3 columns
\n", "\n", " | name | \n", "gender | \n", "count | \n", "pairs | \n", "
---|---|---|---|---|
0 | \n", "emily | \n", "F | \n", "26539 | \n", "(e, ...) | \n", "
0 | \n", "emily | \n", "F | \n", "26539 | \n", "(m, ..e) | \n", "
0 | \n", "emily | \n", "F | \n", "26539 | \n", "(i, .em) | \n", "
0 | \n", "emily | \n", "F | \n", "26539 | \n", "(l, emi) | \n", "
0 | \n", "emily | \n", "F | \n", "26539 | \n", "(y, mil) | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
16943 | \n", "zuzu | \n", "F | \n", "5 | \n", "(z, ...) | \n", "
16943 | \n", "zuzu | \n", "F | \n", "5 | \n", "(u, ..z) | \n", "
16943 | \n", "zuzu | \n", "F | \n", "5 | \n", "(z, .zu) | \n", "
16943 | \n", "zuzu | \n", "F | \n", "5 | \n", "(u, zuz) | \n", "
16943 | \n", "zuzu | \n", "F | \n", "5 | \n", "(., uzu) | \n", "
124361 rows × 4 columns
\n", "\n", " | label | \n", "triple | \n", "
---|---|---|
0 | \n", "e | \n", "... | \n", "
1 | \n", "m | \n", "..e | \n", "
2 | \n", "i | \n", ".em | \n", "
3 | \n", "l | \n", "emi | \n", "
4 | \n", "y | \n", "mil | \n", "
... | \n", "... | \n", "... | \n", "
124356 | \n", "z | \n", "... | \n", "
124357 | \n", "u | \n", "..z | \n", "
124358 | \n", "z | \n", ".zu | \n", "
124359 | \n", "u | \n", "zuz | \n", "
124360 | \n", ". | \n", "uzu | \n", "
124361 rows × 2 columns
\n", "