Skip to content

Commit

Permalink
Merge pull request #1 from mlucy/feature/add-normalization-and-pca
Browse files Browse the repository at this point in the history
Feature/add normalization and pca
  • Loading branch information
thejsj committed Jan 10, 2019
2 parents 05a8122 + 8b072f7 commit 96446c1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
basilica/docs/_build/
61 changes: 55 additions & 6 deletions basilica/basilica/__init__.py
Expand Up @@ -101,8 +101,16 @@ def embed_images(self, images, model='generic', version='default',
:type batch_size: int
:param opts: Options specific to the model/version you chose.
:type opts: Dict[str, Any]
:param opts["dimensions"]: Number of dimensions to return. PCA will be used to reduce the number of dimensions with minimal information loss.
:type opts["dimensions"]: int
:param opts["normalize_l2"]: Whether or not each instance should be scaled to have unit L2 norm. (This is sometimes useful for instance retrieval tasks.) Defaults to False.
:type opts["normalize_l2"]: bool
:param opts["normalize_mean"]: Whether or not to normalize each feature in the embedding to have mean 0 across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_mean"]: bool
:param opts["normalize_variance"]: Whether or not to normalize each feature in the embedding to have unit variance across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_variance"]: bool
:param timeout: HTTP timeout for request.
:type opts: int
:type timeout: int
:returns: A generator of embeddings.
:rtype: Generator[List[float]]
Expand Down Expand Up @@ -132,8 +140,16 @@ def embed_image(self, image, model='generic', version='default',
:type version: str
:param opts: Options specific to the model/version you chose.
:type opts: Dict[str, Any]
:param opts["dimensions"]: Number of dimensions to return. PCA will be used to reduce the number of dimensions with minimal information loss.
:type opts["dimensions"]: int
:param opts["normalize_l2"]: Whether or not each instance should be scaled to have unit L2 norm. (This is sometimes useful for instance retrieval tasks.) Defaults to False.
:type opts["normalize_l2"]: bool
:param opts["normalize_mean"]: Whether or not to normalize each feature in the embedding to have mean 0 across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_mean"]: bool
:param opts["normalize_variance"]: Whether or not to normalize each feature in the embedding to have unit variance across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_variance"]: bool
:param timeout: HTTP timeout for request.
:type opts: int
:type timeout: int
:returns: An embedding.
:rtype: List[float]
Expand All @@ -159,8 +175,16 @@ def embed_image_files(self, image_files, model='generic', version='default',
:type batch_size: int
:param opts: Options specific to the model/version you chose.
:type opts: Dict[str, Any]
:param opts["dimensions"]: Number of dimensions to return. PCA will be used to reduce the number of dimensions with minimal information loss.
:type opts["dimensions"]: int
:param opts["normalize_l2"]: Whether or not each instance should be scaled to have unit L2 norm. (This is sometimes useful for instance retrieval tasks.) Defaults to False.
:type opts["normalize_l2"]: bool
:param opts["normalize_mean"]: Whether or not to normalize each feature in the embedding to have mean 0 across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_mean"]: bool
:param opts["normalize_variance"]: Whether or not to normalize each feature in the embedding to have unit variance across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_variance"]: bool
:param timeout: HTTP timeout for request.
:type opts: int
:type timeout: int
:returns: A generator of embeddings.
:rtype: Generator[List[float]]
Expand Down Expand Up @@ -189,8 +213,17 @@ def embed_image_file(self, image_file, model='generic', version='default',
:type version: str
:param opts: Options specific to the model/version you chose.
:type opts: Dict[str, Any]
:param opts["dimensions"]: Number of dimensions to return. PCA will be used to reduce the number of dimensions with minimal information loss.
:type opts["dimensions"]: int
:param opts["normalize_l2"]: Whether or not each instance should be scaled to have unit L2 norm. (This is sometimes useful for instance retrieval tasks.) Defaults to False.
:type opts["normalize_l2"]: bool
:param opts["normalize_mean"]: Whether or not to normalize each feature in the embedding to have mean 0 across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_mean"]: bool
:param opts["normalize_variance"]: Whether or not to normalize each feature in the embedding to have unit variance across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_variance"]: bool
:param timeout: HTTP timeout for request.
:type opts: int
:type timeout: int
:returns: An embedding.
:rtype: List[float]
Expand All @@ -216,8 +249,16 @@ def embed_sentences(self, sentences, model='english', version='default',
:type batch_size: int
:param opts: Options specific to the model/version you chose.
:type opts: Dict[str, Any]
:param opts["dimensions"]: Number of dimensions to return. PCA will be used to reduce the number of dimensions with minimal information loss.
:type opts["dimensions"]: int
:param opts["normalize_l2"]: Whether or not each instance should be scaled to have unit L2 norm. (This is sometimes useful for instance retrieval tasks.) Defaults to False.
:type opts["normalize_l2"]: bool
:param opts["normalize_mean"]: Whether or not to normalize each feature in the embedding to have mean 0 across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_mean"]: bool
:param opts["normalize_variance"]: Whether or not to normalize each feature in the embedding to have unit variance across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_variance"]: bool
:param timeout: HTTP timeout for request.
:type opts: int
:type timeout: int
:returns: A generator of embeddings.
:rtype: Generator[List[float]]
Expand All @@ -243,8 +284,16 @@ def embed_sentence(self, sentence, model='english', version='default',
:type version: str
:param opts: Options specific to the model/version you chose.
:type opts: Dict[str, Any]
:param opts["dimensions"]: Number of dimensions to return. PCA will be used to reduce the number of dimensions with minimal information loss.
:type opts["dimensions"]: int
:param opts["normalize_l2"]: Whether or not each instance should be scaled to have unit L2 norm. (This is sometimes useful for instance retrieval tasks.) Defaults to False.
:type opts["normalize_l2"]: bool
:param opts["normalize_mean"]: Whether or not to normalize each feature in the embedding to have mean 0 across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_mean"]: bool
:param opts["normalize_variance"]: Whether or not to normalize each feature in the embedding to have unit variance across our sample dataset. Defaults to True when `dimensions` is set, or False otherwise.
:type opts["normalize_variance"]: bool
:param timeout: HTTP timeout for request.
:type opts: int
:type timeout: int
:returns: An embedding.
:rtype: List[float]
Expand Down

0 comments on commit 96446c1

Please sign in to comment.