Beispiel #1
0
def corr_analysis(data):
    col = list(data.columns)
    col.remove("CreationTime")
    col.remove( "InBandwidth")
    target_attribute = "InBandwidth"
    cor = []
    for i in col:
        corval = abs(st.pearsonr(data[target_attribute],data[i])[0])
        cor.append(corval)
    return cor
Beispiel #2
0
def print_corr(data):
    col = list(data.columns)
    col.remove("CreationTime")
    col.remove( "InBandwidth")
    target_attribute = "InBandwidth"
    cor = []
    print("\nCorrelation Coefficient of 'InBandwidth' with ")
    for i in col:
        corval = abs(st.pearsonr(data[target_attribute],data[i])[0])
        cor.append(corval)
        print(i," = ",corval)
Beispiel #3
0
def corr_column(df):
    col = list(df.columns)
    #col.remove("CreationTime")
    col.remove("InBandwidth")
    val = []
    for i in col:
        val.append(abs(st.pearsonr(df["InBandwidth"], df[i])[0]))
    x = sorted(val, reverse=True)
    col1 = col[val.index(x[0])]  #maximum correalatio coefficient
    col2 = col[val.index(x[1])]
    print(col1, col2)
    return col1, col2
Beispiel #4
0
def corr_analysis(data):
    col = list(data.columns)
    #col.remove("CreationTime")
    col.remove("InBandwidth")
    target_attribute = "InBandwidth"
    CORRs = []
    print(
        "\nCorrelation Coefficient of 'InBandwidth' with other attributes:\n")
    for i in col:
        cor = abs(st.pearsonr(data[target_attribute], data[i])[0])
        CORRs.append(cor)
        print(i, ": ", cor)
    return CORRs
Beispiel #5
0
def loss_corr(x1, x2, y1, y2, criterion, model, corr_lambda):
    loss1 = criterion(y1, x2)
    loss2 = criterion(y2, x1)
    corr_term = corr_lambda * stats.pearsonr(model.encoder1(x1),
                                             model.encoder2(x2))
    return loss1 + loss2 - corr_term