import time
from ...config import Config
from ...structure import Conv, Layer
from ...utils import LearningRateScheduler

def scoreTime(M, epochs, X_train, Y_train):
    # more time smaller score
    start_time = time.time()
    _, _ = M.gradient_descent(X_train, Y_train, 2, LearningRateScheduler(LearningRateScheduler.CONSTANT, 0.1) , True)
    end_time = time.time()
    time_difference_in_seconds = end_time - start_time
    grade = 1.0/(Config.TIME_EFFICIENCY_WEIGHT * time_difference_in_seconds + 1.0)
    return grade

def scoreCountWeights(M, epochs, X_train, Y_train):
    # more weights smaller score
    counter = M.get_parametr_count()
    # Use configurable weight instead of hardcoded 0.001
    grade = 1.0/(float(counter) * Config.WEIGHT_COUNT_WEIGHT + 1.0)
    return grade