# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import matplotlib.pyplot as plt
import numpy as np
import joblib
import tensorflow as tf

import matplotlib
matplotlib.use("pgf")
matplotlib.rcParams.update({
    "pgf.texsystem": "pdflatex",
    'font.family': 'serif',
    'text.usetex': True,
    'pgf.rcfonts': False,
})


def show_tsne(x, labels):
  fig, ax = plt.subplots()
  fig.set_size_inches(10, 10)
  scatter = ax.scatter(x[:, 0], x[:, 1], c = labels, cmap = 'tab10')
  legend = ax.legend(*scatter.legend_elements(),
                    title = 'Digits',
                    fontsize = 'large',
                    title_fontsize = 'x-large',
                    markerscale = 2)
  ax.set_xticks([])
  ax.set_yticks([])
  plt.show()


y, y_validation = joblib.load('tsne-data')

show_tsne(y[-1], y_validation)
plt.savefig('slides/pictures/tsne.pgf')

with open('slides/pictures/tsne-data.txt', 'w') as fout:
    for i in range(len(y_validation)):
        print(f'{y[-1][i, 0]} {y[-1][i, 1]} {y_validation[i]}', file = fout)

a=tf.constant([[1,2],[100,200],[10000,20000]])
a[:, None, :] + a



StarcoderdataJupyterScriptsDedupFiltered