Tuesday, March 2, 2021
  • Setup menu at Appearance » Menus and assign menu to Top Bar Navigation
Advertisement
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News
No Result
View All Result
NikolaNews
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News
No Result
View All Result
NikolaNews
No Result
View All Result
Home Data Science

How to make time-data cyclical for prediction?

January 28, 2020
in Data Science
How to make time-data cyclical for prediction?
590
SHARES
3.3k
VIEWS
Share on FacebookShare on Twitter

There are many ways to deal with time-data. Sometimes one can use it as time-series to take possible trends into account. Sometimes this is not possible because time can not be arranged in a sequence. For example, if there are just weekdays (1 to 7) in a dataset over several month. In this case one could use one-hot-encoding. However, considering minutes or seconds of a day one-hot-encoding might lead to high complexity. Another approach is to make time cyclical. This approach leads to a lower dimensionality and (maybe) a better predictive power.

But what does cyclical time mean?

You might also like

Tweaking Algorithmic Filtering to Combat Fake News

Jumpstart your cloud transformation journey with fast object storage

(Part 2 of 4) How to Modernize Enterprise Data and Analytics Platform – by Alaa Mahjoub, M.Sc. Eng.

Cyclical time is a concept that assumes that time is a circle. Sunday 12:00 midnight is the same as Monday 0:00 am. The end of the last second of the previous year is the same as the start of the first second of the next year etc. Whether this approach is appropriate one can prove by cross validation or the correlation with the target feature.

How to make data cyclical?

In many blog-posts it is recommended to use a sine function. For example, for seven weekdays like (blue):

value = sin(2π*time/7)

or from zero to zero over one week (green):

value = sin(2π*time/14)

or two cycles over the week (red):

value = sin(2π*time/3.5)

Let’s take a look at the function “value”:

figure created by wzgrapher

But how many cycles are there over a specific time period? 

It depends on the case – and the data. If there is a solid theory why there must be 2, 4, or 8 cycles; perfect. Nevertheless, one must check how many cycles are appropriate.

Furthermore, it is not clear when the cycle starts. In case of a week on Monday, Sunday, or Saturday…?

A good idea is to shift the start (respectively the end) of the period (week). For example, making Saturday to the first day of the week. (Don’t forget to validate which shift is the best)

Now, let me introduce an alternative approach which sometimes leads to better results than a sine function.

Starting with a three-dimensional function:

cycle = time^2+value^2

solve to “value”:

value = (cycle – time^2)^0.5

Let’s look at “value” by setting cycle equal to one = red, two = blue, three = green:

figure created by wzgrapher

This function has two important features:

1) The diameter is determined by “cycle”

2) It is a circle that the radius is diameter / 2

So, to adjust the function to seven weekdays one must find a diameter of seven:

0 = (cycle – time^2)^0.5 

(because diameter is the width at value = 0)

Now solve it to “cycle”:

cycle = time^2

With respect to radius = diameter / 2 we must set time = (max_time) / 2. Note: (max_time ) / 2 =  radius. For weekdays 7/2:

cycle = radius^2

Additionally, one must shift the function right into – radius to the right:

value_cyc = (radius^2 – (radius – time)^2)^0.5

Now let´s take a look at the function “value_cyc” for seven weekdays 1 to 7 (red). To compare it with the mentioned sine-approach the function (blue)

value_sin = sin(2π*time/14)*3.5

is added:

figure created by wzgrapher

The difference is the slope. The function “value_cyc” starts with a stronger increase which leads to higher values at the start and at the end of the period. This effect makes the outcome around the center of the period similar and differentiates the center even more pronounced from the start and the end – compared to “value_sin”.

Note that making data cyclical is not always a good idea. Be careful if the periods not have the same length (e.g. month-days)!


Credit: Data Science Central By: Frank Raulf

Previous Post

Wise Practitioner – Predictive Analytics Interview Series: Kumaran Ponnambalam at Cisco - Machine Learning Times

Next Post

Survey: What's your cybersecurity strategy?

Related Posts

Tweaking Algorithmic Filtering to Combat Fake News
Data Science

Tweaking Algorithmic Filtering to Combat Fake News

March 2, 2021
Jumpstart your cloud transformation journey with fast object storage
Data Science

Jumpstart your cloud transformation journey with fast object storage

March 2, 2021
(Part 2 of 4) How to Modernize Enterprise Data and Analytics Platform – by Alaa Mahjoub, M.Sc. Eng.
Data Science

(Part 2 of 4) How to Modernize Enterprise Data and Analytics Platform – by Alaa Mahjoub, M.Sc. Eng.

March 1, 2021
Benefits of Data Integration – Data Science Central
Data Science

Benefits of Data Integration – Data Science Central

March 1, 2021
The Bayesian vs frequentist approaches: implications for machine learning – Part two
Data Science

The Bayesian vs frequentist approaches: implications for machine learning – Part two

March 1, 2021
Next Post
Survey: What’s your cybersecurity strategy?

Survey: What's your cybersecurity strategy?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

Plasticity in Deep Learning: Dynamic Adaptations for AI Self-Driving Cars

Plasticity in Deep Learning: Dynamic Adaptations for AI Self-Driving Cars

January 6, 2019
Microsoft, Google Use Artificial Intelligence to Fight Hackers

Microsoft, Google Use Artificial Intelligence to Fight Hackers

January 6, 2019

Categories

  • Artificial Intelligence
  • Big Data
  • Blockchain
  • Crypto News
  • Data Science
  • Digital Marketing
  • Internet Privacy
  • Internet Security
  • Learn to Code
  • Machine Learning
  • Marketing Technology
  • Neural Networks
  • Technology Companies

Don't miss it

Ask the Expert: What’s New in Azure Machine Learning | Ask the Expert
Machine Learning

Ask the Expert: What’s New in Azure Machine Learning | Ask the Expert

March 2, 2021
Can India beat the global AI challenge? Can we avoid huge job extinction here? | by Yogesh Chauhan | Jan, 2021
Neural Networks

Can India beat the global AI challenge? Can we avoid huge job extinction here? | by Yogesh Chauhan | Jan, 2021

March 2, 2021
Singapore eyes more cameras, technology to boost law enforcement
Internet Security

Singapore eyes more cameras, technology to boost law enforcement

March 2, 2021
Why do companies fail to stop breaches despite soaring IT security investment?
Internet Privacy

Why do companies fail to stop breaches despite soaring IT security investment?

March 2, 2021
Tweaking Algorithmic Filtering to Combat Fake News
Data Science

Tweaking Algorithmic Filtering to Combat Fake News

March 2, 2021
Machine Learning Cuts Through the Noise of Quantum Computing
Machine Learning

Machine Learning Cuts Through the Noise of Quantum Computing

March 2, 2021
NikolaNews

NikolaNews.com is an online News Portal which aims to share news about blockchain, AI, Big Data, and Data Privacy and more!

What’s New Here?

  • Ask the Expert: What’s New in Azure Machine Learning | Ask the Expert March 2, 2021
  • Can India beat the global AI challenge? Can we avoid huge job extinction here? | by Yogesh Chauhan | Jan, 2021 March 2, 2021
  • Singapore eyes more cameras, technology to boost law enforcement March 2, 2021
  • Why do companies fail to stop breaches despite soaring IT security investment? March 2, 2021

Subscribe to get more!

© 2019 NikolaNews.com - Global Tech Updates

No Result
View All Result
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News

© 2019 NikolaNews.com - Global Tech Updates