Skip to content
Snippets Groups Projects
Commit 2adb7845 authored by xiayyu's avatar xiayyu
Browse files

add lle

parent 0c1e5c7a
Branches
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 12 14:04:12 2018
@author: xiayu
"""
import numpy as np
from sklearn import manifold
from pkgs.mapping import getmapped
with np.load('../data/stddata.npz') as d:
phi = d['data']
with np.load('../data/sifteredindex.npz') as d:
data = d['data']
dt1 = np.dtype([('mapped', 'O')])
dt2 = np.dtype([('map', 'O')])
a1 = np.array([],dtype=dt1)
a2 = np.array([],dtype=dt2)
for i in range(0,7):
X_ind = data[i]['index']
lle = manifold.LocallyLinearEmbedding(n_neighbors=30, n_components=12)
phi_s = getmapped(phi, X_ind, lle)
b1 = np.array([(phi_s,)],dtype=dt1)
a1 = np.append(a1,b1)
b2 = np.array([(lle,)],dtype=dt2)
a2 = np.append(a2,b2)
np.savez_compressed('../data/sifteredllemappeddata',data=a1)
np.savez_compressed('../data/sifteredllemaps',data=a2)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment