Skip to content
Permalink
Browse files

feat(client): add a client for benchmarking and testing

  • Loading branch information...
hanxiao committed Aug 13, 2019
1 parent bdbc9df commit 0133905c807f53df0631eb50e65540b3c314ff02
@@ -14,7 +14,6 @@
# limitations under the License.



# do not change this line
# this is managed by git tag and replaced on every release
__version__ = '0.0.27'
@@ -14,8 +14,6 @@
# limitations under the License.


import time

import grpc

from ..helper import TimeContext
@@ -14,7 +14,6 @@
# limitations under the License.



from typing import List

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




import numpy as np

from ..base import BaseNumericEncoder
@@ -14,8 +14,6 @@
# limitations under the License.




import numpy as np

from ..base import BaseNumericEncoder
@@ -14,8 +14,6 @@
# limitations under the License.




import numpy as np

from ..base import BaseBinaryEncoder
@@ -14,8 +14,6 @@
# limitations under the License.




from typing import Dict, Any

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




import copy

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




from typing import List

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




from typing import List

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




from typing import List

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




from typing import List

import numpy as np
@@ -14,8 +14,6 @@
# limitations under the License.




import pickle
from threading import Thread, Event
from typing import List, Any
@@ -72,14 +72,14 @@ def query(self, keys: 'np.ndarray', top_k: int, *args, **kwargs) -> List[List[Tu

def normalize_score(self, score: List[float], metrics: str, *args, **kwargs) -> List[float]:
if metrics == 'angular':
return list(map(lambda x:1 / (1 + x), score))
return list(map(lambda x: 1 / (1 + x), score))
elif metrics == 'euclidean':
import math
return list(map(lambda x:1 / (1 + math.sqrt(x) / self.num_dim), score))
return list(map(lambda x: 1 / (1 + math.sqrt(x) / self.num_dim), score))
elif metrics == 'manhattan':
return list(map(lambda x:1 / (1 + x / self.num_dim), score))
return list(map(lambda x: 1 / (1 + x / self.num_dim), score))
elif metrics == 'hamming':
return list(map(lambda x:1 / (1 + x), score))
return list(map(lambda x: 1 / (1 + x), score))
elif metrics == 'dot':
raise NotImplementedError

@@ -14,7 +14,6 @@
# limitations under the License.



import os
from typing import List, Tuple, Any

@@ -14,8 +14,6 @@
# limitations under the License.




import os
from typing import List, Tuple, Any

@@ -14,7 +14,6 @@
# limitations under the License.



import os
from typing import List, Tuple, Any

@@ -14,7 +14,6 @@
# limitations under the License.



from typing import List, Tuple, Any

import numpy as np
@@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import random
from typing import List

import numpy as np
import random

from .base import BaseVideoPreprocessor
from ..helper import get_video_frames, phash_descriptor
from ...proto import gnes_pb2, array2blob
@@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List
from collections import defaultdict
from typing import List

from ..base import BaseReduceRouter
from ...proto import gnes_pb2
@@ -42,4 +42,4 @@ def apply(self, msg: 'gnes_pb2.Message', accum_msgs: List['gnes_pb2.Message'], *
r.score = v
r.score_explained = doc_score_explained[k]

super().apply(msg, accum_msgs)
super().apply(msg, accum_msgs)
@@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List
from collections import defaultdict
from typing import List

from ..base import BaseReduceRouter
from ...proto import gnes_pb2
@@ -52,4 +52,4 @@ def apply(self, msg: 'gnes_pb2.Message', accum_msgs: List['gnes_pb2.Message'], *
msg.response.search.ClearField('topk_results')
msg.response.search.topk_results.extend(final_fulltext_docs[:msg.response.search.top_k])

super().apply(msg, accum_msgs)
super().apply(msg, accum_msgs)

0 comments on commit 0133905

Please sign in to comment.
You can’t perform that action at this time.