{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Embeddings\n", "\n", "https://www.youtube.com/watch?v=wSXGlvTR9UM" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Using TensorFlow backend.\n" ] } ], "source": [ "import pandas as pd\n", "import numpy as np\n", "\n", "from keras.models import Sequential\n", "from keras.layers import Dense, Activation, Embedding, Merge, Flatten\n", "\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import StandardScaler\n", "\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Age | \n", "Education | \n", "H_education | \n", "num_child | \n", "Religion | \n", "Employ | \n", "H_occupation | \n", "living_standard | \n", "Media_exposure | \n", "contraceptive | \n", "
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "24 | \n", "2 | \n", "3 | \n", "3 | \n", "1 | \n", "1 | \n", "2 | \n", "3 | \n", "0 | \n", "1 | \n", "
| 1 | \n", "45 | \n", "1 | \n", "3 | \n", "10 | \n", "1 | \n", "1 | \n", "3 | \n", "4 | \n", "0 | \n", "1 | \n", "
| 2 | \n", "43 | \n", "2 | \n", "3 | \n", "7 | \n", "1 | \n", "1 | \n", "3 | \n", "4 | \n", "0 | \n", "1 | \n", "
| 3 | \n", "42 | \n", "3 | \n", "2 | \n", "9 | \n", "1 | \n", "1 | \n", "3 | \n", "3 | \n", "0 | \n", "1 | \n", "
| 4 | \n", "36 | \n", "3 | \n", "3 | \n", "8 | \n", "1 | \n", "1 | \n", "3 | \n", "2 | \n", "0 | \n", "1 | \n", "