@@ -440,7 +440,7 @@ def test_one_dim_odd_input(self):
440440 x = [1. , 5. , 3. , 2. , 4. ]
441441 for q in [0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ]:
442442 expected_percentile = np .percentile (
443- x , q = q , interpolation = self ._interpolation , axis = 0 )
443+ x , q = q , method = self ._interpolation , axis = 0 )
444444 pct = quantiles .percentile (
445445 x , q = q , interpolation = self ._interpolation , axis = [0 ])
446446 self .assertAllEqual ((), pct .shape )
@@ -450,7 +450,7 @@ def test_one_dim_odd_input_vector_q(self):
450450 x = [1. , 5. , 3. , 2. , 4. ]
451451 q = np .array ([0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ])
452452 expected_percentile = np .percentile (
453- x , q = q , interpolation = self ._interpolation , axis = 0 )
453+ x , q = q , method = self ._interpolation , axis = 0 )
454454 pct = quantiles .percentile (
455455 x , q = q , interpolation = self ._interpolation , axis = [0 ])
456456 self .assertAllEqual (q .shape , pct .shape )
@@ -460,7 +460,7 @@ def test_one_dim_even_input(self):
460460 x = [1. , 5. , 3. , 2. , 4. , 5. ]
461461 for q in [0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ]:
462462 expected_percentile = np .percentile (
463- x , q = q , interpolation = self ._interpolation )
463+ x , q = q , method = self ._interpolation )
464464 pct = quantiles .percentile (x , q = q , interpolation = self ._interpolation )
465465 self .assertAllEqual ((), pct .shape )
466466 self .assertAllClose (expected_percentile , self .evaluate (pct ))
@@ -469,7 +469,7 @@ def test_two_dim_odd_input_axis_0(self):
469469 x = np .array ([[- 1. , 50. , - 3.5 , 2. , - 1 ], [0. , 0. , 3. , 2. , 4. ]]).T
470470 for q in [0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ]:
471471 expected_percentile = np .percentile (
472- x , q = q , interpolation = self ._interpolation , axis = 0 )
472+ x , q = q , method = self ._interpolation , axis = 0 )
473473 # Get dim 1 with negative and positive indices.
474474 pct_neg_index = quantiles .percentile (
475475 x , q = q , interpolation = self ._interpolation , axis = [0 ])
@@ -485,7 +485,7 @@ def test_simple(self):
485485 x = np .array ([1. , 2. , 4. , 50. ])
486486 q = 10
487487 expected_percentile = np .percentile (
488- x , q = q , interpolation = self ._interpolation , axis = 0 )
488+ x , q = q , method = self ._interpolation , axis = 0 )
489489 pct = quantiles .percentile (
490490 x , q = q , interpolation = self ._interpolation , axis = [0 ])
491491 self .assertAllClose (expected_percentile , self .evaluate (pct ))
@@ -494,7 +494,7 @@ def test_two_dim_even_axis_0(self):
494494 x = np .array ([[1. , 2. , 4. , 50. ], [1. , 2. , - 4. , 5. ]]).T
495495 for q in [0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ]:
496496 expected_percentile = np .percentile (
497- x , q = q , interpolation = self ._interpolation , axis = 0 )
497+ x , q = q , method = self ._interpolation , axis = 0 )
498498 pct = quantiles .percentile (
499499 x , q = q , interpolation = self ._interpolation , axis = [0 ])
500500 self .assertAllEqual ((2 ,), pct .shape )
@@ -504,7 +504,7 @@ def test_two_dim_even_input_and_keepdims_true(self):
504504 x = np .array ([[1. , 2. , 4. , 50. ], [1. , 2. , - 4. , 5. ]]).T
505505 for q in [0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ]:
506506 expected_percentile = np .percentile (
507- x , q = q , interpolation = self ._interpolation , keepdims = True , axis = 0 )
507+ x , q = q , method = self ._interpolation , keepdims = True , axis = 0 )
508508 pct = quantiles .percentile (
509509 x , q = q , interpolation = self ._interpolation , keepdims = True , axis = [0 ])
510510 self .assertAllEqual ((1 , 2 ), pct .shape )
@@ -514,7 +514,7 @@ def test_four_dimensional_input(self):
514514 x = np .random .rand (2 , 3 , 4 , 5 )
515515 for axis in [None , 0 , 1 , - 2 , (0 ,), (- 1 ,), (- 1 , 1 ), (3 , 1 ), (- 3 , 0 )]:
516516 expected_percentile = np .percentile (
517- x , q = 0.77 , interpolation = self ._interpolation , axis = axis )
517+ x , q = 0.77 , method = self ._interpolation , axis = axis )
518518 pct = quantiles .percentile (
519519 x , q = 0.77 , interpolation = self ._interpolation , axis = axis )
520520 self .assertAllEqual (expected_percentile .shape , pct .shape )
@@ -525,7 +525,7 @@ def test_four_dimensional_input_q_vector(self):
525525 q = [0.25 , 0.75 ]
526526 for axis in [None , 0 , (- 1 , 1 )]:
527527 expected_percentile = np .percentile (
528- x , q = q , interpolation = self ._interpolation , axis = axis )
528+ x , q = q , method = self ._interpolation , axis = axis )
529529 pct = quantiles .percentile (
530530 x , q = q , interpolation = self ._interpolation , axis = axis )
531531 self .assertAllEqual (expected_percentile .shape , pct .shape )
@@ -536,7 +536,7 @@ def test_four_dimensional_input_q_vector_and_keepdims(self):
536536 q = [0.25 , 0.75 ]
537537 for axis in [None , 0 , (- 1 , 1 )]:
538538 expected_percentile = np .percentile (
539- x , q = q , interpolation = self ._interpolation , axis = axis , keepdims = True )
539+ x , q = q , method = self ._interpolation , axis = axis , keepdims = True )
540540 pct = quantiles .percentile (
541541 x , q = q , interpolation = self ._interpolation , axis = axis , keepdims = True )
542542 self .assertAllEqual (expected_percentile .shape , pct .shape )
@@ -548,7 +548,7 @@ def test_four_dimensional_input_and_keepdims(self):
548548 expected_percentile = np .percentile (
549549 x ,
550550 q = 0.77 ,
551- interpolation = self ._interpolation ,
551+ method = self ._interpolation ,
552552 axis = axis ,
553553 keepdims = True )
554554 pct = quantiles .percentile (
@@ -565,7 +565,7 @@ def test_four_dimensional_input_x_static_ndims_but_dynamic_sizes(self):
565565 x_ph = tf1 .placeholder_with_default (x , shape = [None , None , None , None ])
566566 for axis in [None , 0 , 1 , - 2 , (0 ,), (- 1 ,), (- 1 , 1 ), (3 , 1 ), (- 3 , 0 )]:
567567 expected_percentile = np .percentile (
568- x , q = 0.77 , interpolation = self ._interpolation , axis = axis )
568+ x , q = 0.77 , method = self ._interpolation , axis = axis )
569569 pct = quantiles .percentile (
570570 x_ph , q = 0.77 , interpolation = self ._interpolation , axis = axis )
571571 self .assertAllClose (expected_percentile , self .evaluate (pct ))
@@ -577,7 +577,7 @@ def test_four_dimensional_input_and_keepdims_x_static_ndims_dynamic_sz(self):
577577 expected_percentile = np .percentile (
578578 x ,
579579 q = 0.77 ,
580- interpolation = self ._interpolation ,
580+ method = self ._interpolation ,
581581 axis = axis ,
582582 keepdims = True )
583583 pct = quantiles .percentile (
@@ -595,7 +595,7 @@ def test_with_integer_dtype(self):
595595 x = [1 , 5 , 3 , 2 , 4 ]
596596 for q in [0 , 10 , 25 , 49.9 , 50 , 50.01 , 90 , 95 , 100 ]:
597597 expected_percentile = np .percentile (
598- x , q = q , interpolation = self ._interpolation )
598+ x , q = q , method = self ._interpolation )
599599 pct = quantiles .percentile (x , q = q , interpolation = self ._interpolation )
600600 self .assertEqual (tf .int32 , pct .dtype )
601601 self .assertAllEqual ((), pct .shape )
@@ -610,13 +610,13 @@ def test_nan_propagation(self):
610610 # Test each percentile individually
611611 for q in qs :
612612 expected_percentile = np .percentile (
613- xs , q = q , interpolation = self ._interpolation )
613+ xs , q = q , method = self ._interpolation )
614614 self .assertTrue (np .isnan (expected_percentile ))
615615 pct = quantiles .percentile (xs , q = q , interpolation = self ._interpolation )
616616 self .assertTrue (self .evaluate (tf .math .is_nan (pct )))
617617 # Test vector percentile as well
618618 expected_percentiles = np .percentile (
619- xs , q = qs , interpolation = self ._interpolation )
619+ xs , q = qs , method = self ._interpolation )
620620 pcts = quantiles .percentile (xs , q = qs , interpolation = self ._interpolation )
621621 self .assertAllEqual (expected_percentiles , pcts )
622622
@@ -793,7 +793,7 @@ def test_one_dim_odd_input(self):
793793 x = [1. , 5. , 3. , 2. , 4. ]
794794 for q in [0 , 10.1 , 25.1 , 49.9 , 50.1 , 50.01 , 89 , 100 ]:
795795 expected_percentile = np .percentile (
796- x , q = q , interpolation = self ._interpolation )
796+ x , q = q , method = self ._interpolation )
797797 pct = quantiles .percentile (x , q = q , interpolation = self ._interpolation )
798798 self .assertAllEqual ((), pct .shape )
799799 self .assertAllClose (expected_percentile , self .evaluate (pct ))
@@ -802,7 +802,7 @@ def test_one_dim_even_input(self):
802802 x = [1. , 5. , 3. , 2. , 4. , 5. ]
803803 for q in [0 , 10.1 , 25.1 , 49.9 , 50.1 , 50.01 , 89 , 100 ]:
804804 expected_percentile = np .percentile (
805- x , q = q , interpolation = self ._interpolation )
805+ x , q = q , method = self ._interpolation )
806806 pct = quantiles .percentile (x , q = q , interpolation = self ._interpolation )
807807 self .assertAllEqual ((), pct .shape )
808808 self .assertAllClose (expected_percentile , self .evaluate (pct ))
@@ -811,7 +811,7 @@ def test_one_dim_numpy_docs_example(self):
811811 x = [[10.0 , 7.0 , 4.0 ], [3.0 , 2.0 , 1.0 ]]
812812 for q in [0 , 10.1 , 25.1 , 49.9 , 50.0 , 50.1 , 50.01 , 89 , 100 ]:
813813 expected_percentile = np .percentile (
814- x , q = q , interpolation = self ._interpolation )
814+ x , q = q , method = self ._interpolation )
815815 pct = quantiles .percentile (x , q = q , interpolation = self ._interpolation )
816816 self .assertAllEqual ((), pct .shape )
817817 self .assertAllClose (expected_percentile , self .evaluate (pct ))
0 commit comments