-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAutoencoder_BaseR.R
More file actions
43 lines (38 loc) · 1.19 KB
/
Autoencoder_BaseR.R
File metadata and controls
43 lines (38 loc) · 1.19 KB
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
library(autoencoder)
data=read.csv('Aflow_6.csv', header=TRUE)
summary(data)
data=na.omit(data)
data$Bravias_lattice=NULL
data= data.frame(data)
max = apply(data, 2 , max)
min = apply(data, 2 , min)
scaled = as.data.frame(scale(data, center = min, scale = max - min))
#summary(data)
data1 <-t(scaled)
data1 <-as.matrix ( data1 )
set.seed (7)
n=nrow(data)
train =sample (1:n, 10, FALSE )
fit=autoencode( X.train = data1,#X.train = data1[,train],
X.test = NULL,
nl = 3,
N.hidden = 5,
unit.type = "logistic",
lambda = 1e-5,
beta = 1e-5,
rho = 0.07,
epsilon =0.1,
max.iterations = 100,
optim.method = c("BFGS"),
rel.tol=0.01,
rescale.flag = TRUE,
rescaling.offset = 0.001)
#plot(fit)
summary(fit)
fit$mean.error.training.set
features =predict (fit, X.input=data1, hidden.output =TRUE )
features$X.output
autoencoder_reduced_data=features$X.output
pred=predict (fit , X.input = data1 [,train], hidden.output = FALSE )
pred$X.output[,1]
data1[,1]