Created
August 10, 2021 21:48
-
-
Save MikeTrizna/942d71d68c0e7c58b35f495d9ea32cd3 to your computer and use it in GitHub Desktop.
Intro to AI and ML survey results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:57.257454Z", | |
| "end_time": "2021-08-10T21:47:58.988467Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "import pandas as pd\nimport altair as alt", | |
| "execution_count": 1, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:58.990772Z", | |
| "end_time": "2021-08-10T21:47:59.038656Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "questions = ['diff', 'data_types','bias','mit','deploy']\ncolumns = [str(i) for i in range(9)] + questions + ['_']\n\npre_df = pd.read_csv('July 2021 Smithsonian Intro to AI Workshop Pilot Pre-Workshop Survey(1-43).txt',\n sep='\\t', names=columns, usecols=questions, header=0)\npre_df.head()", | |
| "execution_count": 2, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 2, | |
| "data": { | |
| "text/plain": " diff data_types \\\n0 Agree Neither agree nor disagree \n1 Neither agree nor disagree Neither agree nor disagree \n2 Disagree Disagree \n3 Neither agree nor disagree Neither agree nor disagree \n4 Disagree Neither agree nor disagree \n\n bias mit \\\n0 Strongly agree Neither agree nor disagree \n1 Neither agree nor disagree Neither agree nor disagree \n2 Disagree Disagree \n3 Agree Disagree \n4 Agree Disagree \n\n deploy \n0 Agree \n1 Neither agree nor disagree \n2 Disagree \n3 Agree \n4 Disagree ", | |
| "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>diff</th>\n <th>data_types</th>\n <th>bias</th>\n <th>mit</th>\n <th>deploy</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Agree</td>\n <td>Neither agree nor disagree</td>\n <td>Strongly agree</td>\n <td>Neither agree nor disagree</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Neither agree nor disagree</td>\n <td>Neither agree nor disagree</td>\n <td>Neither agree nor disagree</td>\n <td>Neither agree nor disagree</td>\n <td>Neither agree nor disagree</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Disagree</td>\n <td>Disagree</td>\n <td>Disagree</td>\n <td>Disagree</td>\n <td>Disagree</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Neither agree nor disagree</td>\n <td>Neither agree nor disagree</td>\n <td>Agree</td>\n <td>Disagree</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Disagree</td>\n <td>Neither agree nor disagree</td>\n <td>Agree</td>\n <td>Disagree</td>\n <td>Disagree</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.041333Z", | |
| "end_time": "2021-08-10T21:47:59.058046Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "pre_melted = pre_df.melt(var_name='question', value_name='answer')\npre_melted.head()", | |
| "execution_count": 3, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 3, | |
| "data": { | |
| "text/plain": " question answer\n0 diff Agree\n1 diff Neither agree nor disagree\n2 diff Disagree\n3 diff Neither agree nor disagree\n4 diff Disagree", | |
| "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>question</th>\n <th>answer</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>diff</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>1</th>\n <td>diff</td>\n <td>Neither agree nor disagree</td>\n </tr>\n <tr>\n <th>2</th>\n <td>diff</td>\n <td>Disagree</td>\n </tr>\n <tr>\n <th>3</th>\n <td>diff</td>\n <td>Neither agree nor disagree</td>\n </tr>\n <tr>\n <th>4</th>\n <td>diff</td>\n <td>Disagree</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.061879Z", | |
| "end_time": "2021-08-10T21:47:59.085183Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "columns = [str(i) for i in range(5)] + questions + ['_'] + [str(i + 10) for i in range(6)]\n\npost_df = pd.read_csv('July 2021 Smithsonian Intro to AI Workshop Pilot Post-Workshop Survey(1-14).txt',\n sep='\\t', names=columns, usecols=questions, header=0)\npost_df.head()", | |
| "execution_count": 4, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 4, | |
| "data": { | |
| "text/plain": " diff data_types bias mit \\\n0 Neither agree nor disagree Agree Agree Agree \n1 Agree Agree Strongly agree Agree \n2 Agree Agree Strongly agree Agree \n3 Agree Disagree Agree Agree \n4 Agree Agree Agree Agree \n\n deploy \n0 Agree \n1 Agree \n2 Strongly agree \n3 Neither agree nor disagree \n4 Neither agree nor disagree ", | |
| "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>diff</th>\n <th>data_types</th>\n <th>bias</th>\n <th>mit</th>\n <th>deploy</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Neither agree nor disagree</td>\n <td>Agree</td>\n <td>Agree</td>\n <td>Agree</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Agree</td>\n <td>Agree</td>\n <td>Strongly agree</td>\n <td>Agree</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Agree</td>\n <td>Agree</td>\n <td>Strongly agree</td>\n <td>Agree</td>\n <td>Strongly agree</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Agree</td>\n <td>Disagree</td>\n <td>Agree</td>\n <td>Agree</td>\n <td>Neither agree nor disagree</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Agree</td>\n <td>Agree</td>\n <td>Agree</td>\n <td>Agree</td>\n <td>Neither agree nor disagree</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.089658Z", | |
| "end_time": "2021-08-10T21:47:59.107155Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "post_melted = post_df.melt(var_name='question', value_name='answer')\npost_melted.head()", | |
| "execution_count": 5, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 5, | |
| "data": { | |
| "text/plain": " question answer\n0 diff Neither agree nor disagree\n1 diff Agree\n2 diff Agree\n3 diff Agree\n4 diff Agree", | |
| "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>question</th>\n <th>answer</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>diff</td>\n <td>Neither agree nor disagree</td>\n </tr>\n <tr>\n <th>1</th>\n <td>diff</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>2</th>\n <td>diff</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>3</th>\n <td>diff</td>\n <td>Agree</td>\n </tr>\n <tr>\n <th>4</th>\n <td>diff</td>\n <td>Agree</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.111474Z", | |
| "end_time": "2021-08-10T21:47:59.154582Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "pre_melted['survey'] = 'pre'\npost_melted['survey'] = 'post'\n\nmelt_combined = pre_melted.append(post_melted)\nmelt_combined.info()", | |
| "execution_count": 6, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "text": "<class 'pandas.core.frame.DataFrame'>\nInt64Index: 285 entries, 0 to 69\nData columns (total 3 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 question 285 non-null object\n 1 answer 285 non-null object\n 2 survey 285 non-null object\ndtypes: object(3)\nmemory usage: 8.9+ KB\n", | |
| "name": "stdout" | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.158079Z", | |
| "end_time": "2021-08-10T21:47:59.198918Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "grouped = melt_combined.groupby(['question','survey','answer']).size().reset_index()\ngrouped.columns = ['question','survey','answer','count']\ngrouped.head(10)", | |
| "execution_count": 7, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 7, | |
| "data": { | |
| "text/plain": " question survey answer count\n0 bias post Agree 10\n1 bias post Strongly agree 4\n2 bias pre Agree 17\n3 bias pre Disagree 8\n4 bias pre Neither agree nor disagree 12\n5 bias pre Strongly Disagree 1\n6 bias pre Strongly agree 5\n7 data_types post Agree 13\n8 data_types post Disagree 1\n9 data_types pre Agree 8", | |
| "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>question</th>\n <th>survey</th>\n <th>answer</th>\n <th>count</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>bias</td>\n <td>post</td>\n <td>Agree</td>\n <td>10</td>\n </tr>\n <tr>\n <th>1</th>\n <td>bias</td>\n <td>post</td>\n <td>Strongly agree</td>\n <td>4</td>\n </tr>\n <tr>\n <th>2</th>\n <td>bias</td>\n <td>pre</td>\n <td>Agree</td>\n <td>17</td>\n </tr>\n <tr>\n <th>3</th>\n <td>bias</td>\n <td>pre</td>\n <td>Disagree</td>\n <td>8</td>\n </tr>\n <tr>\n <th>4</th>\n <td>bias</td>\n <td>pre</td>\n <td>Neither agree nor disagree</td>\n <td>12</td>\n </tr>\n <tr>\n <th>5</th>\n <td>bias</td>\n <td>pre</td>\n <td>Strongly Disagree</td>\n <td>1</td>\n </tr>\n <tr>\n <th>6</th>\n <td>bias</td>\n <td>pre</td>\n <td>Strongly agree</td>\n <td>5</td>\n </tr>\n <tr>\n <th>7</th>\n <td>data_types</td>\n <td>post</td>\n <td>Agree</td>\n <td>13</td>\n </tr>\n <tr>\n <th>8</th>\n <td>data_types</td>\n <td>post</td>\n <td>Disagree</td>\n <td>1</td>\n </tr>\n <tr>\n <th>9</th>\n <td>data_types</td>\n <td>pre</td>\n <td>Agree</td>\n <td>8</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.203646Z", | |
| "end_time": "2021-08-10T21:47:59.245609Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "grouped['answer'] = grouped['answer'].astype(\"category\")\n\nordered_answers = ['Strongly Disagree','Disagree','Neither agree nor disagree',\n 'Agree', 'Strongly agree']\ngrouped['answer'] = grouped['answer'].cat.set_categories(ordered_answers, \n ordered=True)\ngrouped = grouped.sort_values(['question','survey','answer'],\n ascending=[True, False, True])\ngrouped.head(10)", | |
| "execution_count": 8, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 8, | |
| "data": { | |
| "text/plain": " question survey answer count\n5 bias pre Strongly Disagree 1\n3 bias pre Disagree 8\n4 bias pre Neither agree nor disagree 12\n2 bias pre Agree 17\n6 bias pre Strongly agree 5\n0 bias post Agree 10\n1 bias post Strongly agree 4\n12 data_types pre Strongly Disagree 9\n10 data_types pre Disagree 13\n11 data_types pre Neither agree nor disagree 12", | |
| "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>question</th>\n <th>survey</th>\n <th>answer</th>\n <th>count</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>5</th>\n <td>bias</td>\n <td>pre</td>\n <td>Strongly Disagree</td>\n <td>1</td>\n </tr>\n <tr>\n <th>3</th>\n <td>bias</td>\n <td>pre</td>\n <td>Disagree</td>\n <td>8</td>\n </tr>\n <tr>\n <th>4</th>\n <td>bias</td>\n <td>pre</td>\n <td>Neither agree nor disagree</td>\n <td>12</td>\n </tr>\n <tr>\n <th>2</th>\n <td>bias</td>\n <td>pre</td>\n <td>Agree</td>\n <td>17</td>\n </tr>\n <tr>\n <th>6</th>\n <td>bias</td>\n <td>pre</td>\n <td>Strongly agree</td>\n <td>5</td>\n </tr>\n <tr>\n <th>0</th>\n <td>bias</td>\n <td>post</td>\n <td>Agree</td>\n <td>10</td>\n </tr>\n <tr>\n <th>1</th>\n <td>bias</td>\n <td>post</td>\n <td>Strongly agree</td>\n <td>4</td>\n </tr>\n <tr>\n <th>12</th>\n <td>data_types</td>\n <td>pre</td>\n <td>Strongly Disagree</td>\n <td>9</td>\n </tr>\n <tr>\n <th>10</th>\n <td>data_types</td>\n <td>pre</td>\n <td>Disagree</td>\n <td>13</td>\n </tr>\n <tr>\n <th>11</th>\n <td>data_types</td>\n <td>pre</td>\n <td>Neither agree nor disagree</td>\n <td>12</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.250426Z", | |
| "end_time": "2021-08-10T21:47:59.267714Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "def compute_start_end(all_df, q):\n pre_post_rows = []\n for p in ['pre','post']:\n q_df = all_df[(all_df['question'] == q) & (all_df['survey'] == p)].copy()\n q_df['percentage'] = ((q_df['count'] / q_df['count'].sum()) * 100).round(1)\n neg_answers = ['Strongly Disagree','Disagree']\n start = -q_df[q_df['answer'].isin(neg_answers)]['percentage'].sum() - \\\n (q_df[q_df['answer'] == 'Neither agree nor disagree']['percentage'].sum()) / 2\n pq_rows = q_df.to_dict(orient='records')\n for row in pq_rows:\n row['start'] = start\n row['end'] = start + row['percentage']\n pre_post_rows.append(row)\n start += row['percentage']\n pre_post_df = pd.DataFrame(pre_post_rows)\n pre_post_df['start'] = pre_post_df['start'].round(1)\n pre_post_df['end'] = pre_post_df['end'].round(1)\n return pre_post_df", | |
| "execution_count": 9, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.273059Z", | |
| "end_time": "2021-08-10T21:47:59.284154Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "def pre_post_chart(pre_post_df, title):\n color_scale = alt.Scale(\n domain=[\n \"Strongly Disagree\",\n \"Disagree\",\n \"Neither agree nor disagree\",\n \"Agree\",\n \"Strongly agree\"\n ],\n range=[\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]\n )\n\n chart = alt.Chart(pre_post_df, title=title).mark_bar().encode(\n x=alt.X('start:Q',\n title='Percentage of Respondents',\n scale=alt.Scale(domain=(-100, 100))),\n x2=alt.X2('end:Q'),\n y=alt.Y('survey:N',\n sort=['pre','post'],\n title='Survey'),\n color=alt.Color(\n 'answer:N',\n legend=alt.Legend( title='Response'),\n scale=color_scale,\n )\n )\n return chart", | |
| "execution_count": 10, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2021-08-10T21:47:59.288088Z", | |
| "end_time": "2021-08-10T21:47:59.718805Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "question_key = {'diff':[\"I have a good understanding of the differences between\",\n \"AI, Machine Learning, and Deep Learning.\"],\n 'data_types':[\"I can recognize the different data types\",\n \"that work well with machine learning.\"],\n 'bias':[\"I have a good sense for how\",\n \"human bias can enter a machine learning project.\"],\n 'mit':[\"I know strategies for\",\n \"mitigating bias in a machine learning project.\"],\n 'deploy':[\"I know about the most common ways that\",\n \"machine learning models are deployed to production.\"]}\n\nfor q_code, question in question_key.items():\n pre_post_df = compute_start_end(grouped, q_code)\n chart = pre_post_chart(pre_post_df, question)\n chart.display()\n ", | |
| "execution_count": 11, | |
| "outputs": [ | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/html": "\n<div id=\"altair-viz-b520d9631b1e4c72942c61ccb741d984\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n let outputDiv = document.currentScript.previousElementSibling;\n if (outputDiv.id !== \"altair-viz-b520d9631b1e4c72942c61ccb741d984\") {\n outputDiv = document.getElementById(\"altair-viz-b520d9631b1e4c72942c61ccb741d984\");\n }\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-7bf6f498fa5c313acd21047e468337ee\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"answer\", \"legend\": {\"title\": \"Response\"}, \"scale\": {\"domain\": [\"Strongly Disagree\", \"Disagree\", \"Neither agree nor disagree\", \"Agree\", \"Strongly agree\"], \"range\": [\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"start\", \"scale\": {\"domain\": [-100, 100]}, \"title\": \"Percentage of Respondents\"}, \"x2\": {\"field\": \"end\"}, \"y\": {\"type\": \"nominal\", \"field\": \"survey\", \"sort\": [\"pre\", \"post\"], \"title\": \"Survey\"}}, \"title\": [\"I have a good understanding of the differences between\", \"AI, Machine Learning, and Deep Learning.\"], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-7bf6f498fa5c313acd21047e468337ee\": [{\"question\": \"diff\", \"survey\": \"pre\", \"answer\": \"Strongly Disagree\", \"count\": 4, \"percentage\": 9.3, \"start\": -70.9, \"end\": -61.6}, {\"question\": \"diff\", \"survey\": \"pre\", \"answer\": \"Disagree\", \"count\": 21, \"percentage\": 48.8, \"start\": -61.6, \"end\": -12.8}, {\"question\": \"diff\", \"survey\": \"pre\", \"answer\": \"Neither agree nor disagree\", \"count\": 11, \"percentage\": 25.6, \"start\": -12.8, \"end\": 12.8}, {\"question\": \"diff\", \"survey\": \"pre\", \"answer\": \"Agree\", \"count\": 7, \"percentage\": 16.3, \"start\": 12.8, \"end\": 29.1}, {\"question\": \"diff\", \"survey\": \"post\", \"answer\": \"Strongly Disagree\", \"count\": 1, \"percentage\": 7.1, \"start\": -10.6, \"end\": -3.5}, {\"question\": \"diff\", \"survey\": \"post\", \"answer\": \"Neither agree nor disagree\", \"count\": 1, \"percentage\": 7.1, \"start\": -3.5, \"end\": 3.6}, {\"question\": \"diff\", \"survey\": \"post\", \"answer\": \"Agree\", \"count\": 10, \"percentage\": 71.4, \"start\": 3.6, \"end\": 75.0}, {\"question\": \"diff\", \"survey\": \"post\", \"answer\": \"Strongly agree\", \"count\": 2, \"percentage\": 14.3, \"start\": 75.0, \"end\": 89.2}]}}, {\"mode\": \"vega-lite\"});\n</script>", | |
| "text/plain": "alt.Chart(...)" | |
| }, | |
| "metadata": {} | |
| }, | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/html": "\n<div id=\"altair-viz-9a7f24bdcf624363808841e266c6b44a\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n let outputDiv = document.currentScript.previousElementSibling;\n if (outputDiv.id !== \"altair-viz-9a7f24bdcf624363808841e266c6b44a\") {\n outputDiv = document.getElementById(\"altair-viz-9a7f24bdcf624363808841e266c6b44a\");\n }\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-c43db088d287d272a7c296388c7f6101\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"answer\", \"legend\": {\"title\": \"Response\"}, \"scale\": {\"domain\": [\"Strongly Disagree\", \"Disagree\", \"Neither agree nor disagree\", \"Agree\", \"Strongly agree\"], \"range\": [\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"start\", \"scale\": {\"domain\": [-100, 100]}, \"title\": \"Percentage of Respondents\"}, \"x2\": {\"field\": \"end\"}, \"y\": {\"type\": \"nominal\", \"field\": \"survey\", \"sort\": [\"pre\", \"post\"], \"title\": \"Survey\"}}, \"title\": [\"I can recognize the different data types\", \"that work well with machine learning.\"], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-c43db088d287d272a7c296388c7f6101\": [{\"question\": \"data_types\", \"survey\": \"pre\", \"answer\": \"Strongly Disagree\", \"count\": 9, \"percentage\": 20.9, \"start\": -65.0, \"end\": -44.2}, {\"question\": \"data_types\", \"survey\": \"pre\", \"answer\": \"Disagree\", \"count\": 13, \"percentage\": 30.2, \"start\": -44.2, \"end\": -14.0}, {\"question\": \"data_types\", \"survey\": \"pre\", \"answer\": \"Neither agree nor disagree\", \"count\": 12, \"percentage\": 27.9, \"start\": -14.0, \"end\": 14.0}, {\"question\": \"data_types\", \"survey\": \"pre\", \"answer\": \"Agree\", \"count\": 8, \"percentage\": 18.6, \"start\": 14.0, \"end\": 32.6}, {\"question\": \"data_types\", \"survey\": \"pre\", \"answer\": \"Strongly agree\", \"count\": 1, \"percentage\": 2.3, \"start\": 32.6, \"end\": 34.8}, {\"question\": \"data_types\", \"survey\": \"post\", \"answer\": \"Disagree\", \"count\": 1, \"percentage\": 7.1, \"start\": -7.1, \"end\": 0.0}, {\"question\": \"data_types\", \"survey\": \"post\", \"answer\": \"Agree\", \"count\": 13, \"percentage\": 92.9, \"start\": 0.0, \"end\": 92.9}]}}, {\"mode\": \"vega-lite\"});\n</script>", | |
| "text/plain": "alt.Chart(...)" | |
| }, | |
| "metadata": {} | |
| }, | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/html": "\n<div id=\"altair-viz-f590cd69a7ab487c9d944dc6179d78e8\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n let outputDiv = document.currentScript.previousElementSibling;\n if (outputDiv.id !== \"altair-viz-f590cd69a7ab487c9d944dc6179d78e8\") {\n outputDiv = document.getElementById(\"altair-viz-f590cd69a7ab487c9d944dc6179d78e8\");\n }\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-51f63ef1725d9261e8c9d3e83e4b5009\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"answer\", \"legend\": {\"title\": \"Response\"}, \"scale\": {\"domain\": [\"Strongly Disagree\", \"Disagree\", \"Neither agree nor disagree\", \"Agree\", \"Strongly agree\"], \"range\": [\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"start\", \"scale\": {\"domain\": [-100, 100]}, \"title\": \"Percentage of Respondents\"}, \"x2\": {\"field\": \"end\"}, \"y\": {\"type\": \"nominal\", \"field\": \"survey\", \"sort\": [\"pre\", \"post\"], \"title\": \"Survey\"}}, \"title\": [\"I have a good sense for how\", \"human bias can enter a machine learning project.\"], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-51f63ef1725d9261e8c9d3e83e4b5009\": [{\"question\": \"bias\", \"survey\": \"pre\", \"answer\": \"Strongly Disagree\", \"count\": 1, \"percentage\": 2.3, \"start\": -34.8, \"end\": -32.6}, {\"question\": \"bias\", \"survey\": \"pre\", \"answer\": \"Disagree\", \"count\": 8, \"percentage\": 18.6, \"start\": -32.6, \"end\": -14.0}, {\"question\": \"bias\", \"survey\": \"pre\", \"answer\": \"Neither agree nor disagree\", \"count\": 12, \"percentage\": 27.9, \"start\": -14.0, \"end\": 13.9}, {\"question\": \"bias\", \"survey\": \"pre\", \"answer\": \"Agree\", \"count\": 17, \"percentage\": 39.5, \"start\": 13.9, \"end\": 53.4}, {\"question\": \"bias\", \"survey\": \"pre\", \"answer\": \"Strongly agree\", \"count\": 5, \"percentage\": 11.6, \"start\": 53.4, \"end\": 65.0}, {\"question\": \"bias\", \"survey\": \"post\", \"answer\": \"Agree\", \"count\": 10, \"percentage\": 71.4, \"start\": -0.0, \"end\": 71.4}, {\"question\": \"bias\", \"survey\": \"post\", \"answer\": \"Strongly agree\", \"count\": 4, \"percentage\": 28.6, \"start\": 71.4, \"end\": 100.0}]}}, {\"mode\": \"vega-lite\"});\n</script>", | |
| "text/plain": "alt.Chart(...)" | |
| }, | |
| "metadata": {} | |
| }, | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/html": "\n<div id=\"altair-viz-4d2db112fea14f168f42dcff2893792b\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n let outputDiv = document.currentScript.previousElementSibling;\n if (outputDiv.id !== \"altair-viz-4d2db112fea14f168f42dcff2893792b\") {\n outputDiv = document.getElementById(\"altair-viz-4d2db112fea14f168f42dcff2893792b\");\n }\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-913e121d5c5df18dee0700af5d71b462\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"answer\", \"legend\": {\"title\": \"Response\"}, \"scale\": {\"domain\": [\"Strongly Disagree\", \"Disagree\", \"Neither agree nor disagree\", \"Agree\", \"Strongly agree\"], \"range\": [\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"start\", \"scale\": {\"domain\": [-100, 100]}, \"title\": \"Percentage of Respondents\"}, \"x2\": {\"field\": \"end\"}, \"y\": {\"type\": \"nominal\", \"field\": \"survey\", \"sort\": [\"pre\", \"post\"], \"title\": \"Survey\"}}, \"title\": [\"I know strategies for\", \"mitigating bias in a machine learning project.\"], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-913e121d5c5df18dee0700af5d71b462\": [{\"question\": \"mit\", \"survey\": \"pre\", \"answer\": \"Strongly Disagree\", \"count\": 11, \"percentage\": 25.6, \"start\": -88.4, \"end\": -62.8}, {\"question\": \"mit\", \"survey\": \"pre\", \"answer\": \"Disagree\", \"count\": 23, \"percentage\": 53.5, \"start\": -62.8, \"end\": -9.3}, {\"question\": \"mit\", \"survey\": \"pre\", \"answer\": \"Neither agree nor disagree\", \"count\": 8, \"percentage\": 18.6, \"start\": -9.3, \"end\": 9.3}, {\"question\": \"mit\", \"survey\": \"pre\", \"answer\": \"Agree\", \"count\": 1, \"percentage\": 2.3, \"start\": 9.3, \"end\": 11.6}, {\"question\": \"mit\", \"survey\": \"post\", \"answer\": \"Neither agree nor disagree\", \"count\": 4, \"percentage\": 28.6, \"start\": -14.3, \"end\": 14.3}, {\"question\": \"mit\", \"survey\": \"post\", \"answer\": \"Agree\", \"count\": 8, \"percentage\": 57.1, \"start\": 14.3, \"end\": 71.4}, {\"question\": \"mit\", \"survey\": \"post\", \"answer\": \"Strongly agree\", \"count\": 2, \"percentage\": 14.3, \"start\": 71.4, \"end\": 85.7}]}}, {\"mode\": \"vega-lite\"});\n</script>", | |
| "text/plain": "alt.Chart(...)" | |
| }, | |
| "metadata": {} | |
| }, | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/html": "\n<div id=\"altair-viz-69aeed723f9a463baf49e9f2b850a33f\"></div>\n<script type=\"text/javascript\">\n (function(spec, embedOpt){\n let outputDiv = document.currentScript.previousElementSibling;\n if (outputDiv.id !== \"altair-viz-69aeed723f9a463baf49e9f2b850a33f\") {\n outputDiv = document.getElementById(\"altair-viz-69aeed723f9a463baf49e9f2b850a33f\");\n }\n const paths = {\n \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n };\n\n function loadScript(lib) {\n return new Promise(function(resolve, reject) {\n var s = document.createElement('script');\n s.src = paths[lib];\n s.async = true;\n s.onload = () => resolve(paths[lib]);\n s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n });\n }\n\n function showError(err) {\n outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n throw err;\n }\n\n function displayChart(vegaEmbed) {\n vegaEmbed(outputDiv, spec, embedOpt)\n .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n }\n\n if(typeof define === \"function\" && define.amd) {\n requirejs.config({paths});\n require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n } else if (typeof vegaEmbed === \"function\") {\n displayChart(vegaEmbed);\n } else {\n loadScript(\"vega\")\n .then(() => loadScript(\"vega-lite\"))\n .then(() => loadScript(\"vega-embed\"))\n .catch(showError)\n .then(() => displayChart(vegaEmbed));\n }\n })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-b3c29977b05e94e79820c8d0bc42618d\"}, \"mark\": \"bar\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"answer\", \"legend\": {\"title\": \"Response\"}, \"scale\": {\"domain\": [\"Strongly Disagree\", \"Disagree\", \"Neither agree nor disagree\", \"Agree\", \"Strongly agree\"], \"range\": [\"#c30d24\", \"#f3a583\", \"#cccccc\", \"#94c6da\", \"#1770ab\"]}}, \"x\": {\"type\": \"quantitative\", \"field\": \"start\", \"scale\": {\"domain\": [-100, 100]}, \"title\": \"Percentage of Respondents\"}, \"x2\": {\"field\": \"end\"}, \"y\": {\"type\": \"nominal\", \"field\": \"survey\", \"sort\": [\"pre\", \"post\"], \"title\": \"Survey\"}}, \"title\": [\"I know about the most common ways that\", \"machine learning models are deployed to production.\"], \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-b3c29977b05e94e79820c8d0bc42618d\": [{\"question\": \"deploy\", \"survey\": \"pre\", \"answer\": \"Strongly Disagree\", \"count\": 13, \"percentage\": 30.2, \"start\": -87.2, \"end\": -57.0}, {\"question\": \"deploy\", \"survey\": \"pre\", \"answer\": \"Disagree\", \"count\": 22, \"percentage\": 51.2, \"start\": -57.0, \"end\": -5.8}, {\"question\": \"deploy\", \"survey\": \"pre\", \"answer\": \"Neither agree nor disagree\", \"count\": 5, \"percentage\": 11.6, \"start\": -5.8, \"end\": 5.8}, {\"question\": \"deploy\", \"survey\": \"pre\", \"answer\": \"Agree\", \"count\": 3, \"percentage\": 7.0, \"start\": 5.8, \"end\": 12.8}, {\"question\": \"deploy\", \"survey\": \"post\", \"answer\": \"Neither agree nor disagree\", \"count\": 4, \"percentage\": 28.6, \"start\": -14.3, \"end\": 14.3}, {\"question\": \"deploy\", \"survey\": \"post\", \"answer\": \"Agree\", \"count\": 8, \"percentage\": 57.1, \"start\": 14.3, \"end\": 71.4}, {\"question\": \"deploy\", \"survey\": \"post\", \"answer\": \"Strongly agree\", \"count\": 2, \"percentage\": 14.3, \"start\": 71.4, \"end\": 85.7}]}}, {\"mode\": \"vega-lite\"});\n</script>", | |
| "text/plain": "alt.Chart(...)" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "", | |
| "execution_count": null, | |
| "outputs": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "name": "python3", | |
| "display_name": "Python 3 (ipykernel)", | |
| "language": "python" | |
| }, | |
| "language_info": { | |
| "name": "python", | |
| "version": "3.9.6", | |
| "mimetype": "text/x-python", | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "pygments_lexer": "ipython3", | |
| "nbconvert_exporter": "python", | |
| "file_extension": ".py" | |
| }, | |
| "gist": { | |
| "id": "", | |
| "data": { | |
| "description": "Intro to AI and ML survey results", | |
| "public": true | |
| } | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 4 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment