Date transformation for KNN2019 Community Moderator ElectionDate transformation for KNN to get distanceWhat are some easy to learn machine-learning applications?How to appropriately set weights for weighted KNNLearn and sample from a generative model with 2000 boolean featuresDistance measure for ternary featureWhen would one use Manhattan distance as opposite to Euclidean distance?Extract and normalize date from string for the proper text miningHow does sklearn KNeighborsClassifier compute class probabilites?advice on distance metric for knn w/image recognitionTime Series prediction for uneven data with some data providedMachine learning or NLP approach to convert string about month ,year into dates

Where would I need my direct neural interface to be implanted?

Two tailed t test for two companies' monthly profits

Is it possible for a PC to dismember a humanoid?

One verb to replace 'be a member of' a club

Bullying boss launched a smear campaign and made me unemployable

Check for characters in a string being unique

How to add frame around section using titlesec?

How much mains leakage does an Ethernet connection to a PC induce, and what is the operating leakage path?

How badly should I try to prevent a user from XSSing themselves?

Placement of More Information/Help Icon button for Radio Buttons

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

How do I gain back my faith in my PhD degree?

How can a day be exactly 24 hours long?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Can I set a Ready action to trigger when literally anything happens?

Is it a bad idea to plug the other end of ESD strap to wall ground?

files created then deleted at every second in tmp directory

How could indestructible materials be used in power generation?

Is it possible to create a QR code using text?

How would I stat a creature to be immune to everything but the Magic Missile spell? (just for fun)

What is the opposite of "eschatology"?

What is a Samsaran Word™?

What's the meaning of "Sollensaussagen"?

How can saying a song's name be a copyright violation?



Date transformation for KNN



2019 Community Moderator ElectionDate transformation for KNN to get distanceWhat are some easy to learn machine-learning applications?How to appropriately set weights for weighted KNNLearn and sample from a generative model with 2000 boolean featuresDistance measure for ternary featureWhen would one use Manhattan distance as opposite to Euclidean distance?Extract and normalize date from string for the proper text miningHow does sklearn KNeighborsClassifier compute class probabilites?advice on distance metric for knn w/image recognitionTime Series prediction for uneven data with some data providedMachine learning or NLP approach to convert string about month ,year into dates










0












$begingroup$


I have data set with date features like 01/01/2019 and I would like to use KNN. However, I cannot find a good transformation for dates that has a meaningful distance result for the last feature.



For example:



f1 | 1 | 2 | 3 | 4 | 01/01/2019



f2 | 10 | 3 | 12 | 1 | 14/01/2019



Does anyone have any recommendations?










share|improve this question











$endgroup$
















    0












    $begingroup$


    I have data set with date features like 01/01/2019 and I would like to use KNN. However, I cannot find a good transformation for dates that has a meaningful distance result for the last feature.



    For example:



    f1 | 1 | 2 | 3 | 4 | 01/01/2019



    f2 | 10 | 3 | 12 | 1 | 14/01/2019



    Does anyone have any recommendations?










    share|improve this question











    $endgroup$














      0












      0








      0





      $begingroup$


      I have data set with date features like 01/01/2019 and I would like to use KNN. However, I cannot find a good transformation for dates that has a meaningful distance result for the last feature.



      For example:



      f1 | 1 | 2 | 3 | 4 | 01/01/2019



      f2 | 10 | 3 | 12 | 1 | 14/01/2019



      Does anyone have any recommendations?










      share|improve this question











      $endgroup$




      I have data set with date features like 01/01/2019 and I would like to use KNN. However, I cannot find a good transformation for dates that has a meaningful distance result for the last feature.



      For example:



      f1 | 1 | 2 | 3 | 4 | 01/01/2019



      f2 | 10 | 3 | 12 | 1 | 14/01/2019



      Does anyone have any recommendations?







      machine-learning data distance k-nn






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 29 at 20:51









      Ethan

      643425




      643425










      asked Mar 29 at 19:18









      MappMapp

      143




      143




















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Find the time difference in an appropriate granularity(/ies):



          daysDiffFeature = diffInDays(dateCol)
          hoursDiffFeature = diffInHours(dateCol)


          Then you can use whatever distance based metrics/calculations are required in your algorithsm






          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%2f48234%2fdate-transformation-for-knn%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$

            Find the time difference in an appropriate granularity(/ies):



            daysDiffFeature = diffInDays(dateCol)
            hoursDiffFeature = diffInHours(dateCol)


            Then you can use whatever distance based metrics/calculations are required in your algorithsm






            share|improve this answer









            $endgroup$

















              0












              $begingroup$

              Find the time difference in an appropriate granularity(/ies):



              daysDiffFeature = diffInDays(dateCol)
              hoursDiffFeature = diffInHours(dateCol)


              Then you can use whatever distance based metrics/calculations are required in your algorithsm






              share|improve this answer









              $endgroup$















                0












                0








                0





                $begingroup$

                Find the time difference in an appropriate granularity(/ies):



                daysDiffFeature = diffInDays(dateCol)
                hoursDiffFeature = diffInHours(dateCol)


                Then you can use whatever distance based metrics/calculations are required in your algorithsm






                share|improve this answer









                $endgroup$



                Find the time difference in an appropriate granularity(/ies):



                daysDiffFeature = diffInDays(dateCol)
                hoursDiffFeature = diffInHours(dateCol)


                Then you can use whatever distance based metrics/calculations are required in your algorithsm







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 29 at 22:13









                javadbajavadba

                1115




                1115



























                    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%2f48234%2fdate-transformation-for-knn%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

                    Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

                    Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?