-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_demo.py
52 lines (35 loc) · 1.13 KB
/
main_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
#import h5py
import matplotlib.pyplot as plt
import scipy
import scipy.io as sio
import sklearn
import pandas as pd
import umap
import numpy as np
from mda import *
# data = sio.loadmat('D:/MDA_visualization/Codes_For_Hongyi_MDA/Codes_For_Hongyi_MDA/mda/mda/data_MDA.mat')
# Y = data['Y']
# trainingFeatures = data['trainingFeatures']
#print(Y.shape)
#print(trainingFeatures.shape)
trainingFeatures = np.load('SR/feature4_test_pca.npy')
Y = np.load('SR/y_test.npy')
Y = Y.reshape(Y.shape[0],-1)
Y_pred = np.load('SR/y_test_pred_trained.npy')
Y_pred = Y_pred.reshape(Y_pred.shape[0],-1)
print(Y.shape)
print(trainingFeatures.shape)
X=trainingFeatures
FS = 16
neighborNum = 5
#clusterIdx = discoverManifold(Y, neighborNum)
clusterIdx_pred = discoverManifold(Y, neighborNum)
Yreg = mda(X,clusterIdx_pred)
embedding_df = pd.DataFrame(Yreg)
embedding_df.to_csv('embeddingMDA_P.csv', index=False)
clusterIdx_pred_df = pd.DataFrame(clusterIdx_pred)
clusterIdx_pred_df.to_csv('clusterIdx_pred_P.csv', index=False)
# Visualize the data using a scatter plot
plt.scatter(Yreg[:, 0], Yreg[:, 1], c=clusterIdx_pred)
plt.show()