/normalizations.py (a959a8cc528f486a80a84e2ab233457870d255a1) (1665 bytes) (mode 100644) (type blob)
#normalizations.py
def min_max(self,metric_name):
#perform min max normalization of specified metric for all nodes
#min_max normalization
#get min and max from redis
x_min = self.redis.zrange(self.metric_prefix+metric_name, 0, 0, withscores=True, score_cast_func=float)[0][1]
x_max = self.redis.zrange(self.metric_prefix+metric_name, -1, -1, withscores=True, score_cast_func=float)[0][1]
#print x_min
#print x_max
for node in self.nodes:
if x_min == x_max:
x_normalized = 1.0
else:
x = float(self.redis.hget(self.node_prefix+str(node), metric_name))
x_normalized = (x - x_min) / (x_max - x_min)
#store value for node and metric
self.redis.zadd(self.metric_prefix+metric_name+self.normalization_suffix, x_normalized, str(node))
self.redis.hset(self.node_prefix+str(node),metric_name+self.normalization_suffix, x_normalized)
#max min normalization
def max_min(self,metric_name):
x_min = self.redis.zrange(self.metric_prefix+metric_name, 0, 0, withscores=True, score_cast_func=float)[0][1]
x_max = self.redis.zrange(self.metric_prefix+metric_name, -1, -1, withscores=True, score_cast_func=float)[0][1]
for node in self.nodes:
if x_min == x_max:
x_normalized = 1.0
else:
x = float(self.redis.hget(self.node_prefix+str(node), metric_name))
x_normalized = (x_max - x) / (x_max - x_min)
#store value for node and metric
self.redis.zadd(self.metric_prefix+metric_name+self.normalization_suffix, x_normalized, str(node))
self.redis.hset(self.node_prefix+str(node),metric_name+self.normalization_suffix, x_normalized)
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
71 |
775e9a6c11e2dbd63560e490be54df0f5d07636a |
README.md |
100644 |
blob |
0 |
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 |
__init__.py |
100644 |
blob |
1256 |
489636a0073e3dfe2bfd04ee893d609d304a8490 |
advancedscores.py |
100644 |
blob |
4648 |
d4c8c5e1203305eb43693cd830a173e89e1d19bf |
config.py |
040000 |
tree |
- |
1eae5e19b1eff05e464e361e3f50f3df23f1b754 |
data |
100644 |
blob |
662 |
36006180d2297800e02a403802ba4c69244ef217 |
file_importer.py |
100644 |
blob |
716 |
359eb7179fa58d67044228556f7d9c38b5caec85 |
indexing.py |
100644 |
blob |
24064 |
281cf200c8f2a5511861ee13fa0b389433c2acdb |
metric_calculator.py |
100644 |
blob |
4982 |
d0b9c8eb7fcb8180748a37f1759e4e08b3b180fa |
metrics.py |
100644 |
blob |
1665 |
a959a8cc528f486a80a84e2ab233457870d255a1 |
normalizations.py |
100644 |
blob |
1575 |
7a6cc1ce0ca8ab13c12325ce4ac45044544ed9a1 |
pearson.py |
100644 |
blob |
554 |
29e5255c9f0970ee8d4f270aa35831d55e2fe368 |
start.py |
100644 |
blob |
2144 |
fb03eaa1cd8eb0d6c17b2019fe4c877a32bb7059 |
statistics.py |
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