planning icon indicating copy to clipboard operation
planning copied to clipboard

supporting list input for keras

Open systats opened this issue 4 years ago • 2 comments

Is there a way to create a recipe for list of matrices? Like inputing a DTM and Image Pixels for a custom keras model at the same time would be great. Also is there a way to incorporate a keras tokenizer into a recipe?

Thanks for all your work! And I would be delighted to help on that end if possible.

systats avatar Apr 25 '20 15:04 systats

Is there a way to create a recipe for list of matrices?

at the moment only matrices and data.frames are supported as input in recipes.

Also is there a way to incorporate a keras tokenizer into a recipe?

You should take a look at textrecipes. While it doesn't have direct support for keras (yet) you can pass any tokenization function to "step_tokenize()'

library(recipes)
library(textrecipes)
library(keras)
rec <- recipe(~ text, data = your_data) %>%
  step_tokenize(text, custom_token = text_to_word_sequence) %>%
  step_tokenfilter(text, max_tokens = 100) %>%
  step_tfidf(text) %>%
  prep()

EmilHvitfeldt avatar Apr 25 '20 17:04 EmilHvitfeldt

We've also been talking about how to use sparse matrices inside of recipes. I don't think that we'll support passing a sparse matrix to recipe() (because of their limitations) but use them internally to handle larger data sets.

That's a "forward looking statement" so don't get too excited yet.

topepo avatar Apr 26 '20 18:04 topepo