Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Please solve this problem of R studio: No data provided for "dense_3_input". Need data for each key in: ['dense_3_input']

$
0
0

I'm new to R studio. I have a serious problem with the code that I have to solve. I've tried to make a neural network that predicts 1 class using 7 attributes with a dataset that dimension(1259, 8). After I running my code, I checked the following error:

Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: No data provided for "dense_3_input". Need data for each key in: ['dense_3_input']

Unfortunately, I don't know how to solve this problem. If anyone knows how to solve this problem, please advise me.

Here's my code

dev.off()
rm(list=Is())
cat("\f")

library(keras)
df <- read.csv("Model_5_data..csv", header=TRUE)
data<-data.frame(df)
data

str(data)
dim(data)
nrow(data)
ncol(data)

ind <- sample(2, norw(data), replace=TRUE, prob = c(0.7,0.3))


train <- data[ind==1,]
test <- data[ind==2,]

x_train <- subset(train, select=c(1,7)
x_test <- subset(test, select=c(1,7)
y_train <- train$Chl.a
y_test <- test$Chl.a

model <- keras_model_sequential() %>%
   layer_dense(units = 16, activation = "relu", input_shape = c(7)) %>%
   layer_dense(units = 16, activation = "relu") %>%
   layer_dense(units = 1, activation = "relu")
summary(model)

model %>% compile(
   optimizer = "adam", loss="mse"
)

model %>% fit(x_train, y_train, epoch = 100, batch_size = 1)
result <- model%>% evalutate(x_test, y_test)
result

and, here's my dataset sample

    TOC   T.N   T.P Solar.rad.  pH   DO Temp. Chl.a
1   1.0 1.778 0.017      13.52 8.2 12.7   7.0  14.1
2   1.0 1.786 0.019       7.69 8.2 12.8   7.3  14.6
3   1.0 1.718 0.018      19.37 8.1 12.9   7.0  12.8
4   1.1 1.722 0.018      21.73 8.1 12.9   7.4  12.5
5   1.2 1.863 0.020      16.56 8.1 13.0   8.1  12.8
6   1.2 2.107 0.022       3.67 8.1 12.9   8.8  13.4
7   1.2 2.154 0.023      13.54 8.0 12.7   8.2  11.7
...

Thanks for reading my question. I hope you all have a nice day.


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>