<jupyter_start><jupyter_text>Embed a trivial 3 dimensional dataset to 2 dimensions<jupyter_code>import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs

X, y = make_blobs(n_samples=50, centers=3, n_features=3, random_state=1)

fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=y)

plt.show()
from saepipe import EmbeddingPipeline
from numpy.linalg import norm
from tensorflow.keras.layers import Dense

difference = lambda a, b: norm(a - b)

pipeline = EmbeddingPipeline()
pipeline.add(Dense(2))

pipeline.compile(optimizer='adam', loss='mean_squared_error')
pipeline.fit(difference, X, epochs=5)

X_embed = pipeline.predict(X)

fig = plt.figure()
ax = fig.add_subplot()
ax.scatter(X_embed[:, 0], X_embed[:, 1], c=y)

plt.show()<jupyter_output>Epoch 1/5
2450/2450 [==============================] - 2s 769us/step
Total loss: 9055.7783203125
Epoch 2/5
2450/2450 [==============================] - 2s 790us/step
Total loss: 1167.24072265625
Epoch 3/5
2450/2450 [==============================] - 2s 807us/step
Total loss: 825.8538208007812
Epoch 4/5
2450/2450 [==============================] - 2s 798us/step
Total loss: 713.63330078125
Epoch 5/5
2450/2450 [==============================] - 2s 761us/step
Total loss: 641.6376342773438
{'fraction_non_alphanumeric': 0.2361111111111111, 'fraction_numerical': 0.12345679012345678, 'mean_word_length': 6.126373626373627, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '549855', 'license': 'MIT', 'n_tokens_mistral': 588, 'n_tokens_neox': 486, 'n_words': 111, 'path': 'examples/toy_example.ipynb', 'repo_name': 'LakeYin/SAE-Pipe', 'size': '1296'}