Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 72f43e1

Browse files
committed
override transformers methods for dimension and memory usage
1 parent b7c7dab commit 72f43e1

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pyemma/coordinates/coordinate_transformation/clustering/regspace_clustering.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,27 @@ def map_to_memory(self):
4949
# done in parametrize
5050
pass
5151

52+
def dimension(self):
53+
return 1
54+
55+
def get_memory_per_frame(self):
56+
"""
57+
Returns the memory requirements per frame, in bytes
58+
59+
:return:
60+
"""
61+
# 4 bytes per frame for an integer index
62+
return 4
63+
64+
def get_constant_memory(self):
65+
"""
66+
Returns the constant memory requirements, in bytes
67+
68+
:return:
69+
"""
70+
# memory for cluster centers and discrete trajectories
71+
return 4 * self.data_producer.dimension() + 4 * self.data_producer.n_frames_total()
72+
5273
def param_add_data(self, X, itraj, t, first_chunk, last_chunk_in_traj, last_chunk, ipass, Y=None):
5374
"""
5475
first pass: calculate centroids
@@ -64,7 +85,8 @@ def param_add_data(self, X, itraj, t, first_chunk, last_chunk_in_traj, last_chun
6485
self.centroids.append(X[0])
6586
log.info("Run regspace clustering with dmin=%f;"
6687
" First centroid=%s" % (self.dmin, X[0]))
67-
88+
# TODO: optimize with cython, support different metrics
89+
# see mixtape.libdistance
6890
for x in X:
6991
dist = np.fromiter((np.linalg.norm(x - c, 2)
7092
for c in self.centroids), dtype=np.float32)

0 commit comments

Comments
 (0)