Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib64
/
python3.5
/
site-packages
/
sklearn
/
manifold
/
__pycache__
/
File Content:
isomap.cpython-35.pyc
��(X[ � @ s� d Z d d l Z d d l m Z m Z d d l m Z m Z d d l m Z d d l m Z d d l m Z d d l m Z Gd d � d e e � Z d S)zIsomap for manifold learning� N� )� BaseEstimator�TransformerMixin)�NearestNeighbors�kneighbors_graph)�check_array)�graph_shortest_path)� KernelPCA)�KernelCentererc @ s| e Z d Z d Z d d d d d d d d d d � Z d d � Z d d � Z d d d � Z d d d � Z d d � Z d S)�Isomapa� Isomap Embedding Non-linear dimensionality reduction through Isometric Mapping Read more in the :ref:`User Guide <isomap>`. Parameters ---------- n_neighbors : integer number of neighbors to consider for each point. n_components : integer number of coordinates for the manifold eigen_solver : ['auto'|'arpack'|'dense'] 'auto' : Attempt to choose the most efficient solver for the given problem. 'arpack' : Use Arnoldi decomposition to find the eigenvalues and eigenvectors. 'dense' : Use a direct solver (i.e. LAPACK) for the eigenvalue decomposition. tol : float Convergence tolerance passed to arpack or lobpcg. not used if eigen_solver == 'dense'. max_iter : integer Maximum number of iterations for the arpack solver. not used if eigen_solver == 'dense'. path_method : string ['auto'|'FW'|'D'] Method to use in finding shortest path. 'auto' : attempt to choose the best algorithm automatically. 'FW' : Floyd-Warshall algorithm. 'D' : Dijkstra's algorithm. neighbors_algorithm : string ['auto'|'brute'|'kd_tree'|'ball_tree'] Algorithm to use for nearest neighbors search, passed to neighbors.NearestNeighbors instance. n_jobs : int, optional (default = 1) The number of parallel jobs to run. If ``-1``, then the number of jobs is set to the number of CPU cores. Attributes ---------- embedding_ : array-like, shape (n_samples, n_components) Stores the embedding vectors. kernel_pca_ : object `KernelPCA` object used to implement the embedding. training_data_ : array-like, shape (n_samples, n_features) Stores the training data. nbrs_ : sklearn.neighbors.NearestNeighbors instance Stores nearest neighbors instance, including BallTree or KDtree if applicable. dist_matrix_ : array-like, shape (n_samples, n_samples) Stores the geodesic distance matrix of training data. References ---------- .. [1] Tenenbaum, J.B.; De Silva, V.; & Langford, J.C. A global geometric framework for nonlinear dimensionality reduction. Science 290 (5500) � r Zautor N� c C sL | | _ | | _ | | _ | | _ | | _ | | _ | | _ | | _ d S)N)�n_neighbors�n_components�eigen_solver�tol�max_iter�path_method�neighbors_algorithm�n_jobs) �selfr r r r r r r r � r � /isomap.py�__init__Z s zIsomap.__init__c C s t | � } t d | j d | j d | j � | _ | j j | � | j j | _ t d | j d d d | j d | j d | j d | j � | _ t | j | j d d d | j �} t | d | j d d �| _ | j d } | d 9} | j j | � | _ d S)Nr � algorithmr r ZkernelZprecomputedr r r �modeZdistance�methodZdirectedFr g �?g �)r r r r r �nbrs_�fitZ_fit_X�training_data_r r r r r �kernel_pca_r r r �dist_matrix_� fit_transform� embedding_)r �XZkng�Gr r r �_fit_transformf s&