File size: 946 Bytes
a1b0768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Listed Elo vs PCA / t-SNE projection plots for the web UI."""

from __future__ import annotations

from typing import Any, Literal

from chess_tutor.inference.pipeline import InferenceResult
from chess_tutor.playstyle_coaching.teacher import TeacherCoachingBundle
from chess_tutor.web.embedding import build_all_embedding_plots


def build_elo_embedding_plot(
    result: InferenceResult,
    method: Literal["pca", "tsne"],
    *,
    corpus_id: str = "standard_600",
    teacher_bundle: TeacherCoachingBundle | None = None,
    max_points: int = 6000,
    seed: int = 42,
) -> dict[str, Any] | None:
    """Place cohort snapshots and the analyzed player on listed Elo (x) vs embedding (y)."""
    key = "elo_pca_plot" if method == "pca" else "elo_tsne_plot"
    return build_all_embedding_plots(
        result,
        corpus_id=corpus_id,
        teacher_bundle=teacher_bundle,
        max_points=max_points,
        seed=seed,
    )[key]