/statistics.py (cf8423b852f3c09938906493ea831d0cfbbec941) (2150 bytes) (mode 100644) (type blob)
#statistics.py
import redis as rd
import numpy as np
from scipy.stats import pearsonr
def calculate_statistics(self,metric,redis_key):
all_values = dict(self.redis.zrange(redis_key, 0, -1, withscores=True, score_cast_func=float)).values()
min_value = np.min(all_values)
max_value = np.max(all_values)
average = np.average(all_values)
median = np.median(all_values)
standard_deviation = np.std(all_values)
self.redis.hset(self.statistics_prefix+metric, 'min', min_value)
self.redis.hset(self.statistics_prefix+metric, 'max', max_value)
self.redis.hset(self.statistics_prefix+metric, 'average', average)
self.redis.hset(self.statistics_prefix+metric, 'median', median)
self.redis.hset(self.statistics_prefix+metric, 'standard_deviation', standard_deviation)
def calculate_correlations(self):
m = self.base_metrics.keys()
c = self.advanced_metrics.keys()
metrics = m + c
correlations = {}
for metric1 in metrics:
correlations[metric1] = {}
for metric2 in metrics:
correlations[metric1][metric2] = (0,0)
if metric1 == metric2:
correlations[metric1][metric2] = (1,0)
continue
dict_metric1 = dict(self.redis.zrange(self.metric_prefix+metric1, 0, -1, withscores=True, score_cast_func=float))
dict_metric2 = dict(self.redis.zrange(self.metric_prefix+metric2, 0, -1, withscores=True, score_cast_func=float))
values_metric1 = []
values_metric2 = []
for key in sorted(dict_metric1.iterkeys()):
values_metric1.append(dict_metric1[key])
for key in sorted(dict_metric2.iterkeys()):
values_metric2.append(dict_metric2[key])
correlations[metric1][metric2] = pearsonr(values_metric1,values_metric2)
values_metric1 = []
values_metric2 = []
for source in correlations:
for target in correlations[source]:
self.redis.hset(self.statistics_prefix+"correlations:"+source+":"+target, "correlation", correlations[source][target][0])
self.redis.hset(self.statistics_prefix+"correlations:"+source+":"+target, "confidence", correlations[source][target][1])
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
6 |
0d20b6487c61e7d1bde93acf4a14b7a89083a16d |
.gitignore |
100644 |
blob |
112 |
cb89d830628675849b4fc506e25faaee9ada3055 |
README.md |
100644 |
blob |
39806 |
a3ed366a3ca7fa6017d524c37cb15d492ef7a0ab |
RU_ASN.txt |
040000 |
tree |
- |
fe0210446ce6fae4108a4700bb1ca9d427592d96 |
RedisHelpers |
100644 |
blob |
1256 |
489636a0073e3dfe2bfd04ee893d609d304a8490 |
advancedscores.py |
100644 |
blob |
1175 |
51d93965eefe7cc74022747e2b9207a5d619dacc |
advancedscores.pyc |
100644 |
blob |
1420 |
985dee55c7d8134c4860db8bcccced703b2eb0af |
change_output_file.py |
100644 |
blob |
7894 |
4cad512ec750c425bfc4028598ceb8e49579499b |
config.py |
100644 |
blob |
2752 |
04b1176c3586c57b214cf3b20c110c4bd0956d25 |
config.pyc |
040000 |
tree |
- |
085c594868d9df498c937b91dc7a43e02fb9a934 |
data |
100644 |
blob |
4571 |
88c66d8e136505e5a29e3aeb8e6e7e131424f4e3 |
file_importer.py |
100644 |
blob |
2190 |
9b19358d5f4c39da2da330a4dba4416ae089ff61 |
file_importer.pyc |
100644 |
blob |
633 |
df288a704ff3390fbe5f3090d488fe45df79c23a |
graph_test.py |
100644 |
blob |
901 |
ae318bee51ebd11d4524c90cc13193f7e8bc208f |
gt_file_importer.py |
100644 |
blob |
1366 |
12f8577e0a31cee71b70c20849d18ebd36174796 |
gt_file_importer.pyc |
100644 |
blob |
2064 |
728489f88ef880350a83f4ab8b1e0510239ce067 |
gt_start.py |
100644 |
blob |
858 |
28f726f3a2fe224a374f24b299fdfdc8bef9f569 |
indexing.py |
100644 |
blob |
1571 |
68587bbbe3043dbed78d9b3b3018e802e93c6931 |
indexing.pyc |
100644 |
blob |
33232205 |
7ca601d1ca32abf3244359ce3ad85ea6a1b60010 |
log |
100644 |
blob |
15904 |
733b22f32ecb738568099b60b22c781df40dd067 |
metric_calculator.py |
100644 |
blob |
11204 |
b7d78f3bc365a4639c4b462f1724b732d8a11122 |
metric_calculator.pyc |
100644 |
blob |
14963 |
6692689a02b4cca1b60e568579723eedb748beec |
metrics.py |
100644 |
blob |
11616 |
a56470059e373ca2da9ac235a5457235a3a2fef8 |
metrics.pyc |
100644 |
blob |
61770227 |
1adc4f608c6a5fb41881af629b708af873dfed5f |
nohup.out |
100644 |
blob |
1665 |
a959a8cc528f486a80a84e2ab233457870d255a1 |
normalizations.py |
100644 |
blob |
1402 |
85e8e32fc6b18fabf451d9290c9d33b95d453f5e |
normalizations.pyc |
100644 |
blob |
10925 |
a32ff93ffd1cfd5603eb93aa4bd63b921c93ee66 |
percolation.py |
100644 |
blob |
6411 |
e81344c0f958c1b9ef244749208d4c4f6ca91bd0 |
percolation.pyc |
100644 |
blob |
1445 |
5c06bec9674e666d2a5633804e1579df1acb6a9e |
ru_file_importer.py |
100644 |
blob |
1976 |
2ec49e610f1a124fa66df97f6fd6e6bb230797e4 |
ru_file_importer.pyc |
100644 |
blob |
16641 |
ee1f7cf9d0fabd7fb76787e8c375cafd9e5c9f35 |
ru_metric_calculator.py |
100644 |
blob |
11412 |
3d1104701e131696433e467a5bef30a589105865 |
ru_metric_calculator.pyc |
100644 |
blob |
2101 |
faf282d2fa893c507daa12ae97d29407238b3748 |
ru_start.py |
100755 |
blob |
2122 |
2fa307ee1f510eefc21af359b48003c3b368c85b |
start.py |
100644 |
blob |
2150 |
cf8423b852f3c09938906493ea831d0cfbbec941 |
statistics.py |
100644 |
blob |
2126 |
f8f55b53a1757681125d5af18c87980b44afe6bb |
statistics.pyc |
100644 |
blob |
1107 |
90c62617dd2c7340c2f3d31a3f485d30f9736865 |
test.py |
100644 |
blob |
6574 |
39e8f0848567e9d6836abb6283290ab35f5fdde3 |
visualization.py |
100644 |
blob |
5643 |
a4a569c1d73df7dec64e48b266a38bb481e0c0bb |
visualization.pyc |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/coria/coria-backend
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/coria/coria-backend
Clone this repository using git:
git clone git://git.rocketgit.com/user/coria/coria-backend
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main