{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Pronunciation-based location prediction confusion\n", "\n", "Confusion of pronunciation-based predictions of someone's location" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pickle\n", "import folium\n", "import pandas\n", "import MySQLdb\n", "import numpy\n", "from sklearn.metrics import confusion_matrix\n", "from folium.plugins import HeatMap\n", "from IPython.display import display\n", "import itertools\n", "import requests\n", "import json\n", "import random\n", "from vincenty import vincenty\n", "\n", "db = MySQLdb.connect(user='root', passwd='Nmmxhjgt1@', db='stimmenfryslan')\n", "\n", "\n", "%matplotlib inline\n", "from matplotlib import pyplot, rcParams\n", "from jupyter_progressbar import ProgressBar\n", "\n", "# rcParams['font.family'] = 'Lucinda Console'\n", "rcParams['font.size'] = '24'\n", "rcParams['figure.figsize'] = (20, 10)\n", "rcParams['figure.dpi'] = 100\n", "\n", "from jupyter_progressbar import ProgressBar" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "with open('simplified_predictions.p3', 'rb') as f:\n", " simplified_predictions = pickle.load(f)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "simplified_predictions['actual_latlon_rounded'] = [\n", " (\n", " (x[0] // 0.1) * 0.1,\n", " (x[1] // 0.1) * 0.1,\n", " ) if x == x else numpy.nan\n", " for x in simplified_predictions['actual_latlon']\n", "]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "