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')
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')
def avgContributionsPerThread(self): return float(len(self.contributionsByUser)) / float( CourseStats.getNumThreads())
def numThreadsPerLectureActive(self): return float(CourseStats.getNumThreads()) / float( len(self.lectureActivesByAnon))
def avgContributionsPerThread(self): return float(len(self.contributionsByUser))/float(CourseStats.getNumThreads())
def numThreadsPerLectureActive(self): return float(CourseStats.getNumThreads()) / float(len(self.lectureActivesByAnon))