Commit graph

17 commits

Author SHA1 Message Date
Cathie Integra
3f096a592b Links: Use canonical trailing-slash form for website URLs 2026-06-24 17:20:30 +02:00
Michael Mayer
03129c9129 Vector: Reorganize package into topic-based files #4669
Split the catch-all values.go into one file per concept, each mirrored
by its test: distance.go, norm.go, stats.go, product.go, centroid.go,
plus the mean methods folded into mean.go and Copy/Dim/Sum into
vector.go. Remove values.go, values_test.go, and values_more_test.go so
functionality and tests live where developers expect them.

Hoist the two 512-dimensional face embeddings shared by the distance,
norm, and cosine tests into fixtures_test.go, removing the previous
triplication, and decompose the monolithic TestVector into per-concept
tests. Close pre-existing coverage gaps in the integer converters and
the GeometricMean/HarmonicMean method wrappers, bringing the package to
100% statement coverage. Pure code movement; no behavior change.
2026-05-30 09:44:03 +00:00
Michael Mayer
40b170ecb0 Vector: Add Normalize, Normalized, and Centroid helpers #4669
Prepare pkg/vector for a future refactoring of internal/ai/face without
touching the face package yet. Normalize scales a vector to unit length
(L2) in place and leaves a zero vector unchanged; Normalized returns a
normalized copy. Centroid returns the element-wise mean of a set of
vectors, ignoring entries whose length differs from the first and
averaging over the vectors actually included. Together with the existing
EuclideanDist, EuclideanNorm, and NewVector helpers these cover the math
currently hand-rolled in the face embeddings code. Fully covered by
tests (100% of the new functions).
2026-05-30 09:17:00 +00:00
Michael Mayer
a685b3f051 Vector: Add package doc comment and license header #4669
The root file of the vector package was missing the standard package
description and AGPL header required by the Go style rules. The vendored
alg subpackage keeps its own MIT license and is left unchanged.
2026-05-30 07:51:06 +00:00
Michael Mayer
e678231f34 Vector: Fix cosine distance, geometric mean, and copy semantics #4669
CosineDist now returns a true cosine distance (1 - similarity), so
identical vectors yield 0; the previous similarity behavior moves to a
new CosineSimilarity function/method. GeometricMean no longer treats a
zero element as an uninitialized accumulator: zeros now correctly yield
0 and negative inputs return NaN. NewVector copies float64 and Vector
inputs so the result is independent of the source slice, matching the
other converters. Norm uses absolute values so odd powers (L1) stay
well-defined for negative components, variance is simplified, and the
numeric error paths return NaN instead of the Epsilon sentinel. Add
focused tests for the mean, distance, norm, and copy helpers.
2026-05-30 07:51:06 +00:00
Michael Mayer
5511814dde Faces: Harden DBSCAN worker partitioning against zero step #5628
Extract the per-worker scan range size into partitionSize() and floor
it at 1 so the nearest() dispatch loop always advances and terminates,
even if the worker count exceeds the number of data points. The size
based numWorkers buckets keep points >= workers today, so this is a
defensive guard against future tuning. Add focused tests for the helper
and a high-worker end-to-end case.
2026-05-30 07:40:09 +00:00
Michael Mayer
418a018f6e Faces: Remove unused OPTICS clusterer from pkg/vector/alg #5628
The vendored OPTICS implementation was never invoked: face clustering
uses DBSCAN (alg.DBSCANWithProgress), and OPTICS() had no callers or
tests. Removing it also drops a latent no-op loop (PVS-Studio V8016)
in extract(). Drop the now-orphaned errZeroXi and update the rangeJob
comment and README to match. See discussion #5628.
2026-05-30 07:15:18 +00:00
Michael Mayer
dad865a009 Vector: Decouple DBSCAN progress logging 2026-03-09 15:21:29 +00:00
Keith Martin
bcf0c0fb28 faces: improve information logging in long running processes so they provide a status up every 15 minutes 2026-03-09 22:35:52 +10:00
Michael Mayer
a2b7615c93 Go: Apply go fix modernizations across backend packages
Run `go fix ./...` and keep mechanical modernization updates.

- Replace `interface{}` with `any` in signatures and local types
- Apply formatter/style cleanups from go1.26 tooling
- Keep `omitempty` behavior-preserving simplifications suggested by fix
- No functional feature changes intended

Validation:
- go test ./... -run '^$' -count=1 (Go 1.26.0)
- GOTOOLCHAIN=go1.24.10 go test ./... -run '^$' -count=1

Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-20 03:54:33 +01:00
Michael Mayer
cd7affffeb Cleanup: Fix formatting of Markdown files
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-14 12:10:43 +01:00
Michael Mayer
149f5e5731 CI: Apply Go linter recommendations to remaining "pkg/..." code #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-22 16:14:43 +01:00
promalert
5d0aa1068c refactor: use b.Loop() to simplify the code and improve performance
Signed-off-by: promalert <promalert@outlook.com>
2025-11-13 08:54:42 +01:00
Michael Mayer
61ced7119c Auth: Refactor cluster configuration and provisioning API endpoints #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-09-24 08:28:38 +02:00
Michael Mayer
023fbe3a1d Pkg: Add service/cluster package & rename media/http → service/http #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-09-13 12:58:28 +02:00
Yaroslav Halchenko
15668ee7b5
CI: Add codespell config and fix typos (#4506)
More about codespell: https://github.com/codespell-project/codespell
2025-03-27 16:42:24 +01:00
Michael Mayer
5738d838e5 Faces: Add dedicated vector algebra package #4691 #4669 #4328
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-02-03 16:48:46 +01:00