Example #1
0
        index_col=0)
    if w in [0, 1, 2, 3, 4, 5]:
        studentList = assessment1A.index
    elif w in [6, 7, 8, 9, 10, 11]:
        studentList = assessment2A.index
    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)

transitionDataMatrixWeeks_directFollow_standardised = []
for w in range(0, 12):
    transitionDataMatrixWeeks_directFollow_standardised.append(
        dataProcessing.normaliseData(transitionDataMatrixWeeks[w].T))

transitionDataMatrixWeeks_directFollow_normalised = []
for w in range(0, 12):
    transitionDataMatrixWeeks_directFollow_normalised.append(
        dataProcessing.normaliseData(transitionDataMatrixWeeks[w],
                                     'normalised'))

#transpose transition data matrix
for w in range(0, 12):
    transitionDataMatrixWeeks[w] = transitionDataMatrixWeeks[w].T
    transitionDataMatrixWeeks_directFollow_normalised[
        w] = transitionDataMatrixWeeks_directFollow_normalised[w].T
    transitionDataMatrixWeeks_directFollow_standardised[
        w] = transitionDataMatrixWeeks_directFollow_standardised[w].T
Example #2
0
# a = activityDataMatrixWeeks[11]
cmap = sns.cm.rocket_r

sns.heatmap(a.corr(), annot=True, center=0.8, yticklabels=True, xticklabels=True, cmap='coolwarm')
plt.title('Correlation matrix')
plt.show()


#transpose transition data matrix
for w in range(0,12):
    transitionDataMatrixWeeks[w] = transitionDataMatrixWeeks[w].T

transitionDataMatrixWeeks_directFollow_normalised = []    
for w in range(0,12):
    transitionDataMatrixWeeks_directFollow_normalised.append(dataProcessing.normaliseData(transitionDataMatrixWeeks[w]))


# correlation processing    
corrList = []
corrDistanceList = []
for w in range(0,12):
    corrTemp = transitionDataMatrixWeeks[w].corr()
    corrList.append(corrTemp)
    corrDistance = (0.5*(1 - corrTemp)).apply(np.sqrt)
    corrDistanceList.append(corrDistance)

# cmap = sns.cm.rocket_r

# sns.heatmap(corrList[3], annot=False, center=0.8, yticklabels=False, xticklabels=False, cmap='coolwarm')
# plt.title('Correlation heatmap week ' + '3')
Example #3
0
    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)
    corrDistance = (0.5*(1 - corrTemp)).apply(np.sqrt)
    corrDistanceList.append(corrDistance)
    
graph_all_weeks = []
Example #4
0
sns.heatmap(corrDistanceList[3],
            annot=False,
            center=0,
            yticklabels=False,
            xticklabels=False,
            cmap='coolwarm')
plt.title('Distance correlation heatmap week ' + '3')
plt.show()

#normalised data--------------------------------------------------------------
transitionDataMatrixWeeks_directFollow_normalised = []
for w in range(0, 12):
    temp = transitionDataMatrixWeeks_directFollow[w][:-1]
    transitionDataMatrixWeeks_directFollow_normalised.append(
        dataProcessing.normaliseData(temp))

#correlation processing
corrList_dataNormalised = []
corrDistanceList_dataNormalised = []
for w in range(0, 12):
    corrTemp = transitionDataMatrixWeeks_directFollow_normalised[w].corr()
    corrList_dataNormalised.append(corrTemp)
    corrDistance = (0.5 * (1 - corrTemp)).apply(np.sqrt)
    corrDistanceList_dataNormalised.append(corrDistance)

w = 11
matrix = corrList_dataNormalised[w]

# denoised_matrix = libRMT.denoisedCorr(matrix, transitionDataMatrixWeeks_directFollow_normalised[w].shape[0], transitionDataMatrixWeeks_directFollow_normalised[w].shape[1])