I have the following matrix: mymatrix
:
> mymatrix
[,1]
1 111.22
2 222.33
3 333.44
4 444.55
5 555.66
> class(mymatrix)
[1] "matrix"
My Question is: How can I create a list: mylist
from mymatrix
, so I get the following:
> mylist
[[1]]
[,1]
1 111.22
2 222.33
3 333.44
4 444.55
5 555.66
> class(mylist)
[1] "list"
As you can see, when you show them on the console their data look almost the same.
By the way, could you provide the code to create the matrix and the list based on that matrix?
I tried different things to create the matrix that way, including the following code:
# unwanted result
> mymatrix = data.matrix(c(111.22, 222.33, 333.44, 444.55, 555.66))
[,1]
[1,] 111.22
[2,] 222.33
[3,] 333.44
[4,] 444.55
[5,] 555.66
where you can see that the row names are different from the ones on the first matrix.
What I need to do, is just to compare, given a Neural Network
, the nn$net.result
(after training) with the: output$net.result
(after prediction). I know we normally don't need to do that, but for certain reasons I need to do it. My problem here is that their data type are different as you can see below:
> nn = neuralnet(target ~ ., data = ds_training, hidden = 2, err.fct = "sse")
> class(nn$net.result)
[1] "list"
# Neural Network
> output = neuralnet::compute(nn, ds_training)
> class(output$net.result)
[1] "matrix"
Thanks!