bcef53fdba799a4c6a250c9d0d67a30db4696ee5,deepchem/models/tests/test_normalizing_flows.py,,test_normalizing_flow,#,23

Before Change


  nfm = NormalizingFlowModel(nf)

  // Must be float32 for RealNVP
  dataset = NumpyDataset(
      X=np.random.rand(5, 3).astype(np.float32),
      y=np.random.rand(5,),
      ids=np.arange(5))

  // Tests a simple flow of one RealNVP layer.

  X = nfm.flow.sample()

After Change



  // Must be float32 for RealNVP
  target_distribution = tfd.MultivariateNormalDiag(loc=[1., 0.])
  dataset = NumpyDataset(X=target_distribution.sample(96))

  // Tests a simple flow of one RealNVP layer.

  X = nfm.flow.sample()
  x1 = tf.zeros([2])
  x2 = dataset.X[0]

  // log likelihoods should be negative
  assert nfm.flow.log_prob(X).numpy() < 0
  assert nfm.flow.log_prob(x1).numpy() < 0
  assert nfm.flow.log_prob(x2).numpy() < 0

  // // Fit model
  final = nfm.fit(dataset, nb_epoch=5)
  print(final)
  assert final > 0
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: deepchem/deepchem
Commit Name: bcef53fdba799a4c6a250c9d0d67a30db4696ee5
Time: 2020-08-24
Author: nfrey213@gmail.com
File Name: deepchem/models/tests/test_normalizing_flows.py
Class Name:
Method Name: test_normalizing_flow


Project Name: nipy/dipy
Commit Name: 1b46c1cb1650ef0b332cd2e3a84b3c0e4a764975
Time: 2017-01-07
Author: marc.cote.19@gmail.com
File Name: dipy/tracking/benchmarks/bench_streamline.py
Class Name:
Method Name: bench_length


Project Name: nipy/dipy
Commit Name: d7dcfeeb5b50fc3f9cf670b2b148efafef0ad3b7
Time: 2017-10-05
Author: marc.cote.19@gmail.com
File Name: dipy/tracking/benchmarks/bench_streamline.py
Class Name:
Method Name: bench_set_number_of_points


Project Name: deepchem/deepchem
Commit Name: bcef53fdba799a4c6a250c9d0d67a30db4696ee5
Time: 2020-08-24
Author: nfrey213@gmail.com
File Name: deepchem/models/tests/test_normalizing_flows.py
Class Name:
Method Name: test_normalizing_flow