tSNE data
This commit is contained in:
parent
5c2afdf3f4
commit
719f4f927b
11051
output_data_warrior.csv
Normal file
11051
output_data_warrior.csv
Normal file
File diff suppressed because it is too large
Load Diff
51
tSNETest.py
Normal file
51
tSNETest.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import pandas as pd
|
||||||
|
from sklearn.manifold import TSNE
|
||||||
|
import seaborn as sns
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
import os
|
||||||
|
|
||||||
|
#Make sure working directory is the same!
|
||||||
|
os.getcwd()
|
||||||
|
os.chdir("C:\\Users\\Jonathan\\Desktop\BPS - RP1\\January\Week 12 - 11-01-2021\\15 January")
|
||||||
|
|
||||||
|
df = pd.read_csv('output_data_warrior.csv', error_bad_lines=False)
|
||||||
|
# print(df.shape)
|
||||||
|
df_select = df[["rmsd1", "rmsd2"]]
|
||||||
|
# print(df_select)
|
||||||
|
|
||||||
|
# Text below was a try to show fingerprints (still possible, but unsure what use the plot would have)
|
||||||
|
# df_length = len(df_select)
|
||||||
|
# finger = Fingerprints[5]
|
||||||
|
# print(finger)
|
||||||
|
|
||||||
|
# for x in range(df_length):
|
||||||
|
# finger = Fingerprints[x]
|
||||||
|
# df_select = df_select[x].update(finger)
|
||||||
|
|
||||||
|
# df_select = df_select.apply (pd.to_numeric, errors='coerce')
|
||||||
|
# df_select = df_select.dropna()
|
||||||
|
# df_select = df_select.apply (pd.to_numeric, errors='coerce')
|
||||||
|
# df_select = df_select.dropna()
|
||||||
|
# print(df_select)
|
||||||
|
|
||||||
|
#Sets out the 2 selected columns from df_select against each other
|
||||||
|
m = TSNE(learning_rate=40)
|
||||||
|
tsne_features = m.fit_transform(df_select)
|
||||||
|
tsne_features[1:4, :]
|
||||||
|
|
||||||
|
df['tsne-2d-one']=tsne_features[:,0]
|
||||||
|
df['tsne-2d-two']=tsne_features[:,1]
|
||||||
|
|
||||||
|
plt.figure(figsize=(16,10))
|
||||||
|
sns.scatterplot(
|
||||||
|
x="tsne-2d-one", y="tsne-2d-two",
|
||||||
|
hue="tsne-2d-two",
|
||||||
|
palette=sns.color_palette("flare", as_cmap=True),
|
||||||
|
data=df,
|
||||||
|
legend="brief",
|
||||||
|
alpha=0.7
|
||||||
|
)
|
||||||
|
print("Created plot!")
|
||||||
|
|
||||||
|
# sns.scatterplot(x="x", y="y", hue="y", palette=sns.color_palette("hls", 2), data=df, legend="full")
|
||||||
|
# plot.show()
|
Reference in New Issue
Block a user