You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Sujit Pal <su...@gmail.com> on 2016/01/07 20:25:05 UTC

Re: Date Time Regression as Feature

Hi Jorge,

Maybe extract things like dd, mm, day of week, time of day from the
datetime string and use them as features?

-sujit


On Thu, Jan 7, 2016 at 11:09 AM, Jorge Machado <jo...@hotmail.com>
wrote:

> Hello all,
>
> I'm new to machine learning. I'm trying to predict some electric usage
> with a decision  Free
> The data is :
> 2015-12-10-10:00, 1200
> 2015-12-11-10:00, 1150
>
> My question is : What is the best way to turn date and time into feature
> on my Vector ?
>
> Something like this :  Vector (1200, [2015,12,10,10,10] )?
> I could not fine any example with value prediction where features had
> dates in it.
>
> Thanks
>
> Jorge Machado
>
> Jorge Machado
> Jorge@jmachado.me
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>

Re: Date Time Regression as Feature

Posted by Yanbo Liang <yb...@gmail.com>.
First extracting year, month, day, time from the datetime.
Then you should decide which variables can be treated as category features
such as year/month/day and encode them to boolean form using OneHotEncoder.
At last using VectorAssembler to assemble the encoded output vector and the
other raw input into the features which can be feed into model trainer.

OneHotEncoder and VectorAssembler are feature transformers provided by
Spark ML, you can refer
https://spark.apache.org/docs/latest/ml-features.html

Thanks
Yanbo

2016-01-08 7:52 GMT+08:00 Annabel Melongo <melongo_annabel@yahoo.com.invalid
>:

> Or he can also transform the whole date into a string
>
>
> On Thursday, January 7, 2016 2:25 PM, Sujit Pal <su...@gmail.com>
> wrote:
>
>
> Hi Jorge,
>
> Maybe extract things like dd, mm, day of week, time of day from the
> datetime string and use them as features?
>
> -sujit
>
>
> On Thu, Jan 7, 2016 at 11:09 AM, Jorge Machado <
> jorge.w.machado@hotmail.com> wrote:
>
> Hello all,
>
> I'm new to machine learning. I'm trying to predict some electric usage
> with a decision  Free
> The data is :
> 2015-12-10-10:00, 1200
> 2015-12-11-10:00, 1150
>
> My question is : What is the best way to turn date and time into feature
> on my Vector ?
>
> Something like this :  Vector (1200, [2015,12,10,10,10] )?
> I could not fine any example with value prediction where features had
> dates in it.
>
> Thanks
>
> Jorge Machado
>
> Jorge Machado
> Jorge@jmachado.me
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>
>
>
>

Re: Date Time Regression as Feature

Posted by Annabel Melongo <me...@yahoo.com.INVALID>.
Or he can also transform the whole date into a string 

    On Thursday, January 7, 2016 2:25 PM, Sujit Pal <su...@gmail.com> wrote:
 

 Hi Jorge,
Maybe extract things like dd, mm, day of week, time of day from the datetime string and use them as features?
-sujit

On Thu, Jan 7, 2016 at 11:09 AM, Jorge Machado <jo...@hotmail.com> wrote:

Hello all,

I'm new to machine learning. I'm trying to predict some electric usage  with a decision  Free
The data is :
2015-12-10-10:00, 1200
2015-12-11-10:00, 1150

My question is : What is the best way to turn date and time into feature on my Vector ?

Something like this :  Vector (1200, [2015,12,10,10,10] )?
I could not fine any example with value prediction where features had dates in it.

Thanks

Jorge Machado

Jorge Machado
Jorge@jmachado.me


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org