Don't look back. Don't hesitate, just do it.

t-SNE原理

from here.

1. tsne is strictly used for visualization. and we can only see things in up to 3 dimensions.

t-Distributed Stochastic Neighbor Embedding (t-SNE) is a dimensionality reduction technique used to represent high-dimensional dataset in a low-dimensional space of two or three dimensions so that we can visualize it. In contrast to other dimensionality reduction algorithms like PCA which simply maximizes the variance, t-SNE creates a reduced feature space where similar samples are modeled by nearby points and dissimilar samples are modeled by distant points with high probability.

At a high level, t-SNE constructs a probability distribution for the high-dimensional samples in such a way that similar samples have a high likelihood of being picked while dissimilar points have an extremely small likelihood of being picked. Then, t-SNE defines a similar distribution for the points in the low-dimensional embedding. Finally, t-SNE minimizes the Kullback–Leibler divergence between the two distributions with respect to the locations of the points in the embedding.

>>> import numpy as np
>>> from sklearn.manifold import TSNE
>>> X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
>>> X_embedded = TSNE(n_components=2).fit_transform(X)
>>> X_embedded.shape
(4, 2)

Return:

X_new: array, shape (n_samples, n_components)

Embedding of the training data in low-dimensional space.

Q:

1. why a distance matrix is a high dimension? I originally thought it was just two dimensions.

将矩阵中的每一列当作一维?


从SNE到t-SNE再到LargeVis

tSNEJS

SNE

假设:在高维空间相似的数据点,映射到低维空间距离也是相似的。

常规的做法是用欧式距离表示这种相似性,而SNE把这种距离关系转换为一种条件概率来表示相似性。Pi 表示高维空间中,xi与其他所有点之间的条件概率。同理在低维空间存在一个条件概率分布Qi且应该与Pi一致。如何衡量两个分布之间的相似性?当然是用经典的KL距离(Kullback-Leibler Divergence),SNE最终目标就是对所有数据点最小化这个KL距离,

cost function: KL divergence.

最小化代价函数的目的是让pj∣i和qj∣i的值尽可能的接近,即低维空间中点的相似性应当与高维空间中点的相似性一致。

t-SNE

在原始的SNE中,pi∣jpi∣j与pj∣ipj∣i是不相等的,低维空间中qi∣jqi∣j与qj∣iqj∣i也是不相等的。

解决了SNE中的不对称问题,得到了一个更为简单的梯度公式,但是Maaten指出,对称SNE的效果只是略微优于原始SNE的效果,依然没有从根本上解决问题。

t distribution解决了展示中的拥挤问题(the crowding problem)。像t分布这样的长尾分布,在处理小样本和异常点时有着非常明显的优势.

总结一下其实就是在SNE的基础上增加了两个改进:一是把SNE变为对称SNE,二是在低维空间中采用了t分布代替原来的高斯分布,高维空间不变。

Supplementary knowledge:

1. what is manifold learning流形学习?

2. what does tsne do? only dimension reduction or help identify clusters.

3. the output of sklearn.manifold.TSNE is 2-dimensional dataframe. how to deal with the output matrix?

4. 如何衡量两个分布之间的相似性? KL divergence...

当然是经典的KL距离。

The KL divergence is a measure of how different one probability distribution from a second. The lower the value of the KL divergence, the closer two distributions are to one another. A KL divergence of 0 implies that the two distributions in question are identical.

5. t distribution VS Gaussian distribution

由于高斯分布的尾部较低,对异常点比较敏感,为了照顾这些异常点,高斯分布的拟合结果偏离了大多数样本所在位置,方差也较大。相比之下,tt分布的尾部较高,对异常点不敏感,保证了其鲁棒性,因此其拟合结果更为合理,较好的捕获了数据的整体特征。

6.arr.ravel() VS arr.flatten() VS arr.reshape(-1)

The current API is that:

  • flatten always returns a copy.
  • ravel returns a view of the original array whenever possible. This isn't visible in the printed output, but if you modify the array returned by ravel, it may modify the entries in the original array. If you modify the entries in an array returned from flatten this will never happen. ravel will often be faster since no memory is copied, but you have to be more careful about modifying the array it returns.
  • reshape((-1,)) gets a view whenever the strides of the array allow it even if that means you don't always get a contiguous array.

t-SNE的更多相关文章

  1. 从SNE到t-SNE再到LargeVis

    http://bindog.github.io/blog/2016/06/04/from-sne-to-tsne-to-largevis/

  2. SNE降维与可视化

    from sklearn import datasets digits = datasets.load_digits(n_class=5) X = digits.data y = digits.tar ...

  3. [转]embedding technic:从SNE到t-SNE再到LargeVis

    http://bindog.github.io/blog/2016/06/04/from-sne-to-tsne-to-largevis/#top

  4. Android学习——windows下搭建NDK_r9环境

    1. NDK(Native Development Kit) 1.1 NDK简介 Android NDK是一套允许开发人员使用本地代码(如C/C++)进行Android APP功能开发的工具,通过这个 ...

  5. 利用Bootstrap快速搭建个人响应式主页(附演示+源码)

    1.前言 我们每个程序员都渴望搭建自己的技术博客平台与他人进行交流分享,但使用别人的博客模板没有创意.做网站后台的开发人员可能了解前端,可是自己写一个不错的前端还是很费事的.幸好我们有Bootstra ...

  6. 自己使用的一个.NET轻量开发结构

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABFCAIAAAAerjlvAAAE2UlEQVR4nO2a3U/bVhiH+bdyPaqpmx

  7. android 性能分析案例

    本章以实际案例分析在android开发中,性能方面的优化和处理.设计到知识点有弱引用,memory monitor,Allocation Tracker和leakcanary插件. 1.测试demo ...

  8. maven工程模块化

    前言 项目的模块化有利于任务分工,后期维护,易扩展,模块还可以独立成服务单独部署等: 创建packaging类型为POM的父项目 我用的maven插件是m2e,相信大部分人在eclipse装的也是m2 ...

  9. flume的使用

    1.flume的安装和配置 1.1 配置java_home,修改/opt/cdh/flume-1.5.0-cdh5.3.6/conf/flume-env.sh文件

  10. ActivityManagerService是如何启动app

    ActivityManagerService是如何启动app 一.      上一篇文章app的启动过程,说明了launcher启动app是通过binber,让ActivityManagerServi ...

随机推荐

  1. JavaSE学习笔记(12)---线程

    JavaSE学习笔记(12)---线程 多线程 并发与并行 并发:指两个或多个事件在同一个时间段内发生. 并行:指两个或多个事件在同一时刻发生(同时发生). 在操作系统中,安装了多个程序,并发指的是在 ...

  2. MySQL8.0远程连接和用户授权相关设置

    文章目录 1.开启MySQL远程连接 2.关闭MySQL远程连接 3.修改防火墙规则,开放端口 4.创建用户以及给用户授权 5.删除用户及权限 1.开启MySQL远程连接 mysql -u root ...

  3. The ADB binary found at ... 虚拟机运行错误

    虚拟机问题,可以说差点扼杀我开发 APP 的乐趣,哼,最后请教了一下辉哥(学长),终于解决 —— 用真机调试.下面是步骤: 首先,检查一下真机连接需要的 SDK 是否安装,未安装,勾选进行安装 接着用 ...

  4. 吴裕雄--天生自然HADOOP操作实验学习笔记:hdfs分布式文件系统安装

    实验目的 复习安装jdk 学习免密码登录 掌握安装配置hdfs集群的方法 掌握hdfs集群的简单使用和检查其工作状态 实验原理 1.hdfs是什么 hadoop安装的第一部分是安装hdfs,hdfs是 ...

  5. C++->10.3.5.从键盘上输入职工的编号,从职工信息文件中查找该职工资料,查找成功时显示职工姓名、电话号码,邮政编码和地址。

    p=getchar(); }  printf("\n"); rewind(in);         //文件流指针移到文件开始位置 p=fgetc(in); while(!feof ...

  6. shelll高级编程【实战】(1)

    shell优势在于处理操作系统底层业务,2000多个命令都是shell的支持. 一键安装,报警脚本,常规业务操作,shell开发更简单快速. 1- 常用操作系统默认shell linux: Bourn ...

  7. ASP.NET Core 2.1 中的 HttpClientFactory (Part 4) 整合Polly实现瞬时故障处理

    原文:https://www.stevejgordon.co.uk/httpclientfactory-using-polly-for-transient-fault-handling发表于:2018 ...

  8. Sql Server2008忘记sa登陆密码

    Sql的sa登陆密码忘记解决方法: 语句执行的前提: 1.系统可以登陆进去(当不记得sa密码的时候,可以使用windows用户验证的方式进行登陆) 2.平时用sa登陆,点了记住密码但是不记得密码是多少 ...

  9. ipa文件信息检查工具

    项目地址:https://github.com/ryjwinner/softwares/raw/master/iOS-checkIPA.jar 项目简介: 针对近期大量iOS app需要签名,但多家签 ...

  10. CSS隐藏元素的五种方法

    1.opacity:0 2.visibility:hidden 3.diaplay:none 4.position:absolute display display属性依照词义真正隐藏元素.将disp ...