backend/sweettweet/services/utils.py
def weighted_mse(yTrue,yPred):
	'''
	Custom mean-squared error that emphasizes the weights for 
	later predictions during multi-step forecasting.
	'''
	ones = K.ones_like(yTrue[0,:]) #a simple vector with ones shaped as (forecast_step,)
	idx = K.cumsum(ones) #similar to a 'range(1,forecast_step + 1)'
	idx = K.reverse(idx, axes = 0) 
	return K.mean((1/idx)*K.square(yTrue-yPred))

	Custom mean-squared error that emphasizes the weights for 
	later predictions during multi-step forecasting.
	
Custom mean-squared error that emphasizes the weights for
later predictions during multi-step forecasting.
Custom mean - squared error that emphasizes the weights for later predictions during multi - step forecasting .
def weighted_mse(yTrue,yPred):
	ones = K.ones_like(yTrue[0,:]) 
	idx = K.cumsum(ones) 
	idx = K.reverse(idx, axes = 0) 
	return K.mean((1/idx)*K.square(yTrue-yPred))
def weighted_mse ( yTrue , yPred ) : ones = K . ones_like ( yTrue [ 0 , : ] ) idx = K . cumsum ( ones ) idx = K . reverse ( idx , axes = 0 ) return K . mean ( ( 1 / idx ) * K . square ( yTrue - yPred ) )
Custom mean-squared error that emphasizes the weights for
later predictions during multi-step forecasting.
Custom mean - squared error that emphasizes the weights for later predictions during multi - step forecasting .
'''
	Custom mean-squared error that emphasizes the weights for 
	later predictions during multi-step forecasting.
	''' #a simple vector with ones shaped as (forecast_step,) #similar to a 'range(1,forecast_step + 1)'
yTrue
yPred