SHARE
TWEET

Untitled

a guest Jun 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ABCA1, ABCA3, TEME
  2.      
  3. df = pd.read_csv('Genes.csv', index_col=0)
  4.     X = df.values
  5.     means = X.mean(axis=0)
  6.     stdevs = X.std(axis=0)
  7.     Xcent = X - means
  8.     Xnorm = Xcent / stdevs
  9.     features = ['ABCA1', 'ABCA3', ..., 'TEME'] #all the genes
  10.     df_norm = df.copy()
  11.     df_norm[features] = StandardScaler().fit(df_norm[features]).transform(df_norm[features])
  12.     X_tsne = TSNE(learning_rate=500, n_components=2).fit_transform(df_norm[features])
  13.     figure(figsize=(11, 5))
  14.     cmap = plt.get_cmap('nipy_spectral')
  15.     scatter(X_tsne[:, 0], X_tsne[:, 1])
  16.     title('TSNE')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top