Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ef04cbf
Co-authored-by: evbruk <evbruk@users.noreply.github.com>
Feb 22, 2022
043cf26
bargraph updates each time im middle of other changes
Feb 23, 2022
bc6571f
Co-authored-by: evbruk <evbruk@users.noreply.github.com>
Feb 24, 2022
a94d46f
Co-authored-by: Jasper Meggitt <jmeggitt@users.noreply.github.com>
Feb 24, 2022
d886cfd
All graph types working as intended
Feb 25, 2022
cf9b544
Co-authored-by: evbruk <evbruk@users.noreply.github.com>
Feb 25, 2022
c695be7
closetodone
Feb 25, 2022
4345767
color
Feb 25, 2022
8bba787
Final ghpush
Feb 25, 2022
493e1b2
console log deletion
Feb 25, 2022
b6f8fd9
Merge pull request #1 from jcybul/gh-pages
mchalmers Feb 25, 2022
c61da1d
Add HTTPS functionality
jmeggitt Feb 25, 2022
967540b
Merge branch 'https' of github.com:jcybul/a3-experiment into main
jmeggitt Feb 25, 2022
ce7a622
Add link to js
jmeggitt Feb 25, 2022
429c0f1
Add logging and fix minor bug in fetch
jmeggitt Feb 25, 2022
72a5baa
Add server time to log and data csv
jmeggitt Feb 25, 2022
62c536c
Remove debug text and errors from console
jmeggitt Feb 25, 2022
142ac29
Fix obvious grammar mistake
jmeggitt Feb 25, 2022
27d921b
Don't send results after finished; remove plot and answer box once fi…
jmeggitt Feb 25, 2022
1a53216
started script for data processing
jcybul Feb 27, 2022
36bde4f
Merge branch 'gh-pages' of https://github.com/jcybul/a3-experiment in…
jcybul Feb 27, 2022
f26f715
Revert "Merge branch 'gh-pages' of https://github.com/jcybul/a3-exper…
jcybul Feb 27, 2022
443acac
add r script
jcybul Mar 1, 2022
1f7768f
process data script
jcybul Mar 2, 2022
990d9cd
plot and data
jcybul Mar 2, 2022
7086ec0
Create confidence_intervals_box.png
jcybul Mar 2, 2022
643292d
new plots
jcybul Mar 2, 2022
d8090b6
Add files via upload
jcybul Mar 2, 2022
1703875
merge conflicts with main accepting all main changes
mchalmers Mar 2, 2022
78657fb
Update README.md
jcybul Mar 2, 2022
3974f0c
Merge branch 'main' into gh-pages
mchalmers Mar 2, 2022
0ddcddd
Add files via upload
jcybul Mar 2, 2022
e3cbabe
Update README.md
jcybul Mar 2, 2022
ebf3463
Update README.md
jcybul Mar 2, 2022
292021d
Update README.md
jcybul Mar 2, 2022
3ae75a7
Update README.md
jcybul Mar 2, 2022
2778529
Update README.md
jcybul Mar 2, 2022
8027c54
Update README.md
jcybul Mar 2, 2022
c53346f
Update README.md
jcybul Mar 2, 2022
53b81cb
Update README.md
jcybul Mar 2, 2022
16667c0
Update README.md
jcybul Mar 2, 2022
3278565
Update README.md
jcybul Mar 2, 2022
f59de89
Update README.md
jcybul Mar 2, 2022
95c8055
Update README.md
jcybul Mar 2, 2022
3a74a0c
Update README.md
jcybul Mar 2, 2022
b453a3e
merging gh-pages
mchalmers Mar 2, 2022
9b00746
Merge branch 'main' of https://github.com/jcybul/a3-experiment
mchalmers Mar 2, 2022
c467514
added thank you message screenshot
evbruk Mar 3, 2022
2a0f6f7
Update README.md
evbruk Mar 3, 2022
6e011c1
Update README.md
evbruk Mar 3, 2022
e453630
Results
mchalmers Mar 3, 2022
f964069
Update summary.R
jcybul Mar 3, 2022
4291820
Add to technical achievements
jmeggitt Mar 3, 2022
de9fd2b
Update README.md
evbruk Mar 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
package-lock.json
.idea/
*.iml
143 changes: 61 additions & 82 deletions README.md

Large diffs are not rendered by default.

Binary file added confidence_intervals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added confidence_intervals_box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,553 changes: 1,553 additions & 0 deletions data.csv

Large diffs are not rendered by default.

1,513 changes: 1,513 additions & 0 deletions error.csv

Large diffs are not rendered by default.

Binary file added img/ThankYouMsg.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/correcy_ans.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/p1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/p2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/p3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/p4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/p5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/p6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wrong_answer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions index.html

This file was deleted.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "a3-experiment",
"version": "1.0.0",
"description": "",
"author": "team-name",
"scripts": {
"start": "node src/server.js"
},
"dependencies": {
"body-parser": "^1.19.2",
"express": "^4.17.3",
"morgan": "^1.10.0",
"sanitize-filename": "^1.6.3"
}
}
214 changes: 214 additions & 0 deletions process_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from os import makedirs
import csv

def filter_uncompleted(data):
users = data[data['questionNumber'] == 62]['userId'].unique()
return data[data['userId'].isin(users)]

def err(data):
n = data.shape[0]
return (sum(data['error']) / n, 1.96 * np.std(data['error']) / np.sqrt(n))

def process():
# read csv file
data = pd.read_csv("data.csv")

# Filter out users that did not complete the entire survey
data = filter_uncompleted(data)

data['error'] = np.log(np.abs(data['correctAnswer'] - data['answer']) + 1/8) / np.log(2)


# for (user, graph), group in data.groupby(['userId', 'graphType']):
# error = sum(group['error']) / group.shape[0]
# print("On average user", user, "had an error of", error, "for the", graph, "graph")


user1 = data[data['userId'] % 2 == 1] #reported nothing
user2 = data[data['userId'] % 2 == 0] #reported correct answer

user1["type"] = user1["graphType"] +" Feedback"
user2["type"] = user2["graphType"] +" No Feedback"
print(user1)
headerList = ['type', 'error']
f = open('error.csv', 'w')
user1.to_csv("error.csv",header=True)
user2.to_csv("error.csv",mode='a' ,header=False)


return


# create the csv writer
# writer = csv.writer(f)
# writer.writerow(headerList)

# write a row to the csv file



print("Bar graph error for no reporting: ", err(user1[user1['graphType'] == "bar"]))
#writer.writerow(["bar no feedback ",err(user1[user1['graphType'] == "bar"])[0],err(user1[user1['graphType'] == "bar"])[1]])
print("Area graph error for no reporting: ", err(user1[user1['graphType'] == "area"]))
# writer.writerow(["area no feedback ",err(user1[user1['graphType'] == "area"])[0],err(user1[user1['graphType'] == "area"])[1]])
print("Bubble graph error for no reporting: ", err(user1[user1['graphType'] == "bubble"]))
# writer.writerow(["bubble no feedback ",err(user1[user1['graphType'] == "bubble"])[0],err(user1[user1['graphType'] == "bubble"])[1]])
print("Bar graph error with reporting: ", err(user2[user2['graphType'] == "bar"]))
# writer.writerow(["bar feedback ",err(user2[user2['graphType'] == "bar"])[0],err(user2[user2['graphType'] == "bar"])[1]])
print("Area graph error with reporting: ", err(user2[user2['graphType'] == "area"]))
# writer.writerow(["area feedback ",err(user2[user2['graphType'] == "area"])[0],err(user2[user2['graphType'] == "area"])[1]])
print("Bubble graph error with reporting: ", err(user2[user2['graphType'] == "bubble"]))
#writer.writerow(["bubble feedback ",err(user2[user2['graphType'] == "bubble"])[0],err(user2[user2['graphType'] == "bubble"])[1]])
# Bar graph error for no reporting: 1.126405463555971
# Area graph error for no reporting: 3.7655761530714513
# Bubble graph error for no reporting: 2.475787069045061
# Bar graph error with reporting: 1.6054321229135429
# Area graph error with reporting: 3.195102334026163
# Bubble graph error with reporting: 2.7329638540851517


# open the file in the write mode

# close the file
f.close()
# fig, axes = plt.subplot((3, 1))
makedirs("img/plots", exist_ok=True)
for idx, group in enumerate([user1, user2]):
for name, group_data in group.groupby("graphType"):
fig = plt.figure()
pd.plotting.bootstrap_plot(group_data["error"], fig=fig)
fig.savefig("img/plots/group1{}_{}.png".format(idx, name))

return

bars = user1[user1['graphType'] == 'bar']
totalbars1 = bars.shape[0]
print("The total answers for bars and user 1 is: ", totalbars1)

CorrectAnswers = bars[bars["correctAnswer"] == bars["answer"]]
correctbars1 = CorrectAnswers.shape[0]
print("The total correct answers for bars and user 1 is: ", correctbars1)
print("Percentage of correct answers: ", correctbars1/totalbars1)

bars2 = user2[user2['graphType'] == 'bar']
totalbars2 = bars2.shape[0]
print("The total answers for bars and user 2 is: ", totalbars2)

CorrectAnswers = bars2[bars2["correctAnswer"] == bars2["answer"]]
correctbars2 = CorrectAnswers.shape[0]
print("The total correct answers for bars and user 2 is: ", correctbars2)
print("Percentage of correct answers: ", correctbars2 / totalbars2)


bubble = user1[user1['graphType'] == 'bubble']
totalbubble1 = bubble.shape[0]
print("The total answers for bubble and user 1 is: ", totalbubble1)

CorrectAnswers = bubble[bubble["correctAnswer"] == bubble["answer"]]
correctbubble1 = CorrectAnswers.shape[0]
print("The total correct answers for bubble and user 1 is: ", correctbubble1)
print("Percentage of correct answers: ", correctbubble1 / totalbubble1)

bubble2 = user2[user2['graphType'] == 'bubble']
totalbubble2 = bars2.shape[0]
print("The total answers for bubble and user 2 is: ", totalbubble2)

CorrectAnswers = bubble2[bubble2["correctAnswer"] == bubble2["answer"]]
correctbubble2 = CorrectAnswers.shape[0]
print("The total correct answers for bubble and user 2 is: ", correctbubble2)
print("Percentage of correct answers: ", correctbubble2 / totalbubble2)

area = user1[user1['graphType'] == 'area']
totalarea1 = area.shape[0]
print("The total answers for area and user 1 is: ", totalarea1)

CorrectAnswers = area[area["correctAnswer"] == area["answer"]]
correctarea1 = CorrectAnswers.shape[0]
print("The total correct answers for area and user 1 is: ", correctarea1)
print("Percentage of correct answers: ", correctarea1 / totalarea1)

area2 = user2[user2['graphType'] == 'area']
totalarea2 = area2.shape[0]
print("The total answers for area and user 2 is: ", totalarea2)

CorrectAnswers = area[area["correctAnswer"] == area["answer"]]
correctarea2 = CorrectAnswers.shape[0]
print("The total correct answers for area and user 2 is: ", correctarea2)
print("Percentage of correct answers: ", correctarea2 / totalarea2)

# display DataFrame
# print(user1)
# print(user2)
# print(bars)
'''''''''
On average user 561548903 had an error of 2.3933574652824645 for the bubble graph
On average user 601668031 had an error of 4.131958339810913 for the area graph
On average user 601668031 had an error of 1.439130136412843 for the bar graph
On average user 601668031 had an error of 2.1882964938641565 for the bubble graph
On average user 626063024 had an error of 2.9944128261231375 for the area graph
On average user 626063024 had an error of 2.1421884087182685 for the bar graph
On average user 626063024 had an error of 3.866078710768898 for the bubble graph
On average user 637387854 had an error of 1.5624089205723748 for the area graph
On average user 637387854 had an error of -0.09165054115199282 for the bar graph
On average user 637387854 had an error of 2.8628346334493884 for the bubble graph
On average user 669187621 had an error of 4.620647361848339 for the area graph
On average user 669187621 had an error of 1.6120196666672848 for the bar graph
On average user 669187621 had an error of 2.557243924228237 for the bubble graph
On average user 697610459 had an error of 3.560756884813734 for the area graph
On average user 697610459 had an error of 0.1503577238626806 for the bar graph
On average user 697610459 had an error of 2.632301768745571 for the bubble graph
On average user 717162914 had an error of 2.304460793731465 for the area graph
On average user 717162914 had an error of 0.7552288577016684 for the bar graph
On average user 717162914 had an error of 0.6436338484892892 for the bubble graph
On average user 746865556 had an error of 3.5120246963614634 for the area graph
On average user 746865556 had an error of 1.050792903459094 for the bar graph
On average user 746865556 had an error of 2.6949560456702186 for the bubble graph
On average user 793347286 had an error of 4.102990360972003 for the area graph
On average user 793347286 had an error of 4.475647427976571 for the bar graph
On average user 793347286 had an error of 3.600001713543286 for the bubble graph
On average user 907089079 had an error of 3.6871049453273885 for the area graph
On average user 907089079 had an error of 0.6627072269018752 for the bar graph
On average user 907089079 had an error of 2.5832489947460817 for the bubble graph
On average user 946303072 had an error of 3.9019006956624156 for the area graph
On average user 946303072 had an error of 1.305871351343024 for the bar graph
On average user 946303072 had an error of 2.242367589987284 for the bubble graph
On average user 970368162 had an error of 4.113119485995787 for the area graph
On average user 970368162 had an error of 2.282507262415779 for the bar graph
On average user 970368162 had an error of 4.095972958342351 for the bubble graph
On average user 988855526 had an error of 3.8603658776003775 for the area graph
On average user 988855526 had an error of 1.8001287237939505 for the bar graph
On average user 988855526 had an error of 2.8001715978209467 for the bubble graph
Bar graph error for no reporting: (1.126405463555971, 0.264317618469363)
Area graph error for no reporting: (3.7655761530714513, 0.2844122047875867)
Bubble graph error for no reporting: (2.475787069045061, 0.24999594824548915)
Bar graph error with reporting: (1.6054321229135429, 0.2901310352413627)
Area graph error with reporting: (3.195102334026163, 0.2957386671466518)
Bubble graph error with reporting: (2.7329638540851517, 0.2727774280040578)
The total answers for bars and user 1 is: 252
The total correct answers for bars and user 1 is: 39
Percentage of correct answers: 0.15476190476190477
The total answers for bars and user 2 is: 252
The total correct answers for bars and user 2 is: 34
Percentage of correct answers: 0.1349206349206349
The total answers for bubble and user 1 is: 252
The total correct answers for bubble and user 1 is: 20
Percentage of correct answers: 0.07936507936507936
The total answers for bubble and user 2 is: 252
The total correct answers for bubble and user 2 is: 21
Percentage of correct answers: 0.08333333333333333
The total answers for area and user 1 is: 252
The total correct answers for area and user 1 is: 15
Percentage of correct answers: 0.05952380952380952
The total answers for area and user 2 is: 252
The total correct answers for area and user 2 is: 15
Percentage of correct answers: 0.05952380952380952
'''''''''

if __name__ == '__main__':
process()


''''''''''''
5 changes: 5 additions & 0 deletions public/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body {
font-family: Arial, Helvetica, sans-serif;
text-align: center;
background-color: rgb(192, 247, 247);
}
25 changes: 25 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
<link href="index.css" rel="stylesheet" >
</head>
<body>
<h1> Data Visualization Experiment </h1>

<h3>What percentage is the smaller of the larger?</h3>

<svg id="graphContainer" width=300 height=300 ></svg>

<br/>
<script type='text/javascript' src='index.js'></script>

<form action="" onkeydown="return fixFormEnter(event);">
<input type='number' id='answer' placeholder="%">
<button type="button" id="submit">Enter</button>
<p id='location'>0/60</p>
<br/>
<p id='feedback'> </p>
</form>
</body>
</html>
Loading