-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autoencoder step #35
Comments
There is an autoencoder in |
(CRAN)[https://cran.r-project.org/web/packages/policies.html#Source-packages] has
There are a few that are also on CRAN; most are really slow and not actively developed. |
There might be a lot of work to make canned autoencoders though, e.g. DNNAutoencoder, LSTMAutoencoder, etc. I would think that users will do this themselves since it requires a lot of customization. |
When I used autoencoders I always found it really hard to get them to converge and not over-fit, it takes a lot of tinkering with the internals. Mxnet is probably the way to go, conceptually I really like the one in pcaMethods, because it has some really nice features which are not straightforward to implement. http://mxnet.io/tutorials/r/classifyRealImageWithPretrainedModel.html |
@gdkrmr Which function in @terrytangyuan This issue has lists
as a feature. Do you know if there is any progress on this? |
I am not sure. It's been there for a while. @thirdwing might have a better idea. |
@topepo |
> library(pcaMethods)
>
> set.seed(1)
> in_train <- sample(1:150, 100)
> tr <- iris[ in_train, -5]
> te <- iris[-in_train, -5]
>
> nlpca_obj <- pca(tr, nPcs=2, method="nlpca", maxSteps=500, verbose = FALSE)
>
> head(fitted(nlpca_obj, tr))
[,1] [,2] [,3] [,4]
[1,] 5.050568 3.467380 1.425588 0.2393514
[2,] 5.795947 2.718434 4.372717 1.4699193
[3,] 5.588153 2.669189 4.398656 1.5534895
[4,] 6.368556 2.895570 4.956616 1.6964933
[5,] 4.718083 3.082611 1.499397 0.2413291
[6,] 7.356033 3.224832 5.930248 2.0810760
>
> fitted(nlpca_obj, te)
Error in .Method(..., deparse.level = deparse.level) :
number of columns of matrices must match (see arg 2) I'll submit an issue to that package's repo. |
@terrytangyuan There is a blog on building autoencoder in R using MXNet in Japanese. I have invited the author to write a vignette. |
I wrote a, still very simple, autoencoder in |
I looked at it and I'll run some examples later today. A few things that I thought of for the code:
model <- keras_model_sequential()
model %>%
layer_dense(
units = x$hidden,
activation = x$act_function,
input_shape = ncol(pred_data)
) %>%
layer_dropout(rate = x$dropout,
seed = sample.int(1000, 1)) %>%
layer_dense(
units = ncol(pred_data),
activation = 'sigmoid'
) %>%
keras::compile(
loss = "mean_squared_error",
optimizer = optimizer_rmsprop(),
metrics = "mean_squared_error"
)
K <- keras::backend()
K$clear_session()
# or `tf` equivalent
|
You will also have to serialize the resulting model so that it can be used in a new R/tf session. See rstudio/keras3#86. |
super, thanks for the advice, I will look into it. |
further discussion here: gdkrmr/dimRed#12 |
autoencoders are in master now -> closing |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue. |
dimRed
might solve this before I doThe text was updated successfully, but these errors were encountered: