<jupyter_start><jupyter_text>This is going to have my t-SNE scatter plot for the data<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
from PIL import Image
import os
import numpy as np
import glob
import pandas as pd
import seaborn as sns
import umap
path="Resources/stimuli/"
Xlist=[]
Ylist=[]
for filepath in glob.iglob('Resources/stimuli/*/*.JPG'):
    print(filepath)
bean = "Resources/stimuli/09/09F_Ne_to_Sa_C07.JPG"
split_bean=bean.split('/')[-1]
print(split_bean.split('.')[0])
for filepath in glob.iglob('Resources/stimuli/*/*.JPG'):
    img= Image.open(filepath)
    featurevector=np.array(img).flatten()
    Xlist.append(featurevector)
    file_name = filepath.split('/')[-1]
    Ylist.append(file_name.split('.')[0])
    
    
print(Xlist[0])
Xlist[0].shape
len(Xlist)
images_dataframe = pd.DataFrame(Xlist)

reducer = umap.UMAP(random_state=42)
reducer.fit(images_dataframe)
embedding = reducer.transform(images_dataframe)
embedding.shape
fig = plt.figure(figsize=(12, 8))


plt.scatter(embedding[:, 0], embedding[:, 1], c=[sns.color_palette()[4]], cmap='Spectral', s=2)
plt.gca().set_aspect('equal', 'datalim')
plt.title('UMAP projection of the faces dataset from pixel space', fontsize=24);

plt.savefig('umap_pixel_2.png', dpi=300)<jupyter_output><empty_output><jupyter_text>Trying to get compressed images:<jupyter_code>path="Resources/stimuli/"
Xslist=[]
Yslist=[]
for filepath in glob.iglob('Resources/stimuli/*/*.JPG'):
    img= Image.open(filepath)
    img = img.resize((100,100), Image.ANTIALIAS)
    featurevector=np.array(img).flatten()
    Xslist.append(featurevector)
    file_name = filepath.split('/')[-1]
    Yslist.append(file_name.split('.')[0])
    
    
print(Xslist[0])
Xslist[0].size
small_images_dataframe = pd.DataFrame(Xslist)
#sns.pairplot(small_images_dataframe, hue='digit', palette='Spectral')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15895800106326421, 'fraction_numerical': 0.019670388091440724, 'mean_word_length': 5.868613138686132, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '362104', 'license': 'MIT', 'n_tokens_mistral': 741, 'n_tokens_neox': 707, 'n_words': 124, 'path': 'Plotting/clustering.ipynb', 'repo_name': 'joshholla/neuro_noodle', 'size': '1881'}