Skip to content

Commit 2d184db

Browse files
committed
Use Utils to compute estimated time
1 parent 6be0238 commit 2d184db

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

nicenet/NeuralNetwork.py

+4-17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import typing
1111
from .Types import T_Feature_Array, T_Target_Array, T_Output_Array, T_Data_Sample, T_Dataset
1212
from tqdm import tqdm
13+
from . import Utils
1314

1415
np.set_printoptions(precision=20)
1516

@@ -255,6 +256,7 @@ def Train(self, Dataset: T_Dataset, size, epochs=5000, logging=False, epoch_logg
255256
self.all_errors = list()
256257
self.epochs = epochs
257258

259+
# Show progress bar if epoch_logging is False
258260
range_object = range(epochs)
259261
if not epoch_logging:
260262
range_object = tqdm(range(epochs), desc="Training...")
@@ -266,23 +268,8 @@ def Train(self, Dataset: T_Dataset, size, epochs=5000, logging=False, epoch_logg
266268
start = time.time()
267269
elif epoch == 1:
268270
end = time.time()
269-
seconds = (end - start) * epochs
270-
271-
minutes = seconds // 60
272-
seconds = seconds % 60
273-
274-
hours = minutes // 60
275-
minutes = minutes % 60
276-
print(
277-
"Estimated Training Time: ",
278-
hours,
279-
"hrs ",
280-
minutes,
281-
"min ",
282-
seconds,
283-
"sec",
284-
sep="",
285-
)
271+
estimated_time = Utils.get_time_required(start, end, epochs)
272+
print(estimated_time)
286273

287274
correct = 0
288275
for i in range(size):

0 commit comments

Comments
 (0)