File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ import random
2+ from math import floor
3+ import numpy as np
4+
5+
6+ def shuffleArray (array : list ):
7+ arrayCopy = array .copy ()
8+ random .shuffle (arrayCopy )
9+
10+ return arrayCopy
11+
12+
13+ def splitArr (array : list , ratio : float ):
14+ n = len (array )
15+
16+ m = floor (n * ratio )
17+
18+ firstPart : list = array [0 : m ]
19+ secondPart : list = array [m : n ]
20+
21+ return [firstPart , secondPart ]
22+
23+
24+ def one_hot_encode (num , size ):
25+ vector = np .array ([0 ]* size )
26+ vector [num - 1 ] = 1
27+
28+ return vector .reshape (size , 1 )
29+
30+
31+ def get_time_required (start , end , epochs ):
32+ seconds = (end - start ) * epochs
33+
34+ minutes = seconds // 60
35+ seconds = seconds % 60
36+
37+ hours = minutes // 60
38+ minutes = minutes % 60
39+ return f"Estimated Training Time: { hours } hrs::{ minutes } min::{ round (seconds , 4 )} sec"
You can’t perform that action at this time.
0 commit comments