Circular representations of time. These are useful for graphically representing the periodicity of time or representing time-dependent input behaviour in deep neural networks. This was inspired by @ItsIanLondon's article "Encoding Cyclical Features in 24 Hour Time".
Using npm
:
npm install --save timusoid
Using yarn
:
yarn add timusoid
import moment from 'moment';
import { timusoid } from 'timusoid';
const { sin, cos, tan, progress } = timusoid(
moment('2020-01-04T14:19:03.201Z'),
'yearly', // oneOf(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])
);
sin(); // 0.061703628813687975
cos(); // 0.9980945156603269
tan(); // 0.061821428577699
progress(); // 0.009826679853832305 (%)