47
47
qKnowledgeGradient ,
48
48
qMultiFidelityKnowledgeGradient ,
49
49
)
50
- from botorch .acquisition .logei import qLogExpectedImprovement
50
+ from botorch .acquisition .logei import (
51
+ qLogExpectedImprovement ,
52
+ qLogNoisyExpectedImprovement ,
53
+ TAU_MAX ,
54
+ TAU_RELU ,
55
+ )
51
56
from botorch .acquisition .max_value_entropy_search import (
52
57
qMaxValueEntropy ,
53
58
qMultiFidelityMaxValueEntropy ,
@@ -450,7 +455,7 @@ def construct_inputs_qSimpleRegret(
450
455
)
451
456
452
457
453
- @acqf_input_constructor (qExpectedImprovement , qLogExpectedImprovement )
458
+ @acqf_input_constructor (qExpectedImprovement )
454
459
def construct_inputs_qEI (
455
460
model : Model ,
456
461
training_data : MaybeDict [SupervisedDataset ],
@@ -508,6 +513,72 @@ def construct_inputs_qEI(
508
513
return {** base_inputs , "best_f" : best_f , "constraints" : constraints , "eta" : eta }
509
514
510
515
516
+ @acqf_input_constructor (qLogExpectedImprovement )
517
+ def construct_inputs_qLogEI (
518
+ model : Model ,
519
+ training_data : MaybeDict [SupervisedDataset ],
520
+ objective : Optional [MCAcquisitionObjective ] = None ,
521
+ posterior_transform : Optional [PosteriorTransform ] = None ,
522
+ X_pending : Optional [Tensor ] = None ,
523
+ sampler : Optional [MCSampler ] = None ,
524
+ best_f : Optional [Union [float , Tensor ]] = None ,
525
+ constraints : Optional [List [Callable [[Tensor ], Tensor ]]] = None ,
526
+ eta : Union [Tensor , float ] = 1e-3 ,
527
+ fat : bool = True ,
528
+ tau_max : float = TAU_MAX ,
529
+ tau_relu : float = TAU_RELU ,
530
+ ** ignored : Any ,
531
+ ) -> Dict [str , Any ]:
532
+ r"""Construct kwargs for the `qExpectedImprovement` constructor.
533
+
534
+ Args:
535
+ model: The model to be used in the acquisition function.
536
+ training_data: Dataset(s) used to train the model.
537
+ objective: The objective to be used in the acquisition function.
538
+ posterior_transform: The posterior transform to be used in the
539
+ acquisition function.
540
+ X_pending: A `m x d`-dim Tensor of `m` design points that have been
541
+ submitted for function evaluation but have not yet been evaluated.
542
+ Concatenated into X upon forward call.
543
+ sampler: The sampler used to draw base samples. If omitted, uses
544
+ the acquisition functions's default sampler.
545
+ best_f: Threshold above (or below) which improvement is defined.
546
+ constraints: A list of constraint callables which map a Tensor of posterior
547
+ samples of dimension `sample_shape x batch-shape x q x m`-dim to a
548
+ `sample_shape x batch-shape x q`-dim Tensor. The associated constraints
549
+ are considered satisfied if the output is less than zero.
550
+ eta: Temperature parameter(s) governing the smoothness of the sigmoid
551
+ approximation to the constraint indicators. For more details, on this
552
+ parameter, see the docs of `compute_smoothed_feasibility_indicator`.
553
+ fat: Toggles the logarithmic / linear asymptotic behavior of the smooth
554
+ approximation to the ReLU.
555
+ tau_max: Temperature parameter controlling the sharpness of the smooth
556
+ approximations to max.
557
+ tau_relu: Temperature parameter controlling the sharpness of the smooth
558
+ approximations to ReLU.
559
+ ignored: Not used.
560
+
561
+ Returns:
562
+ A dict mapping kwarg names of the constructor to values.
563
+ """
564
+ return {
565
+ ** construct_inputs_qEI (
566
+ model = model ,
567
+ training_data = training_data ,
568
+ objective = objective ,
569
+ posterior_transform = posterior_transform ,
570
+ X_pending = X_pending ,
571
+ sampler = sampler ,
572
+ best_f = best_f ,
573
+ constraints = constraints ,
574
+ eta = eta ,
575
+ ),
576
+ "fat" : fat ,
577
+ "tau_max" : tau_max ,
578
+ "tau_relu" : tau_relu ,
579
+ }
580
+
581
+
511
582
@acqf_input_constructor (qNoisyExpectedImprovement )
512
583
def construct_inputs_qNEI (
513
584
model : Model ,
@@ -570,7 +641,6 @@ def construct_inputs_qNEI(
570
641
assert_shared = True ,
571
642
first_only = True ,
572
643
)
573
-
574
644
return {
575
645
** base_inputs ,
576
646
"X_baseline" : X_baseline ,
@@ -581,6 +651,82 @@ def construct_inputs_qNEI(
581
651
}
582
652
583
653
654
+ @acqf_input_constructor (qLogNoisyExpectedImprovement )
655
+ def construct_inputs_qLogNEI (
656
+ model : Model ,
657
+ training_data : MaybeDict [SupervisedDataset ],
658
+ objective : Optional [MCAcquisitionObjective ] = None ,
659
+ posterior_transform : Optional [PosteriorTransform ] = None ,
660
+ X_pending : Optional [Tensor ] = None ,
661
+ sampler : Optional [MCSampler ] = None ,
662
+ X_baseline : Optional [Tensor ] = None ,
663
+ prune_baseline : Optional [bool ] = True ,
664
+ cache_root : Optional [bool ] = True ,
665
+ constraints : Optional [List [Callable [[Tensor ], Tensor ]]] = None ,
666
+ eta : Union [Tensor , float ] = 1e-3 ,
667
+ fat : bool = True ,
668
+ tau_max : float = TAU_MAX ,
669
+ tau_relu : float = TAU_RELU ,
670
+ ** ignored : Any ,
671
+ ):
672
+ r"""Construct kwargs for the `qNoisyExpectedImprovement` constructor.
673
+
674
+ Args:
675
+ model: The model to be used in the acquisition function.
676
+ training_data: Dataset(s) used to train the model.
677
+ objective: The objective to be used in the acquisition function.
678
+ posterior_transform: The posterior transform to be used in the
679
+ acquisition function.
680
+ X_pending: A `m x d`-dim Tensor of `m` design points that have been
681
+ submitted for function evaluation but have not yet been evaluated.
682
+ Concatenated into X upon forward call.
683
+ sampler: The sampler used to draw base samples. If omitted, uses
684
+ the acquisition functions's default sampler.
685
+ X_baseline: A `batch_shape x r x d`-dim Tensor of `r` design points
686
+ that have already been observed. These points are considered as
687
+ the potential best design point. If omitted, checks that all
688
+ training_data have the same input features and take the first `X`.
689
+ prune_baseline: If True, remove points in `X_baseline` that are
690
+ highly unlikely to be the best point. This can significantly
691
+ improve performance and is generally recommended.
692
+ constraints: A list of constraint callables which map a Tensor of posterior
693
+ samples of dimension `sample_shape x batch-shape x q x m`-dim to a
694
+ `sample_shape x batch-shape x q`-dim Tensor. The associated constraints
695
+ are considered satisfied if the output is less than zero.
696
+ eta: Temperature parameter(s) governing the smoothness of the sigmoid
697
+ approximation to the constraint indicators. For more details, on this
698
+ parameter, see the docs of `compute_smoothed_feasibility_indicator`.
699
+ fat: Toggles the logarithmic / linear asymptotic behavior of the smooth
700
+ approximation to the ReLU.
701
+ tau_max: Temperature parameter controlling the sharpness of the smooth
702
+ approximations to max.
703
+ tau_relu: Temperature parameter controlling the sharpness of the smooth
704
+ approximations to ReLU.
705
+ ignored: Not used.
706
+
707
+ Returns:
708
+ A dict mapping kwarg names of the constructor to values.
709
+ """
710
+ return {
711
+ ** construct_inputs_qNEI (
712
+ model = model ,
713
+ training_data = training_data ,
714
+ objective = objective ,
715
+ posterior_transform = posterior_transform ,
716
+ X_pending = X_pending ,
717
+ sampler = sampler ,
718
+ X_baseline = X_baseline ,
719
+ prune_baseline = prune_baseline ,
720
+ cache_root = cache_root ,
721
+ constraint = constraints ,
722
+ eta = eta ,
723
+ ),
724
+ "fat" : fat ,
725
+ "tau_max" : tau_max ,
726
+ "tau_relu" : tau_relu ,
727
+ }
728
+
729
+
584
730
@acqf_input_constructor (qProbabilityOfImprovement )
585
731
def construct_inputs_qPI (
586
732
model : Model ,
0 commit comments