[pd.Grouper(key='user'), pd.Grouper(key='task')]).count()['correct'] cummulativeResult = practiceResultSum.reset_index().groupby( [pd.Grouper(key='user')]).sum() # cummulativeResult = practiceResultSum.groupby([pd.Grouper(key='user')]).sum() cummulativeResult['cumm_practice'] = cummulativeResult[ 'correct'] / practiceResult.groupby([pd.Grouper(key='user') ]).count()['date'] cummulativeResult['successPassedRate'] = cummulativeResult['passed'] / ( cummulativeResult['passed'] + cummulativeResult['failed']) # cummulativeResult = graphLearning.mapNewLabel(cummulativeResult, reLabelIndex) cummulativeExerciseWeeks.append(cummulativeResult) assessment_label = assessment.copy() assessment_label = graphLearning.mapNewLabel(assessment, reLabelIndex) assessment_label1A = assessment1A.copy() assessment_label1A = graphLearning.mapNewLabel(assessment1A, reLabelIndex) assessment_label2A = assessment2A.copy() assessment_label2A = graphLearning.mapNewLabel(assessment2A, reLabelIndex) #activity data matrix construction with newPAgeTYpe workingWeekLog = [] activityDataMatrixWeeks_pageType = [] for w in range(0, 12): print('Week ' + str(w) + '...') workingWeekLog.append(weeksEventLog_filtered_pageType[w]) LogPageactivityCountByUser = pd.concat( workingWeekLog) #weeksEventLog_filtered[w] LogPageactivityCountByUser = FCAMiner.activityDataMatrixContruct(
elif w in [4,5,6,7]: studentList = assessment2A.index.astype(str) else: studentList = assessment3A.index.astype(str) temp = temp.loc[temp.index.isin(studentList)] # temp = graphLearning.mapNewLabel(temp, reLabelIndex) # temp = temp.drop(['Practice_0-Practice_0'],axis=1) # if w == 1: # temp = temp.drop([8]) transitionDataMatrixWeeks.append(temp) for w in range(0,10): transitionDataMatrixWeeks[w].index = transitionDataMatrixWeeks[w].index + ['-2020'] for w in range(0,10): transitionDataMatrixWeeks[w] = graphLearning.mapNewLabel(transitionDataMatrixWeeks[w], reLabelIndex) transitionDataMatrixWeeks_directFollow_standardised = [] for w in range(0,10): transitionDataMatrixWeeks_directFollow_standardised.append(dataProcessing.normaliseData(transitionDataMatrixWeeks[w].T)) transitionDataMatrixWeeks_directFollow_normalised = [] for w in range(0,10): transitionDataMatrixWeeks_directFollow_normalised.append(dataProcessing.normaliseData(transitionDataMatrixWeeks[w].T, 'normalised')) # correlation processing corrList = [] corrDistanceList = [] for w in range(0,10): corrTemp = transitionDataMatrixWeeks_directFollow_standardised[w].corr() corrList.append(corrTemp)
# ca1162018_transitionDataMatrixWeeks[w]['covid'] = 0 # ca1162019_transitionDataMatrixWeeks[w]['covid'] = 0 # ca1162020_transitionDataMatrixWeeks[w]['covid'] = 1 transitionDataMatrixWeeks.append( pd.concat([ ca1162018_transitionDataMatrixWeeks[w], ca1162019_transitionDataMatrixWeeks[w], ca1162020_transitionDataMatrixWeeks[w] ], join='inner')) listIndex = listIndex + list(transitionDataMatrixWeeks[w].index) listIndex = list(set(listIndex)) reLabelIndex = dataProcessing.reLabelStudentId(listIndex) for w in range(0, 10): ca1162018_transitionDataMatrixWeeks[w] = graphLearning.mapNewLabel( ca1162018_transitionDataMatrixWeeks[w], reLabelIndex) ca1162019_transitionDataMatrixWeeks[w] = graphLearning.mapNewLabel( ca1162019_transitionDataMatrixWeeks[w], reLabelIndex) ca1162020_transitionDataMatrixWeeks[w] = graphLearning.mapNewLabel( ca1162020_transitionDataMatrixWeeks[w], reLabelIndex) transitionDataMatrixWeeks[w] = graphLearning.mapNewLabel( transitionDataMatrixWeeks[w], reLabelIndex) transitionDataMatrixWeeks_directFollow_standardised = [] for w in range(0, 10): transitionDataMatrixWeeks_directFollow_standardised.append( dataProcessing.normaliseData(transitionDataMatrixWeeks[w].T)) ca1162018_activityDataMatrixWeeks_pageTypeWeek = [] ca1162019_activityDataMatrixWeeks_pageTypeWeek = [] ca1162020_activityDataMatrixWeeks_pageTypeWeek = []
workingWeekExcercise = [] cummulativeExerciseWeeks = [] for week in range(0,12): workingWeekExcercise.append(nonExUploadByWeek[week]) practiceResult = pd.concat(workingWeekExcercise) #nonExUploadByWeek[week] #adjust number of correct: For each task, number of correct submission/number of submission for that task practiceResultSum = practiceResult.groupby([pd.Grouper(key='user'),pd.Grouper(key='task')]).sum() practiceResultSum['correct_adjusted'] = practiceResultSum['correct']/practiceResult.groupby([pd.Grouper(key='user'),pd.Grouper(key='task')]).count()['correct'] cummulativeResult = practiceResultSum.reset_index().groupby([pd.Grouper(key='user')]).sum() # cummulativeResult = practiceResultSum.groupby([pd.Grouper(key='user')]).sum() cummulativeResult['cumm_practice'] = cummulativeResult['correct']/practiceResult.groupby([pd.Grouper(key='user')]).count()['date'] cummulativeResult['successPassedRate'] = cummulativeResult['passed']/(cummulativeResult['passed'] + cummulativeResult['failed']) cummulativeResult = graphLearning.mapNewLabel(cummulativeResult, reLabelIndex) cummulativeExerciseWeeks.append(cummulativeResult) a = cummulativeExerciseWeeks[11].corr() transitionDataMatrixWeeks = [] for w in range(0,12): temp = pd.read_csv('transitionMatrixStorage_new/transitionDataMatrixWeeks_distance_accumulated_w' + str(w) + '.csv', index_col=0) if w in [0,1,2,3]: studentList = assessment1A.index elif w in [4,5,6,7]: studentList = assessment2A.index else: studentList = assessment3A.index temp = temp.loc[temp.index.isin(studentList)]
[pd.Grouper(key='user'), pd.Grouper(key='task')]).count()['correct'] cummulativeResult = practiceResultSum.reset_index().groupby( [pd.Grouper(key='user')]).sum() # cummulativeResult = practiceResultSum.groupby([pd.Grouper(key='user')]).sum() cummulativeResult['cumm_practice'] = cummulativeResult[ 'correct'] / practiceResult.groupby([pd.Grouper(key='user') ]).count()['date'] cummulativeResult['successPassedRate'] = cummulativeResult['passed'] / ( cummulativeResult['passed'] + cummulativeResult['failed']) # cummulativeResult = graphLearning.mapNewLabel(cummulativeResult, reLabelIndex) cummulativeExerciseWeeks.append(cummulativeResult) for w in range(0, 12): cummulativeExerciseWeeks[w] = graphLearning.mapNewLabel( cummulativeExerciseWeeks[w], reLabelIndex) assessment_label = assessment.copy() assessment_label = graphLearning.mapNewLabel(assessment, reLabelIndex) assessment_label1A = assessment1A.copy() assessment_label1A = graphLearning.mapNewLabel(assessment1A, reLabelIndex) assessment_label2A = assessment2A.copy() assessment_label2A = graphLearning.mapNewLabel(assessment2A, reLabelIndex) assessment_label3A = assessment3A.copy() assessment_label3A = graphLearning.mapNewLabel(assessment3A, reLabelIndex) #read csv iff neeeded transitionDataMatrixWeeks = [] for w in range(0, 12): temp = pd.read_csv(