soft angle
soft angle

Reputation: 31

How can I calculate running time for model

I used Extreme Learning Machine (ELM) algorithm. And I want to calculate training time..my problem is I got training time 0:00:00 and I a doubt this result is not correct

My code:

import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from scipy.linalg import pinv2
 import time

#import dataset
train = pd.read_excel('INRStrai.xlsx')
test = pd.read_excel('INRStes.xlsx')

#scaler data
scaler = MinMaxScaler()
X_train = scaler.fit_transform(train.values[:,1:])
y_train = scaler.fit_transform(train.values[:,:1])
X_test = scaler.fit_transform(test.values[:,1:])
y_test = scaler.fit_transform(test.values[:,:1])

#input size
input_size = X_train.shape[1]

#Number of neurons
hidden_size = 300

#weights & biases
input_weights = np.random.normal(size=[input_size,hidden_size])
biases = np.random.normal(size=[hidden_size])

#Activation Function
def relu(x):
   return np.maximum(x, 0, x)

#Calculations
def hidden_nodes(X):
    G = np.dot(X, input_weights)
    G = G + biases
    H = relu(G)

from datetime import timedelta
start_time = time.time()

# Perform lots of computations.
elapsed_time_secs = time.time() - start_time

msg = "Execution took: %s secs (Wall clock time)" % timedelta(seconds=round(elapsed_time_secs))
print(msg)

I got the execution time: 0:00:00 secs ,I a doubt execution time is not correct, why I got this result for time

Upvotes: 0

Views: 4034

Answers (1)

acrobat
acrobat

Reputation: 917

I've used the following to calculate running time:

from datetime import datetime as dt

start = dt.now()
# process stuff
running_secs = (dt.now() - start).seconds

Upvotes: 1

Related Questions