Exemple #1
0
def aggregate(repeaters, ext):
	cohorts = []
	for i in range(17):
		cohorts.append(Cohort())

	for key in repeaters.get_keys():
		student = repeaters.get(key)
		cohorts[student.get_num_semesters()-1].add(student.userid, student)


	viewed = [np.mean([student.get_ever('viewed') for student in cohorts[i].dic.values()]) for i in range(len(cohorts))]
	explored = [np.mean([student.get_ever('explored') for student in cohorts[i].dic.values()]) for i in range(len(cohorts))]
	completed = [np.mean([student.get_ever('completed') for student in cohorts[i].dic.values()]) for i in range(len(cohorts))]
	num_days = [cohorts[i].get_average('active_days') for i in range(len(cohorts))]
	num_days = [days if days != None else 0 for days in num_days]

	print(len(cohorts[4].dic))
	percentages_graph(viewed, explored, completed, 'any_semester' + ext + '.png')
	num_events_graph(num_days, 'average number of days active', ext + 'days.png')
Exemple #2
0
def engagement_by_grade(course):
    cohorts = []
    for i in range(10):
        cohorts.append(Cohort())

    for entry in course.get_all_entries():
        grade = entry.get_grade()
        if grade == None or grade == 0:
            continue

        # take care of perfect scores
        if grade == 1.0:
            cohorts[9].add_entry(entry)
        else:
            cohorts[int(grade * 10 % 10)].add_entry(entry)

    for i in range(len(cohorts)):
        print("cohort", i, ":", cohorts[i].get_average('overall_grade'))
        print(cohorts[i].get_average('active_days'), "active days")
        print(cohorts[i].get_average('problem_checks'), "problem checks")
        print(cohorts[i].get_average('videos'), "videos")
        print(cohorts[i].get_average('forum'), "forum")
        print(len(cohorts[i].dic.keys()))

    # write info to CSV for visualization
    filename = "./visualization/data/" + course.ext + "/engagement_by_grade.csv"
    with open(filename, mode='w') as file:
        writer = csv.writer(file,
                            delimiter=',',
                            quotechar='"',
                            quoting=csv.QUOTE_MINIMAL)
        writer.writerow(
            ["Bin", "ActiveDays", "ProblemChecks", "Videos", "Forum"])
        for i, cohort in zip(range(len(cohorts)), cohorts):
            grade_bin = str(
                i * 10) + "-" + str(i * 10 + 9 if i < 9 else 100) + "%"
            writer.writerow([
                grade_bin,
                cohort.get_average("active_days"),
                cohort.get_average('problem_checks'),
                cohort.get_average("videos"),
                cohort.get_average('forum')
            ])
Exemple #3
0
from classes import Cohort, Instructor, Student, Exercise

# Create instances of exercises
list_exercise = Exercise("Lists", "Python")
multiple_inheritance_exercise = Exercise("Multiple Inheritance", "Python")
interface_exercise = Exercise("Interfaces", "C#")
dictionaries_exercise = Exercise("Dictionaries", "Python")
function_currying = Exercise("Function Currying", "Javascript")
classes_exercise = Exercise("Classes", "Python")

#Create instances of cohorts
cohort_37 = Cohort("Cohort 37")
cohort_38 = Cohort("Cohort 38")
cohort_39 = Cohort("Cohort 39")

#Create Instances of instructors
instructor_andy = Instructor("Andy", "Collins", "*****@*****.**", cohort_38,
                             "JavaScript")
instructor_jisie = Instructor("Jisie", "David", "*****@*****.**", cohort_38,
                              "Python")
instructor_steve = Instructor("Steve", "Brownlee", "*****@*****.**",
                              cohort_37, "JavaScript")

#Create instances of students
student_matt = Student("Matt", "Crook", "*****@*****.**", cohort_38)
student_mike = Student("Mike", "Pence", "*****@*****.**", cohort_38)
student_kub = Student("Kub", "Docker", "*****@*****.**", cohort_38)
student_sara = Student("Sara", "Vue", "*****@*****.**", cohort_37)
student_bruce = Student("Bruce", "Brown", "*****@*****.**", cohort_39)

# Have the instructors assign an exercise to a student
Exemple #4
0
def self_vs_instructor_repeater(repeaters, course):
    self_paced_run = course.self_paced_run
    index_of_self_paced = course.semester_names.index(self_paced_run)
    test_in = Cohort()
    test_out = Cohort()
    test = Cohort()
    control = Cohort()

    retook_dic = defaultdict(list)

    for userid in repeaters.get_keys():
        student = repeaters.get(userid)
        if repeaters.get_num_semesters(userid) >= 2:
            if student.is_in_semester(self_paced_run):
                # add to test_in
                entity = student.get(self_paced_run)
                new_student = Student(student.userid)
                new_student.add(self_paced_run, entity)
                test_in.add(userid, new_student)
                # add to test_out
                new_student = student.deep_copy()
                # print(new_student.get_keys())
                test.add(userid, new_student)
                new_student.delete(self_paced_run)
                test_out.add(userid, new_student)
            else:
                control.add(userid, student.deep_copy())

            for sem_name in student.get_keys():
                if course.is_first_or_last_semester(sem_name):
                    continue
                retook_dic[sem_name].append(
                    0 if sem_name ==
                    student.get_last_semester(course.semester_names) else 1)

    print()
    print('REPEATERS WHO DIDNT TAKE SELF-PACED:')
    print('completion % overall: ', control.get_completion_rate())
    print('average grade overall: ', control.get_average('overall', True))
    print('average grade overall: ', control.get_average('overall_1', True))
    print('ever completed:', control.get_ever_completed_rate())

    print()
    print('REPEATERS IN SELF-PACED DURING SELF-PACED SEM:')
    print('completion % overall: ', test_in.get_completion_rate())
    print('average grade overall: ', test_in.get_average('overall', True))
    print('average grade overall: ', test_in.get_average('overall_1', True))
    print('ever completed:', test_in.get_ever_completed_rate())

    print()
    print('REPEATERS IN SELF-PACED DURING INSTRUCTOR-LED SEM:')
    print('completion % overall: ', test_out.get_completion_rate())
    print('average grade overall: ', test_out.get_average('overall', True))
    print('average grade overall: ', test_out.get_average('overall_1', True))
    print('ever completed:', test_out.get_ever_completed_rate())

    print()
    print('RETAKING COURSE')
    ls = []
    for key in retook_dic:
        if key == self_paced_run:
            print("self paced", statistics.mean(retook_dic[key]))
        else:
            ls.append(statistics.mean(retook_dic[key]))
    print("instructor ", statistics.mean(ls))

    x = [0, 1, 2, 4, 5]
    x_labels = [
        'ever', 'self\n\n\nGroup A', 'instuctor', 'ever', '\n\n\nGroup B',
        'instuctor'
    ]
    y = [
        test.get_ever_completed_rate(),
        test_in.get_completion_rate(),
        test_out.get_completion_rate(),
        control.get_ever_completed_rate(),
        control.get_completion_rate()
    ]
    plt.bar(x, y, align='center')
    plt.ylabel('% of learners who complete', fontsize=12)
    plt.xticks([0, 1, 2, 4, 4.5, 5], x_labels, fontsize=12)
    plt.savefig("anything" + ("1x" if course.is_1x else "2x") + ".png",
                bbox_inches='tight')
    plt.clf()
Exemple #5
0
def dual_course(course_1x, course_2x):
    both_1x = Cohort()
    both_2x = Cohort()
    both = Cohort()
    only_1x = Cohort()
    only_2x = Cohort()

    learners_1x = course_1x.get_all_userids()
    learners_2x = course_2x.get_all_userids()
    for entry in course_1x.get_all_entries():
        if entry.userid in learners_2x:
            both.add_entry(entry)
            both_1x.add_entry(entry)
        else:
            only_1x.add_entry(entry)
    for entry in course_2x.get_all_entries():
        if entry.userid in learners_1x:
            both.add_entry(entry)
            both_2x.add_entry(entry)
        else:
            only_2x.add_entry(entry)

    print('completion rate:')
    print("both", both.get_completion_rate())
    print("both_1x", both_1x.get_completion_rate())
    print("both_2x", both_2x.get_completion_rate())
    print("only_1x", only_1x.get_completion_rate())
    print("only_2x", only_2x.get_completion_rate())

    print('\never complete rate:')
    print("both", both.get_ever_completed_rate())
    print("both_1x", both_1x.get_ever_completed_rate())
    print("both_2x", both_2x.get_ever_completed_rate())
    print("only_1x", only_1x.get_ever_completed_rate())
    print("only_2x", only_2x.get_ever_completed_rate())

    print('\ngender:')
    print("both", both.get_average('gender'))
    print("both_1x", both_1x.get_average('gender'))
    print("both_2x", both_2x.get_average('gender'))
    print("only_1x", only_1x.get_average('gender'))
    print("only_2x", only_2x.get_average('gender'))

    print('\nactive days:')
    print("both", both.get_average('active_days'))
    print("both_1x", both_1x.get_average('active_days'))
    print("both_2x", both_2x.get_average('active_days'))
    print("only_1x", only_1x.get_average('active_days'))
    print("only_2x", only_2x.get_average('active_days'))

    print('\ngrade:')
    print("both", both.get_average('overall', True))
    print("both_1x", both_1x.get_average('overall', True))
    print("both_2x", both_2x.get_average('overall', True))
    print("only_1x", only_1x.get_average('overall', True))
    print("only_2x", only_2x.get_average('overall', True))

    print('\npercent')
    print('percent of 1x users who took 2x',
          len(both.get_all_userids()) / len(course_1x.get_all_userids()))
    print('percent of 2x users who took 1x',
          len(both.get_all_userids()) / len(course_2x.get_all_userids()))
Exemple #6
0
def certified(course_1x, course_2x):
    cert = Cohort()
    not_cert = Cohort()

    all_entries = []
    if course_1x != None:
        all_entries.extend(course_1x.get_all_entries())
        print(
            '1x verified total: ',
            course_1x.get_average('verified', False, True),
            course_1x.get_num_registered() *
            course_1x.get_average('verified', False, True))

    if course_2x != None:
        all_entries.extend(course_2x.get_all_entries())
        print(
            '2x verified total: ',
            course_2x.get_average('verified', False, True),
            course_2x.get_num_registered() *
            course_2x.get_average('verified', False, True))

    ls = []
    ls2 = []
    for entry in all_entries:
        if entry.mode == "verified":
            cert.add_entry(entry)
            ls.append(0 if entry.viewed else 1)
        else:
            not_cert.add_entry(entry)
            ls2.append(0 if entry.viewed else 1)

    print('completion among certified:', cert.get_average('completed'))
    print('grade among certified:',
          cert.get_average('overall_grade', complete=True))
    print('completion among not certified:', not_cert.get_average('completed'))
    print('grade among not certified:',
          not_cert.get_average('overall_grade', complete=True))

    ext = ""
    if course_1x != None and course_2x == None:
        ext = "1x/"
    elif course_1x == None and course_2x != None:
        ext = "2x/"
    filename = "./visualization/data/" + ext + "certified.csv"
    with open(filename, mode='w') as file:
        writer = csv.writer(file,
                            delimiter=',',
                            quotechar='"',
                            quoting=csv.QUOTE_MINIMAL)
        writer.writerow(["Verified", "NonVerified"])
        writer.writerow([
            cert.get_average('overall_grade', complete=True) * 100,
            not_cert.get_average('overall_grade', complete=True) * 100
        ])
        writer.writerow([
            cert.get_average('active_days'),
            not_cert.get_average('active_days')
        ])
        writer.writerow(
            [cert.get_average('videos'),
             not_cert.get_average('videos')])
        writer.writerow(
            [cert.get_average('forum'),
             not_cert.get_average('forum')])

    cert1 = Cohort()
    cert2 = Cohort()
    for entry in all_entries:
        if entry.userid in cert.get_keys(
        ) and entry.userid in not_cert.get_keys():
            if entry.mode == 'verified':
                cert1.add_entry(entry)
            else:
                cert2.add_entry(entry)

    print('completion among certified1:',
          cert1.get_average('completed', complete=False, overall=True))
    print('completion among certified2:',
          cert2.get_average('completed', complete=False, overall=True))
Exemple #7
0
def make_repeaters(course):
    repeaters = Cohort()
    for entry in course.get_all_entries():
        repeaters.add_entry(entry)
    return repeaters