File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed
test/algorithms/regressors Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 11# This code is part of Qiskit.
22#
3- # (C) Copyright IBM 2018, 2022 .
3+ # (C) Copyright IBM 2018, 2023 .
44#
55# This code is licensed under the Apache License, Version 2.0. You may
66# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -69,8 +69,9 @@ def setUp(self):
6969
7070 # pylint: disable=invalid-name
7171 lb , ub = - np .pi , np .pi
72- self .X = (ub - lb ) * np .random .rand (num_samples , 1 ) + lb
73- self .y = np .sin (self .X [:, 0 ]) + eps * (2 * np .random .rand (num_samples ) - 1 )
72+ rng = np .random .default_rng (101 )
73+ self .X = (ub - lb ) * rng .random ((num_samples , 1 )) + lb
74+ self .y = np .sin (self .X [:, 0 ]) + eps * (2 * rng .random (num_samples ) - 1 )
7475
7576 def tearDown (self ) -> None :
7677 super ().tearDown ()
Original file line number Diff line number Diff line change 11# This code is part of Qiskit.
22#
3- # (C) Copyright IBM 2022.
3+ # (C) Copyright IBM 2022, 2023 .
44#
55# This code is licensed under the Apache License, Version 2.0. You may
66# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -53,8 +53,9 @@ def setUp(self):
5353
5454 # pylint: disable=invalid-name
5555 lb , ub = - np .pi , np .pi
56- self .X = (ub - lb ) * np .random .rand (num_samples , 1 ) + lb
57- self .y = np .sin (self .X [:, 0 ]) + eps * (2 * np .random .rand (num_samples ) - 1 )
56+ rng = np .random .default_rng (101 )
57+ self .X = (ub - lb ) * rng .random ((num_samples , 1 )) + lb
58+ self .y = np .sin (self .X [:, 0 ]) + eps * (2 * rng .random (num_samples ) - 1 )
5859
5960 def _create_regressor (
6061 self , opt , callback = None
Original file line number Diff line number Diff line change 11# This code is part of Qiskit.
22#
3- # (C) Copyright IBM 2018, 2022 .
3+ # (C) Copyright IBM 2018, 2023 .
44#
55# This code is licensed under the Apache License, Version 2.0. You may
66# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -59,8 +59,9 @@ def setUp(self):
5959
6060 # pylint: disable=invalid-name
6161 lb , ub = - np .pi , np .pi
62- self .X = (ub - lb ) * np .random .rand (num_samples , 1 ) + lb
63- self .y = np .sin (self .X [:, 0 ]) + eps * (2 * np .random .rand (num_samples ) - 1 )
62+ rng = np .random .default_rng (101 )
63+ self .X = (ub - lb ) * rng .random ((num_samples , 1 )) + lb
64+ self .y = np .sin (self .X [:, 0 ]) + eps * (2 * rng .random (num_samples ) - 1 )
6465
6566 def tearDown (self ) -> None :
6667 super ().tearDown ()
Original file line number Diff line number Diff line change 11# This code is part of Qiskit.
22#
3- # (C) Copyright IBM 2022.
3+ # (C) Copyright IBM 2022, 2023 .
44#
55# This code is licensed under the Apache License, Version 2.0. You may
66# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -43,8 +43,9 @@ def setUp(self):
4343
4444 # pylint: disable=invalid-name
4545 lb , ub = - np .pi , np .pi
46- self .X = (ub - lb ) * np .random .rand (num_samples , 1 ) + lb
47- self .y = np .sin (self .X [:, 0 ]) + eps * (2 * np .random .rand (num_samples ) - 1 )
46+ rng = np .random .default_rng (101 )
47+ self .X = (ub - lb ) * rng .random ((num_samples , 1 )) + lb
48+ self .y = np .sin (self .X [:, 0 ]) + eps * (2 * rng .random (num_samples ) - 1 )
4849
4950 @data (
5051 # optimizer, has ansatz
You can’t perform that action at this time.
0 commit comments