Skip to content

Commit 6e8b46b

Browse files
committed
Merge branch 'master' into feature/testing-release-0.1.0
2 parents df4992e + e165e87 commit 6e8b46b

6 files changed

Lines changed: 14 additions & 8 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
annoy==1.17.0
1+
annoy==1.16.3
22
faiss-cpu==1.6.1
33
simplejson==3.17.0
4-
tqdm==4.51.0
4+
tqdm==4.51.0

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
"Recommender System"
1616
]
1717
}
18-
}
18+
}

python-lib/data_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def convert_df_to_vectors(self, df: pd.DataFrame, verbose: bool = True) -> Tuple
4949
+ f"{len(self.feature_columns)} column(s) into vector format..."
5050
)
5151
vector_ids = df[self.unique_id_column].values
52-
vectors = np.empty(shape=(len(df.index), self.MAX_VECTOR_LENGTH))
52+
vectors = np.empty(shape=(len(df.index), self.MAX_VECTOR_LENGTH)) # pre-allocate empty array of fixed size
5353
i = 0
5454
for column in self.feature_columns:
5555
column_is_vector = df[column].dtype == "object" and df[column].str.startswith("[").all()

python-lib/dku_param_loading.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def load_input_output_params(recipe_id: RecipeID) -> Dict:
7070

7171

7272
def load_indexing_recipe_params() -> Dict:
73-
"""Load and validate parameters of the Nearest Neighbor Indexing recipe
73+
"""Load and validate parameters of the Build Nearest Neighbor Search index recipe
7474
7575
Returns:
7676
Dictionary of parameter names (key) and values
@@ -79,7 +79,7 @@ def load_indexing_recipe_params() -> Dict:
7979
PluginParamValidationError: If a parameter is not valid
8080
8181
"""
82-
logging.info("Validating Nearest Neighbor Indexing parameters...")
82+
logging.info("Validating Build Nearest Neighbor Search index recipe parameters...")
8383
input_output_params = load_input_output_params(RecipeID.SIMILARITY_SEARCH_INDEX)
8484
# Recipe modeling parameters
8585
modeling_params = {}
@@ -111,7 +111,7 @@ def load_indexing_recipe_params() -> Dict:
111111

112112

113113
def load_search_recipe_params() -> Dict:
114-
"""Load and validate parameters of the Nearest Neighbor Search recipe
114+
"""Load and validate parameters of the Find Nearest Neighbors recipe
115115
116116
Returns:
117117
Dictionary of parameter names (key) and values
@@ -120,7 +120,7 @@ def load_search_recipe_params() -> Dict:
120120
PluginParamValidationError: If a parameter is not valid
121121
122122
"""
123-
logging.info("Validating Nearest Neighbor Search parameters...")
123+
logging.info("Validating Find Nearest Neighbors recipe parameters...")
124124
input_output_params = load_input_output_params(RecipeID.SIMILARITY_SEARCH_QUERY)
125125
# Recipe lookup parameters
126126
lookup_params = {}

python-lib/nearest_neighbor/annoy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# -*- coding: utf-8 -*-
22
"""Module for the Annoy Nearest Neighbor Search algorithm"""
33

4+
import logging
5+
46
import numpy as np
57
from typing import AnyStr, Dict, List, Tuple
68

@@ -37,6 +39,7 @@ def build_save_index(self, vectors: np.array, index_path: AnyStr) -> None:
3739
for i, vector in enumerate(tqdm(vectors, mininterval=1.0)):
3840
self.index.add_item(i, vector.tolist())
3941
self.index.build(n_trees=self.annoy_num_trees)
42+
logging.info(f"Index file path: {index_path}")
4043

4144
@time_logging(log_message="Loading pre-computed index")
4245
def load_index(self, file_path: AnyStr) -> None:

python-lib/nearest_neighbor/faiss.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# -*- coding: utf-8 -*-
22
"""Module for the Faiss Nearest Neighbor Search algorithm"""
33

4+
import logging
5+
46
import numpy as np
57
from typing import AnyStr, Dict, List, Tuple
68

@@ -44,6 +46,7 @@ def build_save_index(self, vectors: np.array, index_path: AnyStr) -> None:
4446
else:
4547
raise NotImplementedError("Faiss training methods not implemented")
4648
faiss.write_index(self.index, index_path)
49+
logging.info(f"Index file path: {index_path}")
4750

4851
@time_logging(log_message="Loading pre-computed index")
4952
def load_index(self, file_path: AnyStr) -> None:

0 commit comments

Comments
 (0)