leaves12138 commented on code in PR #62:
URL:
https://github.com/apache/paimon-vector-index/pull/62#discussion_r3651385397
##########
python/paimon_vindex/__init__.py:
##########
@@ -221,7 +258,16 @@ def create(cls, options: Mapping[str, str]):
@classmethod
def train(cls, options: Mapping[str, str], data):
- with cls(options) as trainer:
+ data = _float32_matrix(data, "data")
+ resolved_options = dict(options)
+ if resolved_options.get("dimension") in (None, "auto"):
+ resolved_options["dimension"] = str(data.shape[1])
+ if (
+ resolved_options.get("index.type", "").startswith("ivf_")
+ and resolved_options.get("nlist") in (None, "auto")
+ ):
+ resolved_options["expected-vector-count"] = str(data.shape[0])
Review Comment:
Could we preserve an explicitly supplied `expected-vector-count` here (and
in the Java convenience method)? `data` is the training sample, not necessarily
the final indexed corpus. With `nlist=auto`, a caller can intentionally pass
`expected-vector-count=1000000` while training on 10,000 sampled vectors, but
this assignment silently replaces it with `10000`, changing the inferred
`nlist` from 1024 to 128. Please only infer `expected-vector-count` when the
option is absent; an explicit corpus-size hint should take precedence over the
convenience fallback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]