当前位置: 首页>>代码示例>>Python>>正文


Python FileSystem.loadCourseDatasetInfo方法代码示例

本文整理汇总了Python中FileSystem.FileSystem.loadCourseDatasetInfo方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.loadCourseDatasetInfo方法的具体用法?Python FileSystem.loadCourseDatasetInfo怎么用?Python FileSystem.loadCourseDatasetInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileSystem.FileSystem的用法示例。


在下文中一共展示了FileSystem.loadCourseDatasetInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runner

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
    def runner(self):
        logging.info('MakeForumViewLogs.runner(), ' + self.currCourseName)
        self.courseDatasetInfo = FileSystem.loadCourseDatasetInfo()
        try:
            if self.currCourseName not in self.courseDatasetInfo \
                or self.courseDatasetInfo[self.currCourseName] is None:
                print(self.currCourseName + ' has no activity log.  Exiting...')
                sys.exit()

            print('Working on: ' + self.currCourseName + ' (' + self.progress() +')')
            activityLogFileZipped = self.getActivityLogFile()
            activityLogFileUnzipped = activityLogFileZipped[:-3]
            
            outputDir = os.path.join(FileSystem.getDataDir(), 'ActivityLogsCoursera')
            outputPath = os.path.join(outputDir, self.currCourseName + '.viewlog')

            if os.path.exists(outputPath):
                logging.info('Output file already exists: ' + outputPath)
                sys.exit()
            if os.path.exists(activityLogFileZipped):
                self.unzip(activityLogFileZipped)
            if not os.path.exists(activityLogFileUnzipped):
                logging.info('Error finding file ' + activityLogFileUnzipped)
                sys.exit()
            views = self.getViews(activityLogFileUnzipped)
            self.writeViews(views,outputPath)
            self.zip(activityLogFileUnzipped)

        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
开发者ID:jinpa,项目名称:MOOC-data,代码行数:36,代码来源:MakeForumViewLogs.py

示例2: run

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
def run(projectName):
    courseDatasets = FileSystem.loadCourseDatasetInfo()
    resultsDir = os.path.join(FileSystem.getResultsDir(),projectName)

    medianDiffs = []
    meanDiffs = []
    for course in courseDatasets:
        path = os.path.join(resultsDir, course.name + '_contribution.csv')
        try:
            with open(path) as fid:
                forumUserIds = [r.strip() for r in fid.readlines()]
        except IOError:
            continue

        topUserIds = getTopFivePercent(forumUserIds)
        DBSetup.switch(course)

        threads = ForumThreads.objects.all()
        posts = ForumPosts.objects.all()
        TC, nonTC = isolateThreadLengths(threads, posts,topUserIds)
        TCMedian = median(TC)
        nonTCMedian = median(nonTC)
        TCMean = mean(TC)
        nonTCMean = mean(nonTC)
        medianDiffs.append(TCMedian-nonTCMedian)
        meanDiffs.append(TCMean-nonTCMean)
        print(course.name)
        print('Median thread length for threads with posts by top contributors: ' + str(TCMedian))
        print('Median thread length for threads without posts by top contributors: ' + str(nonTCMedian))
        print('Mean thread length for threads with posts by top contributors: ' + str(TCMean))
        print('Mean thread length for threads without posts by top contributors: ' + str(nonTCMean))
        print(' ')

    print('Average difference between median thread lengths: ' + str(mean(medianDiffs)))
    print('Average difference between mean thread lengths: ' + str(mean(meanDiffs)))
开发者ID:jinpa,项目名称:MOOC-data,代码行数:37,代码来源:TopContributorThreadResponses2.py

示例3: run

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
def run(projectName):
    boundDataDir = os.path.join(FileSystem.getResultsDir(),projectName)
    boundDataPath = os.path.join(boundDataDir,'results.csv')
    outputPath = os.path.join(boundDataDir,'fullCourseList.csv')

    courseData = FileSystem.loadCourseDatasetInfo()
    boundData = loadBoundData(boundDataPath)
    writeData(outputPath, courseData, boundData)
开发者ID:jinpa,项目名称:MOOC-data,代码行数:10,代码来源:RegenCourseList.py

示例4: __init__

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
 def __init__(self, projectName, params):
     self.projectName = projectName
     FileSystem.startLogger(self.projectName, "log")
     self.courseDatasets = FileSystem.loadCourseDatasetInfo()
     self.numCourses = len(self.courseDatasets)
     self.dataDir = FileSystem.createDataDir(self.projectName)
     self.resultsDir = FileSystem.createResultsDir(self.projectName)
     self.workingDir = FileSystem.createWorkingDir(self.projectName)
     self.executable = sys.argv[0]
     self.params = params
开发者ID:jinpa,项目名称:MOOC-data,代码行数:12,代码来源:Controller.py

示例5: run

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
def run(projectName):
    courseDatasets = FileSystem.loadCourseDatasetInfo()
    resultsDir = os.path.join(FileSystem.getResultsDir(),projectName)
    outputPath = os.path.join(resultsDir,'topContributorPositions.txt')

    cumulativeResultsTC = {}
    cumulativeResultsNonTC = {}
    cumulativeContHistTC = NUMBINS*[0]
    cumulativeContHistNonTC = NUMBINS*[0]
    ofid = open(outputPath,'wt')
    for course in courseDatasets:
        print(course.name)
        path = os.path.join(resultsDir, course.name + '_contribution.csv')
        try:
            with open(path) as fid:
                forumUserIds = [r.strip() for r in fid.readlines()]
        except IOError:
            continue

        topUserIds = getTopFivePercent(forumUserIds)
        DBSetup.switch(course)
        forumData = CourseForums()

        resultsTC, resultsNonTC, continuousHistTC, continuousHistNonTC = tallyPositions(forumData, topUserIds)
        cumulativeResultsTC = addResultsDict(cumulativeResultsTC, resultsTC)
        cumulativeResultsNonTC = addResultsDict(cumulativeResultsNonTC, resultsNonTC)
        cumulativeContHistTC = addResultsList(cumulativeContHistTC, continuousHistTC)
        cumulativeContHistNonTC = addResultsList(cumulativeContHistNonTC, continuousHistNonTC)
        ofid.write('--------------------------------------------\n')
        ofid.write('Course: ' + course.name + '\n')
        ofid.write('Top contributor post position histogram\n')
        summarization(ofid, resultsTC, 10)
        ofid.write('\n\n')
        ofid.write('Non top contributor post position histogram\n')
        summarization(ofid, resultsNonTC, 10)

    ofid.write('**************************************\n')
    ofid.write('Aggregated over courses:\n')
    ofid.write('Top contributor post position histogram\n')
    summarization(ofid, cumulativeResultsTC, 20)
    ofid.write('\n\n')
    ofid.write('Non top contributor post position histogram\n')
    summarization(ofid, cumulativeResultsNonTC, 20)
    ofid.close()

    normalizedCumulativeContHistTC = normalize(cumulativeContHistTC)
    normalizedCumulativeContHistNonTC = normalize(cumulativeContHistNonTC)
    outputPathTC = os.path.join(resultsDir,'normalizedPositionHistTC.csv')
    with open(outputPathTC,'wt') as ofid:
        for i in range(NUMBINS):
            ofid.write(str(i) + ', ' + str(normalizedCumulativeContHistTC[i]) + '\n')
    outputPathNonTC = os.path.join(resultsDir,'normalizedPositionHistNonTC.csv')
    with open(outputPathNonTC,'wt') as ofid:
        for i in range(NUMBINS):
            ofid.write(str(i) + ', ' + str(normalizedCumulativeContHistNonTC[i]) + '\n')
开发者ID:jinpa,项目名称:MOOC-data,代码行数:57,代码来源:TopContributorPositions.py

示例6: run

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
def run(projectName):
    courseDatasets = FileSystem.loadCourseDatasetInfo()
    resultsDir = os.path.join(FileSystem.getResultsDir(),projectName)
    outputPath = os.path.join(resultsDir,'topContributorPositions.txt')

    numTopContributors = 0
    numContributors = 0
    for course in courseDatasets:
        print(course.name)
        path = os.path.join(resultsDir, course.name + '_contribution.csv')
        try:
            with open(path) as fid:
                forumUserIds = [r.strip() for r in fid.readlines()]
        except IOError:
            continue

        topUserIds = getTopFivePercent(forumUserIds)
        numTopContributors += len(topUserIds)
        numContributors += len(forumUserIds)

    print('Number of Top Contributors: ' + str(numTopContributors))
    print('Number of contributors: ' + str(numContributors))
开发者ID:jinpa,项目名称:MOOC-data,代码行数:24,代码来源:TopContributorCounts.py

示例7: setup

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
 def setup(self, projectName):
     self.resultsDir = FileSystem.createResultsDir(projectName)
     self.courseDatasets = FileSystem.loadCourseDatasetInfo()
开发者ID:jinpa,项目名称:MOOC-data,代码行数:5,代码来源:ForumTypes.py

示例8: print

# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import loadCourseDatasetInfo [as 别名]
# author = Jonathan Huang



import sys
import os.path
sys.path.append('../util')
from FileSystem import FileSystem
sys.path.append(FileSystem.getRootDir())
sys.path.append(FileSystem.getSiteDir())
from  DBSetup import DBSetup
from lyticssite.forumModels.models import *
from lyticssite.generalModels.models import *
from lyticssite.eventModels.models import *

courseDatasetInfo = FileSystem.loadCourseDatasetInfo()

for course in courseDatasetInfo:
    print(course.name)

    DBSetup.switch(course)
 
    #print('\t-----------------')
    #forums = ForumForums.objects.all()
    try:
        userCount = Users.objects.count()
        print('\tUser Count: ' + str(userCount))
    except:
        pass
    try:
        surveyCount = Demographic.objects.count()
开发者ID:jinpa,项目名称:MOOC-data,代码行数:33,代码来源:testDB.py


注:本文中的FileSystem.FileSystem.loadCourseDatasetInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。