91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

資源截圖

代碼片段和文件信息

#
#??tsne.py
#
#?Implementation?of?t-SNE?in?Python.?The?implementation?was?tested?on?Python
#?2.7.10?and?it?requires?a?working?installation?of?NumPy.?The?implementation
#?comes?with?an?example?on?the?MNIST?dataset.?In?order?to?plot?the
#?results?of?this?example?a?working?installation?of?matplotlib?is?required.
#
#?The?example?can?be?run?by?executing:?‘ipython?tsne.py‘
#
#
#??Created?by?Laurens?van?der?Maaten?on?20-12-08.
#??Copyright?(c)?2008?Tilburg?University.?All?rights?reserved.

import?numpy?as?np
import?pylab


def?Hbeta(D=np.array([])?beta=1.0):
????“““
????????Compute?the?perplexity?and?the?P-row?for?a?specific?value?of?the
????????precision?of?a?Gaussian?distribution.
????“““

????#?Compute?P-row?and?corresponding?perplexity
????P?=?np.exp(-D.copy()?*?beta)
????sumP?=?sum(P)
????H?=?np.log(sumP)?+?beta?*?np.sum(D?*?P)?/?sumP
????P?=?P?/?sumP
????return?H?P


def?x2p(X=np.array([])?tol=1e-5?perplexity=30.0):
????“““
????????Performs?a?binary?search?to?get?P-values?in?such?a?way?that?each
????????conditional?Gaussian?has?the?same?perplexity.
????“““

????#?Initialize?some?variables
????print(“Computing?pairwise?distances...“)
????(n?d)?=?X.shape
????sum_X?=?np.sum(np.square(X)?1)
????D?=?np.add(np.add(-2?*?np.dot(X?X.T)?sum_X).T?sum_X)
????P?=?np.zeros((n?n))
????beta?=?np.ones((n?1))
????logU?=?np.log(perplexity)

????#?Loop?over?all?datapoints
????for?i?in?range(n):

????????#?Print?progress
????????if?i?%?500?==?0:
????????????print(“Computing?P-values?for?point?%d?of?%d...“?%?(i?n))

????????#?Compute?the?Gaussian?kernel?and?entropy?for?the?current?precision
????????betamin?=?-np.inf
????????betamax?=?np.inf
????????Di?=?D[i?np.concatenate((np.r_[0:i]?np.r_[i+1:n]))]
????????(H?thisP)?=?Hbeta(Di?beta[i])

????????#?Evaluate?whether?the?perplexity?is?within?tolerance
????????Hdiff?=?H?-?logU
????????tries?=?0
????????while?np.abs(Hdiff)?>?tol?and?tries?
????????????#?If?not?increase?or?decrease?precision
????????????if?Hdiff?>?0:
????????????????betamin?=?beta[i].copy()
????????????????if?betamax?==?np.inf?or?betamax?==?-np.inf:
????????????????????beta[i]?=?beta[i]?*?2.
????????????????else:
????????????????????beta[i]?=?(beta[i]?+?betamax)?/?2.
????????????else:
????????????????betamax?=?beta[i].copy()
????????????????if?betamin?==?np.inf?or?betamin?==?-np.inf:
????????????????????beta[i]?=?beta[i]?/?2.
????????????????else:
????????????????????beta[i]?=?(beta[i]?+?betamin)?/?2.

????????????#?Recompute?the?values
????????????(H?thisP)?=?Hbeta(Di?beta[i])
????????????Hdiff?=?H?-?logU
????????????tries?+=?1

????????#?Set?the?final?row?of?P
????????P[i?np.concatenate((np.r_[0:i]?np.r_[i+1:n]))]?=?thisP

????#?Return?final?P-matrix
????print(“Mean?value?of?sigma:?%f“?%?np.mean(np.sqrt(1?/?beta)))
????return?P


def?pca(X=np.array([])?no_dims=50):
????“““
????????Runs?PCA?on?the?NxD?array?X?in?order?to?reduce?its?dimensionality?to
????????no_dims?dimensions.
????“““

????print(“Preprocessing?the?data?using?P

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-01-09?17:13??tsne_python\
?????文件???????42500??2008-12-30?18:13??tsne_python\mnist2500_labels.txt
?????目錄???????????0??2019-03-18?14:46??__MACOSX\
?????目錄???????????0??2019-03-18?14:46??__MACOSX\tsne_python\
?????文件?????????268??2008-12-30?18:13??__MACOSX\tsne_python\._mnist2500_labels.txt
?????文件????31362500??2008-12-30?18:13??tsne_python\mnist2500_X.txt
?????文件?????????268??2008-12-30?18:13??__MACOSX\tsne_python\._mnist2500_X.txt
?????文件????????5807??2017-12-15?22:27??tsne_python\tsne.py
?????文件?????????549??2017-12-15?22:27??__MACOSX\tsne_python\._tsne.py
?????文件?????????212??2019-01-09?17:13??__MACOSX\._tsne_python

評論

共有 條評論