reflexive 2.0.0__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reflexive/analysis_functions.py +17 -1
- reflexive/res_analysis.py +11 -0
- {reflexive-2.0.0.dist-info → reflexive-2.1.0.dist-info}/METADATA +1 -1
- reflexive-2.1.0.dist-info/RECORD +9 -0
- reflexive-2.0.0.dist-info/RECORD +0 -9
- {reflexive-2.0.0.dist-info → reflexive-2.1.0.dist-info}/WHEEL +0 -0
- {reflexive-2.0.0.dist-info → reflexive-2.1.0.dist-info}/licenses/LICENSE +0 -0
reflexive/analysis_functions.py
CHANGED
|
@@ -99,9 +99,15 @@ def _add_res_weights(df):
|
|
|
99
99
|
temp_df['res_weights'] = temp_df.res_interactions.apply(_calc_res_weights)
|
|
100
100
|
return temp_df
|
|
101
101
|
|
|
102
|
+
def _add_semantic_weights(df,ranking_factors={}):
|
|
103
|
+
temp_df = df.copy()
|
|
104
|
+
ranks = partial(_calc_semantic_weights,factors=ranking_factors)
|
|
105
|
+
temp_df['semantic_weights'] = temp_df.res_weights.apply(ranks)
|
|
106
|
+
return temp_df
|
|
107
|
+
|
|
102
108
|
def _add_res_adj_matrix(df):
|
|
103
109
|
temp_df = df.copy()
|
|
104
|
-
temp_df['res_adj_matrix'] = temp_df.
|
|
110
|
+
temp_df['res_adj_matrix'] = temp_df.semantic_weights.apply(_create_adj_matrix)
|
|
105
111
|
return temp_df
|
|
106
112
|
|
|
107
113
|
def _get_res_sequence(offsets_clean):
|
|
@@ -134,6 +140,16 @@ def _calc_res_weights(interactions:dict[tuple,int])->dict[tuple,float]:
|
|
|
134
140
|
for edge,count in interactions.items():
|
|
135
141
|
weights[edge] = round(count/(max_count),2)
|
|
136
142
|
return weights
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _calc_semantic_weights(weights:dict[tuple,float], factors:dict[tuple,float]={})->dict[tuple,float]:
|
|
147
|
+
if not factors:
|
|
148
|
+
return weights
|
|
149
|
+
else:
|
|
150
|
+
for edge,w in weights.items():
|
|
151
|
+
weights[edge] = factors[edge] * w
|
|
152
|
+
return weights
|
|
137
153
|
|
|
138
154
|
|
|
139
155
|
def _create_adj_matrix(weights:dict[tuple,float])->list[list[float]]:
|
reflexive/res_analysis.py
CHANGED
|
@@ -20,6 +20,7 @@ from reflexive.analysis_functions import (
|
|
|
20
20
|
_add_res_sequence,
|
|
21
21
|
_add_res_interactions,
|
|
22
22
|
_add_res_weights,
|
|
23
|
+
_add_semantic_weights,
|
|
23
24
|
_add_res_adj_matrix,
|
|
24
25
|
_jaccard_similarity,
|
|
25
26
|
_cosine_similarity,
|
|
@@ -39,6 +40,12 @@ class RES_analyser:
|
|
|
39
40
|
config:dict
|
|
40
41
|
|
|
41
42
|
logger = logging.getLogger(__name__)
|
|
43
|
+
|
|
44
|
+
ranking_factors = {('RR','RR'):0.5, ('NR','RR'):0.9, ('AR','RR'):0.9, ('AF','RR'):0.8, ('EP','RR'):0.7, #Alpha sorted tuples
|
|
45
|
+
('NR','NR'):0.6, ('AR','NR'):1.0, ('AF','NR'):0.8, ('EP','NR'):0.7,
|
|
46
|
+
('AR','AR'):0.6, ('AF','AR'):0.8, ('AR','EP'):0.7,
|
|
47
|
+
('AF','AF'):0.5, ('AF','EP'):0.6,
|
|
48
|
+
('EP','EP'):0.5}
|
|
42
49
|
|
|
43
50
|
|
|
44
51
|
def __init__(self,parameters,prefix="res",postfix=None,dir="/data/")->None:
|
|
@@ -113,8 +120,12 @@ class RES_analyser:
|
|
|
113
120
|
df = _add_res_sequence(df)
|
|
114
121
|
df = _add_res_interactions(df)
|
|
115
122
|
df = _add_res_weights(df)
|
|
123
|
+
df = _add_semantic_weights(df,self.ranking_factors)
|
|
116
124
|
df = _add_res_adj_matrix(df)
|
|
117
125
|
return df
|
|
126
|
+
|
|
127
|
+
# def add_semantic_weights(self,df):
|
|
128
|
+
# return _add_semantic_weights(df,self.ranking_factors)
|
|
118
129
|
|
|
119
130
|
# Graph Jaccard Similarity
|
|
120
131
|
def get_jaccard_similarity(self,g1,g2):
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
reflexive/__init__.py,sha256=UkA6xvSu40CGYguUuiBqBMnPBkld0h0GR9UnZrptdZI,167
|
|
2
|
+
reflexive/analysis_functions.py,sha256=Qlod0svjBu9kRtGwPL-tPWnrYKLO-QTe07jSrxHZ6-k,14468
|
|
3
|
+
reflexive/display_functions.py,sha256=2LdkINOgmZfiV7nkW0x_IeimxW3J80YIOOnjX21-RJA,5699
|
|
4
|
+
reflexive/res_analysis.py,sha256=1W7Mph30s4qiV63CsN3IDxIydvYelOu28aVdsmF8gcs,7442
|
|
5
|
+
reflexive/service.py,sha256=O0MX2BCHTSNG_eW6LHBN1FOjaNTCGgYgh7vsk58NNAk,1927
|
|
6
|
+
reflexive-2.1.0.dist-info/METADATA,sha256=ulz3xZXF5W41XSq6ZEVF5Nfyi_18vBQ4ie6FA1F7bdo,574
|
|
7
|
+
reflexive-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
reflexive-2.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
+
reflexive-2.1.0.dist-info/RECORD,,
|
reflexive-2.0.0.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
reflexive/__init__.py,sha256=UkA6xvSu40CGYguUuiBqBMnPBkld0h0GR9UnZrptdZI,167
|
|
2
|
-
reflexive/analysis_functions.py,sha256=cVTQtQnQigMJSCoQOtXI0_tyX49Re96Uz-ubx4UToUw,13966
|
|
3
|
-
reflexive/display_functions.py,sha256=2LdkINOgmZfiV7nkW0x_IeimxW3J80YIOOnjX21-RJA,5699
|
|
4
|
-
reflexive/res_analysis.py,sha256=jpb2Fh_jLEZmi4t6I6Q9nVE9LYRc_YJMGx12_co_69Y,6841
|
|
5
|
-
reflexive/service.py,sha256=O0MX2BCHTSNG_eW6LHBN1FOjaNTCGgYgh7vsk58NNAk,1927
|
|
6
|
-
reflexive-2.0.0.dist-info/METADATA,sha256=60ZmW9iHzBxs3BZeUm6KrsRq3LFwDQB6xGS_zuRaYoo,574
|
|
7
|
-
reflexive-2.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
-
reflexive-2.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
-
reflexive-2.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|