def params(cls, config=None): """ Set params. Args: config: contains the following four optional parameters: 'type': Type of Opration. (string, default = 'CMVN') 'global_mean': Global mean of features. (float, default = 0.0) 'global_variance': Global variance of features. (float, default = 1.0) 'local_cmvn': If ture, local cmvn will be done on features. (bool, default = False) Note: Return an object of class HParams, which is a set of hyperparameters as name-value pairs. """ hparams = HParams(cls=cls) hparams.add_hparam("type", "CMVN") hparams.add_hparam("global_mean", [0.0]) hparams.add_hparam("global_variance", [1.0]) hparams.add_hparam("local_cmvn", False) if config is not None: hparams.parse(config, True) assert len(hparams.global_mean) == len( hparams.global_variance ), "Error, global_mean length {} is not equals to global_variance length {}".format( len(hparams.global_mean), len(hparams.global_variance) ) hparams.global_variance = (np.sqrt(hparams.global_variance) + 1e-6).tolist() return hparams
def params(cls, config=None): """ set params """ hparams = HParams(cls=cls) hparams.add_hparam("type", "CMVN") hparams.add_hparam("global_mean", [0.0]) hparams.add_hparam("global_variance", [1.0]) hparams.add_hparam("local_cmvn", False) if config is not None: hparams.parse(config, True) assert len(hparams.global_mean) == len( hparams.global_variance ), "Error, global_mean length {} is not equals to global_variance length {}".format( len(hparams.global_mean), len(hparams.global_variance)) hparams.global_variance = (np.sqrt(hparams.global_variance) + 1e-6).tolist() return hparams