Can I use an array as a model feature?Can we use a model that overfits?Multi-class text classification with LSTM in KerasWhat ML/DL approach better suits this problem?Can I use a regression machine learning model for predicting a vector with multiple values?Right Way to Input Text Data in Keras Auto EncoderMulti Label Classification on Data Columns in TablesFind words related to high or low scoreKeras- LSTM answers different sizeArchitecture help for multivariate input and output LSTM modelsUnderstanding LSTM structure

Software described as 香ばしい

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?

Happy pi day, everyone!

Did Ender ever learn that he killed Stilson and/or Bonzo?

Life insurance that covers only simultaneous/dual deaths

I need to drive a 7/16" nut but am unsure how to use the socket I bought for my screwdriver

DD4T webapp using discovery service gets 'invalid_grant'

My adviser wants to be the first author

Professor being mistaken for a grad student

Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements

Fantasy series where a Vietnam vet is transported to a fantasy land

What has been your most complicated TikZ drawing?

Make a transparent 448*448 image

How to simplify this time periods definition interface?

Why did it take so long to abandon sail after steamships were demonstrated?

Official degrees of earth’s rotation per day

Good allowance savings plan?

Brexit - No Deal Rejection

Is it possible to upcast ritual spells?

Python: Check if string and its substring are existing in the same list

Who is our nearest planetary neighbor, on average?

It's a yearly task, alright

Why doesn't the EU now just force the UK to choose between referendum and no-deal?

Would it take an action or something similar to activate the blindsight property of a Dragon Mask?



Can I use an array as a model feature?


Can we use a model that overfits?Multi-class text classification with LSTM in KerasWhat ML/DL approach better suits this problem?Can I use a regression machine learning model for predicting a vector with multiple values?Right Way to Input Text Data in Keras Auto EncoderMulti Label Classification on Data Columns in TablesFind words related to high or low scoreKeras- LSTM answers different sizeArchitecture help for multivariate input and output LSTM modelsUnderstanding LSTM structure













0












$begingroup$


Problem

I have data that includes multiple different text inputs as well as floats, categories, etc. Therefore I need to pass several different data types as features, including text which is an int array when tokenized.



Question

Say I tokenize the several text inputs; can I pass the tokenized text array as a feature alongside my floats and categories? If not, how is this done?



Background

When I've done NLP models, my code looks similar to this:



...
tokenizer = Tokenizer(num_words=max_features)
tokenizer.fit_on_texts(df['Stem'])
list_tokenized_train = tokenizer.texts_to_sequences(df['Stem'])
X_train = pad_sequences(list_tokenized_train, maxlen=10)
y_train = df['TotalPValue']
...


So, the text input becomes an array of int tokens padded with zeroes, e.g. [0 0 0 0 0 0 0 1 12 52].



This is not enough to solve my problem. I want to instead use multiple tokenized string inputs and floats as features. I want to first tokenize and pad each text input like above and put them in the same input array, like this: X_train = [[0 0 0 0 0 0 0 1 12 52], [0 0 0 0 0 0 0 42 12 23], 0.0425672].



I want to then start my model like this:



model = Sequential() 
model.add(Embedding(max_features, embedding_vector_length, input_length=3))


Will it work if implemented like this?



My attempts

I searched for a while but couldn't find anyone else doing it like this. Surprising to me that I couldn't find anything since it seems like a basic problem.



Just wanted to know if I have the right idea, since - as a beginner - implementation will cost a lot of time if this isn't the right way of doing it. Thanks so much for the insight!










share|improve this question









$endgroup$
















    0












    $begingroup$


    Problem

    I have data that includes multiple different text inputs as well as floats, categories, etc. Therefore I need to pass several different data types as features, including text which is an int array when tokenized.



    Question

    Say I tokenize the several text inputs; can I pass the tokenized text array as a feature alongside my floats and categories? If not, how is this done?



    Background

    When I've done NLP models, my code looks similar to this:



    ...
    tokenizer = Tokenizer(num_words=max_features)
    tokenizer.fit_on_texts(df['Stem'])
    list_tokenized_train = tokenizer.texts_to_sequences(df['Stem'])
    X_train = pad_sequences(list_tokenized_train, maxlen=10)
    y_train = df['TotalPValue']
    ...


    So, the text input becomes an array of int tokens padded with zeroes, e.g. [0 0 0 0 0 0 0 1 12 52].



    This is not enough to solve my problem. I want to instead use multiple tokenized string inputs and floats as features. I want to first tokenize and pad each text input like above and put them in the same input array, like this: X_train = [[0 0 0 0 0 0 0 1 12 52], [0 0 0 0 0 0 0 42 12 23], 0.0425672].



    I want to then start my model like this:



    model = Sequential() 
    model.add(Embedding(max_features, embedding_vector_length, input_length=3))


    Will it work if implemented like this?



    My attempts

    I searched for a while but couldn't find anyone else doing it like this. Surprising to me that I couldn't find anything since it seems like a basic problem.



    Just wanted to know if I have the right idea, since - as a beginner - implementation will cost a lot of time if this isn't the right way of doing it. Thanks so much for the insight!










    share|improve this question









    $endgroup$














      0












      0








      0





      $begingroup$


      Problem

      I have data that includes multiple different text inputs as well as floats, categories, etc. Therefore I need to pass several different data types as features, including text which is an int array when tokenized.



      Question

      Say I tokenize the several text inputs; can I pass the tokenized text array as a feature alongside my floats and categories? If not, how is this done?



      Background

      When I've done NLP models, my code looks similar to this:



      ...
      tokenizer = Tokenizer(num_words=max_features)
      tokenizer.fit_on_texts(df['Stem'])
      list_tokenized_train = tokenizer.texts_to_sequences(df['Stem'])
      X_train = pad_sequences(list_tokenized_train, maxlen=10)
      y_train = df['TotalPValue']
      ...


      So, the text input becomes an array of int tokens padded with zeroes, e.g. [0 0 0 0 0 0 0 1 12 52].



      This is not enough to solve my problem. I want to instead use multiple tokenized string inputs and floats as features. I want to first tokenize and pad each text input like above and put them in the same input array, like this: X_train = [[0 0 0 0 0 0 0 1 12 52], [0 0 0 0 0 0 0 42 12 23], 0.0425672].



      I want to then start my model like this:



      model = Sequential() 
      model.add(Embedding(max_features, embedding_vector_length, input_length=3))


      Will it work if implemented like this?



      My attempts

      I searched for a while but couldn't find anyone else doing it like this. Surprising to me that I couldn't find anything since it seems like a basic problem.



      Just wanted to know if I have the right idea, since - as a beginner - implementation will cost a lot of time if this isn't the right way of doing it. Thanks so much for the insight!










      share|improve this question









      $endgroup$




      Problem

      I have data that includes multiple different text inputs as well as floats, categories, etc. Therefore I need to pass several different data types as features, including text which is an int array when tokenized.



      Question

      Say I tokenize the several text inputs; can I pass the tokenized text array as a feature alongside my floats and categories? If not, how is this done?



      Background

      When I've done NLP models, my code looks similar to this:



      ...
      tokenizer = Tokenizer(num_words=max_features)
      tokenizer.fit_on_texts(df['Stem'])
      list_tokenized_train = tokenizer.texts_to_sequences(df['Stem'])
      X_train = pad_sequences(list_tokenized_train, maxlen=10)
      y_train = df['TotalPValue']
      ...


      So, the text input becomes an array of int tokens padded with zeroes, e.g. [0 0 0 0 0 0 0 1 12 52].



      This is not enough to solve my problem. I want to instead use multiple tokenized string inputs and floats as features. I want to first tokenize and pad each text input like above and put them in the same input array, like this: X_train = [[0 0 0 0 0 0 0 1 12 52], [0 0 0 0 0 0 0 42 12 23], 0.0425672].



      I want to then start my model like this:



      model = Sequential() 
      model.add(Embedding(max_features, embedding_vector_length, input_length=3))


      Will it work if implemented like this?



      My attempts

      I searched for a while but couldn't find anyone else doing it like this. Surprising to me that I couldn't find anything since it seems like a basic problem.



      Just wanted to know if I have the right idea, since - as a beginner - implementation will cost a lot of time if this isn't the right way of doing it. Thanks so much for the insight!







      machine-learning keras






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 18 hours ago









      Carl MolnarCarl Molnar

      112




      112




















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Found a fantastic answer here that avoids high-level black box libraries.



          Essentially, numerical floats are categorized into bins based on boundary values which are determined by their distribution. Text tokens are hashed with column ID, and then concatenated with other columns' hashed tokens via an interaction array. All hashed tokens, whether or not they have in interaction, are fed as inputs into the model.



          That's the gist of it.






          share|improve this answer











          $endgroup$












            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "557"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f47312%2fcan-i-use-an-array-as-a-model-feature%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            Found a fantastic answer here that avoids high-level black box libraries.



            Essentially, numerical floats are categorized into bins based on boundary values which are determined by their distribution. Text tokens are hashed with column ID, and then concatenated with other columns' hashed tokens via an interaction array. All hashed tokens, whether or not they have in interaction, are fed as inputs into the model.



            That's the gist of it.






            share|improve this answer











            $endgroup$

















              0












              $begingroup$

              Found a fantastic answer here that avoids high-level black box libraries.



              Essentially, numerical floats are categorized into bins based on boundary values which are determined by their distribution. Text tokens are hashed with column ID, and then concatenated with other columns' hashed tokens via an interaction array. All hashed tokens, whether or not they have in interaction, are fed as inputs into the model.



              That's the gist of it.






              share|improve this answer











              $endgroup$















                0












                0








                0





                $begingroup$

                Found a fantastic answer here that avoids high-level black box libraries.



                Essentially, numerical floats are categorized into bins based on boundary values which are determined by their distribution. Text tokens are hashed with column ID, and then concatenated with other columns' hashed tokens via an interaction array. All hashed tokens, whether or not they have in interaction, are fed as inputs into the model.



                That's the gist of it.






                share|improve this answer











                $endgroup$



                Found a fantastic answer here that avoids high-level black box libraries.



                Essentially, numerical floats are categorized into bins based on boundary values which are determined by their distribution. Text tokens are hashed with column ID, and then concatenated with other columns' hashed tokens via an interaction array. All hashed tokens, whether or not they have in interaction, are fed as inputs into the model.



                That's the gist of it.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 15 hours ago

























                answered 16 hours ago









                Carl MolnarCarl Molnar

                112




                112



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Data Science Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f47312%2fcan-i-use-an-array-as-a-model-feature%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Marja Vauras Lähteet | Aiheesta muualla | NavigointivalikkoMarja Vauras Turun yliopiston tutkimusportaalissaInfobox OKSuomalaisen Tiedeakatemian varsinaiset jäsenetKasvatustieteiden tiedekunnan dekaanit ja muu johtoMarja VaurasKoulutusvienti on kestävyys- ja ketteryyslaji (2.5.2017)laajentamallaWorldCat Identities0000 0001 0855 9405n86069603utb201588738523620927

                    Which is better: GPT or RelGAN for text generation?2019 Community Moderator ElectionWhat is the difference between TextGAN and LM for text generation?GANs (generative adversarial networks) possible for text as well?Generator loss not decreasing- text to image synthesisChoosing a right algorithm for template-based text generationHow should I format input and output for text generation with LSTMsGumbel Softmax vs Vanilla Softmax for GAN trainingWhich neural network to choose for classification from text/speech?NLP text autoencoder that generates text in poetic meterWhat is the interpretation of the expectation notation in the GAN formulation?What is the difference between TextGAN and LM for text generation?How to prepare the data for text generation task

                    Is this part of the description of the Archfey warlock's Misty Escape feature redundant?When is entropic ward considered “used”?How does the reaction timing work for Wrath of the Storm? Can it potentially prevent the damage from the triggering attack?Does the Dark Arts Archlich warlock patrons's Arcane Invisibility activate every time you cast a level 1+ spell?When attacking while invisible, when exactly does invisibility break?Can I cast Hellish Rebuke on my turn?Do I have to “pre-cast” a reaction spell in order for it to be triggered?What happens if a Player Misty Escapes into an Invisible CreatureCan a reaction interrupt multiattack?Does the Fiend-patron warlock's Hurl Through Hell feature dispel effects that require the target to be on the same plane as the caster?What are you allowed to do while using the Warlock's Eldritch Master feature?