コード例 #1
0
            full_matrix = np.concatenate(
                [np.abs(corr_cls_coef), np.abs(corr_pln_coef)], axis=0)
            threshold = np.median(full_matrix[np.nonzero(full_matrix)]) + \
                np.std(full_matrix[np.nonzero(full_matrix)])

            data_cls_bin = np.abs(corr_cls_coef) > threshold
            data_pln_bin = np.abs(corr_pln_coef) > threshold

            deg_cls_tmp = np.asarray(
                [bct.degrees_und(g) for g in data_cls_bin])

            deg_pln_tmp = np.asarray(
                [bct.degrees_und(g) for g in data_pln_bin])

            trans_cls_tmp = np.asarray(
                [bct.transitivity_bu(g) for g in data_cls_bin])
            trans_pln_tmp = np.asarray(
                [bct.transitivity_bu(g) for g in data_pln_bin])

            cp_cls_tmp = np.asarray(
                [bct.distance.charpath(g)[0] for g in data_cls_bin])
            cp_pln_tmp = np.asarray(
                [bct.distance.charpath(g)[0] for g in data_pln_bin])

            # Add measure to results list
            deg_cls.append(deg_cls_tmp)
            deg_pln.append(deg_pln_tmp)
            trans_cls.append(trans_cls_tmp)
            trans_pln.append(trans_pln_tmp)
            cp_cls.append(cp_cls_tmp)
            cp_pln.append(cp_pln_tmp)
コード例 #2
0
ファイル: clustering_tests.py プロジェクト: YSA6/bctpy
def test_transitivity_bu():
    x = bct.binarize(load_sample(thres=.17), copy=False)
    t = bct.transitivity_bu(x)
    assert np.allclose(t, 0.42763107)
コード例 #3
0
ファイル: clustering_tests.py プロジェクト: nkmunjal/bctpy
def test_transitivity_bu():
	x = bct.binarize(load_sample(thres=.17), copy=False)
	t = bct.transitivity_bu(x)
	assert np.allclose(t, 0.42763107)
コード例 #4
0
                [np.abs(corr_cls_coef),
                 np.abs(corr_pln_coef)], axis=0)
            threshold = np.median(full_matrix[np.nonzero(full_matrix)]) + \
                np.std(full_matrix[np.nonzero(full_matrix)])

            data_cls_bin = np.abs(corr_cls_coef) > threshold
            data_pln_bin = np.abs(corr_pln_coef) > threshold

            deg_cls_tmp = np.asarray(
                [bct.degrees_und(g) for g in data_cls_bin])

            deg_pln_tmp = np.asarray(
                [bct.degrees_und(g) for g in data_pln_bin])

            trans_cls_tmp = np.asarray(
                [bct.transitivity_bu(g) for g in data_cls_bin])
            trans_pln_tmp = np.asarray(
                [bct.transitivity_bu(g) for g in data_pln_bin])

            cp_cls_tmp = np.asarray(
                [bct.distance.charpath(g)[0] for g in data_cls_bin])
            cp_pln_tmp = np.asarray(
                [bct.distance.charpath(g)[0] for g in data_pln_bin])

            # Add measure to results list
            deg_cls.append(deg_cls_tmp)
            deg_pln.append(deg_pln_tmp)
            trans_cls.append(trans_cls_tmp)
            trans_pln.append(trans_pln_tmp)
            cp_cls.append(cp_cls_tmp)
            cp_pln.append(cp_pln_tmp)