class_docstr: Linear time regression fun and some not so linear fun.
  A modular model that models classic time-series components
      * trend
      * seasonality
      * auto-regression (as AR-Net)
      * covariates (as AR-Net)
      * apriori regressors
      * events and holidays
  by using Neural Network components.
  The Auto-regression and covariate components can be configured as a deeper network (AR-Net).
class_docstr_tok: ["Linear","time","regression","fun","and","some","not","so","linear","fun",".","A","modular","model","that","models","classic","time-series","components","*","trend","*","seasonality","*","auto-regression","(","as","AR-Net",")","*","covariates","(","as","AR-Net",")","*","apriori","regressors","*","events","and","holidays","by","using","Neural","Network","components",".","The","Auto-regression","and","covariate","components","can","be","configured","as","a","deeper","network","(","AR-Net",")","."]
code: def _get_time_based_sample_weight(self, t):
      weight = torch.ones_like(t)
      if self.config_train.newer_samples_weight > 1.0:
          end_w = self.config_train.newer_samples_weight
          start_t = self.config_train.newer_samples_start
          time = (t.detach() - start_t) / (1.0 - start_t)
          time = torch.maximum(torch.zeros_like(time), time)
          time = torch.minimum(
              torch.ones_like(time), time
          )  # time = 0 to 1
          time = np.pi * (time - 1.0)  # time =  -pi to 0
          time = 0.5 * torch.cos(time) + 0.5  # time =  0 to 1
          # scales end to be end weight times bigger than start weight
          # with end weight being 1.0
          weight = (1.0 + time * (end_w - 1.0)) / end_w
      return weight.unsqueeze(dim=2)
  
imports: import logging
  import math
  from collections import OrderedDict
  from functools import reduce
  from typing import Dict, List, Optional, Union
  import numpy
  import pytorch_lightning
  import torch
  import torch.nn
  import torchmetrics
  from neuralprophet import configure, np_types
  from neuralprophet.components.router import get_future_regressors, get_seasonality, get_trend
  from neuralprophet.utils import check_for_regularization, config_events_to_model_dims, reg_func_events, reg_func_regressors, reg_func_season, reg_func_trend
  from neuralprophet.utils_torch import init_parameter, interprete_model
label_desc: Use image node_id 19 for calling the TimeNet obj's underlying member method code with example usage: obj._get_time_based_sample_weight(t) and returns: weight