The wave logs each served candidate's feature vector to rec_impression_features. Nightly training joins them with impression outcomes, validates on the last week and activates the model only when it beats the v1 order and the active model. The service loads the active ranker and uses its order in place of the v1 score. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
847 B
SQL
18 lines
847 B
SQL
-- +goose Up
|
|
-- Ранжировщик волны v2 (docs/recommendations.md#6.3): признаки кандидата в момент показа — для обучения
|
|
-- LightGBM на исходах показов (wave_impressions.outcome); артефакт модели хранится в model_versions.
|
|
CREATE TABLE rec_impression_features (
|
|
wave_session_id uuid NOT NULL REFERENCES wave_sessions(id) ON DELETE CASCADE,
|
|
track_id uuid NOT NULL,
|
|
features real[] NOT NULL,
|
|
served_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (wave_session_id, track_id)
|
|
);
|
|
CREATE INDEX rec_impression_features_served_idx ON rec_impression_features (served_at);
|
|
|
|
ALTER TABLE model_versions ADD COLUMN artifact text;
|
|
|
|
-- +goose Down
|
|
ALTER TABLE model_versions DROP COLUMN artifact;
|
|
DROP TABLE rec_impression_features;
|