<jupyter_start><jupyter_text>PCA<jupyter_code># Time:
#   700: 0.02 s
#   7k: 0.04 s
#   70k: 0.29 s
#   700k: 

from sklearn.decomposition import PCA
time0 = time()
pca = PCA(n_components=2)
pca.fit(X_reduced)
X_pca = pca.transform(X_reduced)
time1 = time()
print("%.2f s" % (time1 - time0))

plt.figure(figsize=(8,6))
plt.scatter(X_pca[:,0],X_pca[:,1],c=y_reduced,cmap='plasma', alpha=0.1)
plt.xlabel('First principal component')
plt.ylabel('Second Principal Component')
if flags.export: 
    pd.DataFrame(X_pca).to_csv(flags.out_path + "dataset_pca.csv", index=False)
    plt.savefig(flags.out_path + 'EDA_pca.eps')<jupyter_output>0.46 s<jupyter_text>t-SNE<jupyter_code>from sklearn.manifold import TSNE
time0 = time()
tsne = TSNE(n_components=2, learning_rate=400, verbose=1, early_exaggeration=20, perplexity=100)
X_tsne = tsne.fit_transform(X_reduced)
time1 = time()
print("%.2f s" % (time1 - time0))

plt.figure(figsize=(8,6))
plt.scatter(X_tsne[:,0],X_tsne[:,1],c=y_reduced,cmap='plasma', alpha=0.1)
plt.xlabel('First component')
plt.ylabel('Second Component')
if flags.export: 
    pd.DataFrame(X_tsne).to_csv(flags.out_path + "dataset_tsne.csv", index=False)
    plt.savefig(flags.out_path + 'EDA_tsne.eps')<jupyter_output>[t-SNE] Computing 301 nearest neighbors...
[t-SNE] Indexed 73746 samples in 0.286s...
[t-SNE] Computed neighbors for 73746 samples in 281.616s...
[t-SNE] Computed conditional probabilities for sample 1000 / 73746
[t-SNE] Computed conditional probabilities for sample 2000 / 73746
[t-SNE] Computed conditional probabilities for sample 3000 / 73746
[t-SNE] Computed conditional probabilities for sample 4000 / 73746
[t-SNE] Computed conditional probabilities for sample 5000 / 73746
[t-SNE] Computed conditional probabilities for sample 6000 / 73746
[t-SNE] Computed conditional probabilities for sample 7000 / 73746
[t-SNE] Computed conditional probabilities for sample 8000 / 73746
[t-SNE] Computed conditional probabilities for sample 9000 / 73746
[t-SNE] Computed conditional probabilities for sample 10000 / 73746
[t-SNE] Computed conditional probabilities for sample 11000 / 73746
[t-SNE] Computed conditional probabilities for sample 12000 / 73746
[t-SNE] Computed conditional probabilities for [...]
{'fraction_non_alphanumeric': 0.128686327077748, 'fraction_numerical': 0.0840035746201966, 'mean_word_length': 5.5276967930029155, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '146964', 'license': 'MIT', 'n_tokens_mistral': 986, 'n_tokens_neox': 805, 'n_words': 198, 'path': 'artificial_intelligence/08 - Mining Dataset/01- Dimension reduction.ipynb', 'repo_name': 'LeonardoSanBenitez/LorisWeb', 'size': '2238'}