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

                    Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

                    Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

                    Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High