def basicStats(self, path):
     numRegistered = CourseStats.getNumRegisteredUsers()
     numContributors = CourseStats.getNumContributingUsers()
     numQuizSubmitters = CourseStats.getNumQuizSubmitters()
     with open(path, 'wt') as fid:
         fid.write('# registered users, ' + str(numRegistered) + '\n')
         fid.write('# forum contributors, ' + str(numContributors) + '\n')
         fid.write('# quiz submitters, ' + str(numQuizSubmitters) + '\n')
 def basicStats(self, path):
     numRegistered = CourseStats.getNumRegisteredUsers()
     numContributors = CourseStats.getNumContributingUsers()
     numQuizSubmitters = CourseStats.getNumQuizSubmitters()    
     with open(path, 'wt') as fid:
         fid.write('# registered users, ' + str(numRegistered) + '\n')
         fid.write('# forum contributors, ' + str(numContributors) + '\n')
         fid.write('# quiz submitters, ' + str(numQuizSubmitters) + '\n')
示例#3
0
    def runner(self):
        if not self.checkForDB():
            logging.info('Necessary database does not exist, bailing. (' \
                + self.getCourseName() + ')')
            sys.exit()

        self.loadData()

        firstResponseTimes = self.timeToFirstResponse().values()
        finiteFirstResponseTimes = [
            t for t in firstResponseTimes if t != float("inf")
        ]
        numOpenThreads = CourseStats.getNumThreads() - len(
            finiteFirstResponseTimes)
        ratioOpenThreads = float(numOpenThreads) / CourseStats.getNumThreads()
        betweenTimes = self.timeBetweenPosts()
        (postBoost, viewBoost, onThreadPostBoost,
         onThreadViewBoost) = self.avgInstructorBoost()

        path = os.path.join(self.getMainResultsDir(), 'results.csv')
        with open(path, 'at') as fid:
            fid.write(self.getCourseName() + ', ' \
                + str(len(self.activesByAnon)) + ', ' \
                + str(len(self.lectureActivesByAnon)) + ', ' \
                + str(self.contributionByActives()) + ', ' \
                + str(self.contributionByLectureActives()) + ', ' \
                #+ str(self.viewingByActives()) + ', ' \
                + str(self.subscriptionsByActives()) + ', ' \
                + str(self.subscriptionsByLectureActives()) + ', ' \
                + str(self.numThreadsPerActive()) + ', ' \
                + str(self.numThreadsPerLectureActive()) + ', ' \
                + str(self.numContributionsPerActive()) + ', ' \
                + str(self.numContributionsPerLectureActive()) + ', ' \
                + str(self.numViewsPerHourPerActive()) + ', ' \
                + str(self.numViewsPerHourPerLectureActive()) + ', ' \
                #+ str(self.viewContributionRatio()) + ', ' \
                + str(mean(finiteFirstResponseTimes)) + ', ' \
                + str(median(firstResponseTimes)) + ', ' \
                + str(mean(betweenTimes)) + ', ' \
                + str(median(betweenTimes)) + ', ' \
                + str(ratioOpenThreads) + ', ' \
                + str(self.avgPostLen()) + ', ' \
                + str(self.avgContributionsPerThread()) + ', ' \
                + str(self.numInstructorPosts()) + ', ' \
                + str(self.avgInstructorPostLen()) + ', ' \
                + str(postBoost) + ', ' \
                + str(viewBoost) + ', ' \
                + str(onThreadPostBoost) + ', ' \
                + str(onThreadViewBoost) + ', ' \
                + str(self.avgReputation()) + '\n')
示例#4
0
    def runner(self):
        logging.info('SubscriptionRatio.runner(), ' + self.currCourseName)

        try:
            print('Working on: ' + self.currCourseName + ' (' + self.progress() +')')
        
            self.anonForumIdMap = ModelHelper.getAnonForumIdMap()
            self.forumAnonIdMap = ModelHelper.getForumAnonIdMap()
            for k in range(100):
                percenters = CourseStats.getKPercenters(k)
                numPercenters = len(percenters)
                numSubscriptions = self.countSubscriptions(percenters)
                ratio = float(numSubscriptions)/ numPercenters
        
                path = os.path.join(self.resultsDir,'results' + str(k) + '.csv')
                with open(path,'at') as fid:
                    fid.write(self.currCourseName + ', ' \
                            + str(numSubscriptions) + ', ' \
                            + str(numPercenters) + ', ' \
                            + str(ratio) + '\n')
        except CourseDBError:
            logging.info('\t\t+ ERROR (Connection does not exist), skipping...')
            pass
        except NoGradesError:
            logging.info('\t\t+ ERROR (CourseGrades does not exist), skipping...')
            pass
示例#5
0
    def runner(self):
        if not self.checkForDB():
            logging.info('Necessary database does not exist, bailing. (' \
                + self.getCourseName() + ')')
            sys.exit()

        self.loadData()
        
        firstResponseTimes = self.timeToFirstResponse().values()
        finiteFirstResponseTimes = [t for t in firstResponseTimes if t != float("inf")]
        numOpenThreads = CourseStats.getNumThreads() - len(finiteFirstResponseTimes)
        ratioOpenThreads = float(numOpenThreads) / CourseStats.getNumThreads()
        betweenTimes = self.timeBetweenPosts()
        (postBoost, viewBoost, onThreadPostBoost, onThreadViewBoost) = self.avgInstructorBoost()

        path = os.path.join(self.getMainResultsDir(),'results.csv')
        with open(path,'at') as fid:
            fid.write(self.getCourseName() + ', ' \
                + str(len(self.activesByAnon)) + ', ' \
                + str(len(self.lectureActivesByAnon)) + ', ' \
                + str(self.contributionByActives()) + ', ' \
                + str(self.contributionByLectureActives()) + ', ' \
                #+ str(self.viewingByActives()) + ', ' \
                + str(self.subscriptionsByActives()) + ', ' \
                + str(self.subscriptionsByLectureActives()) + ', ' \
                + str(self.numThreadsPerActive()) + ', ' \
                + str(self.numThreadsPerLectureActive()) + ', ' \
                + str(self.numContributionsPerActive()) + ', ' \
                + str(self.numContributionsPerLectureActive()) + ', ' \
                + str(self.numViewsPerHourPerActive()) + ', ' \
                + str(self.numViewsPerHourPerLectureActive()) + ', ' \
                #+ str(self.viewContributionRatio()) + ', ' \
                + str(mean(finiteFirstResponseTimes)) + ', ' \
                + str(median(firstResponseTimes)) + ', ' \
                + str(mean(betweenTimes)) + ', ' \
                + str(median(betweenTimes)) + ', ' \
                + str(ratioOpenThreads) + ', ' \
                + str(self.avgPostLen()) + ', ' \
                + str(self.avgContributionsPerThread()) + ', ' \
                + str(self.numInstructorPosts()) + ', ' \
                + str(self.avgInstructorPostLen()) + ', ' \
                + str(postBoost) + ', ' \
                + str(viewBoost) + ', ' \
                + str(onThreadPostBoost) + ', ' \
                + str(onThreadViewBoost) + ', ' \
                + str(self.avgReputation()) + '\n')
示例#6
0
 def loadLectureActives(self):
     threshold = 5
     lectureActiveAnonId = CourseStats.getLectureViewers(threshold)
     self.lectureActivesByAnon = {}
     for id in lectureActiveAnonId:
         try:
             self.lectureActivesByAnon[id] = self.users.getByAnon(id)
         except KeyError:
             pass
示例#7
0
 def loadLectureActives(self):
     threshold = 5
     lectureActiveAnonId = CourseStats.getLectureViewers(threshold)
     self.lectureActivesByAnon = {}
     for id in lectureActiveAnonId:
         try:
             self.lectureActivesByAnon[id] = self.users.getByAnon(id)
         except KeyError:
             pass
示例#8
0
 def loadActives(self):
     # return a list of users who got > 5% of max final grade
     threshold = 5
     activeAnonId = CourseStats.getKPercenters(threshold)
     self.activesByAnon = {}
     for id in activeAnonId:
         try:
             self.activesByAnon[id] = self.users.getByAnon(id)
         except KeyError:
             pass
示例#9
0
 def numViewsPerHourPerLectureActive(self):
     if not self.viewsExists:
         return None
     numHours = 0.0
     numViews = 0.0
     day = 24*3600.0
     for interval in self.viewBounds['bounds']:
         numHours += (interval[1] + 2*day - interval[0])/3600.0
         numViews += CourseStats.getNumForumViewsInInterval([interval[0]-day,interval[1]+day])
     return (numViews/numHours) / float(len(self.lectureActivesByAnon))
示例#10
0
 def loadActives(self):
     # return a list of users who got > 5% of max final grade
     threshold = 5
     activeAnonId = CourseStats.getKPercenters(threshold)
     self.activesByAnon = {}
     for id in activeAnonId:
         try:
             self.activesByAnon[id] = self.users.getByAnon(id)
         except KeyError:
             pass
示例#11
0
 def numViewsPerHourPerLectureActive(self):
     if not self.viewsExists:
         return None
     numHours = 0.0
     numViews = 0.0
     day = 24*3600.0
     for interval in self.viewBounds['bounds']:
         numHours += (interval[1] + 2*day - interval[0])/3600.0
         numViews += CourseStats.getNumForumViewsInInterval([interval[0]-day,interval[1]+day])
     return (numViews/numHours) / float(len(self.lectureActivesByAnon))
示例#12
0
 def avgContributionsPerThread(self):
     return float(len(self.contributionsByUser)) / float(
         CourseStats.getNumThreads())
示例#13
0
 def viewContributionRatio(self):
     if not self.viewsExists:
         return None
     return float(CourseStats.getNumForumViews()) / float(
         CourseStats.getNumContributions())
示例#14
0
 def numContributionsPerLectureActive(self):
     return float(CourseStats.getNumContributions()) / float(
         len(self.lectureActivesByAnon))
示例#15
0
 def viewContributionRatio(self):
     if not self.viewsExists:
         return None
     return float(CourseStats.getNumForumViews())/float(CourseStats.getNumContributions())
示例#16
0
 def subscriptionsByActives(self):
     return float(CourseStats.getNumSubscriptions() \
         - CourseStats.getNumContributingUsers()) / float(len(self.activesByAnon))
示例#17
0
 def avgContributionsPerThread(self):
     return float(len(self.contributionsByUser))/float(CourseStats.getNumThreads())
示例#18
0
 def subscriptionsByActives(self):
     return float(CourseStats.getNumSubscriptions() \
         - CourseStats.getNumContributingUsers()) / float(len(self.activesByAnon))
示例#19
0
 def numContributionsPerLectureActive(self):
     return float(CourseStats.getNumContributions()) / float(len(self.lectureActivesByAnon))
示例#20
0
 def numThreadsPerLectureActive(self):
     return float(CourseStats.getNumThreads()) / float(len(self.lectureActivesByAnon))
示例#21
0
 def numThreadsPerLectureActive(self):
     return float(CourseStats.getNumThreads()) / float(
         len(self.lectureActivesByAnon))