Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ax/adapter/transforms/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def untransform_observation_features(
if p_name in self.original_values:
val = assert_is_instance_of_tuple(
min(
# pyrefly: ignore [unsupported-operation]
self.original_values[p_name],
# pyrefly: ignore [unsupported-operation]
key=lambda x: abs(x - val),
Expand Down
1 change: 0 additions & 1 deletion ax/adapter/transforms/tests/test_cast_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ def test_transform_experiment_data_cast(self) -> None:
.astype({"x": float, "y": float})
)
expected_arm_data["z"] = None
# pyrefly: ignore [missing-attribute]
expected_arm_data["z"] = expected_arm_data["z"].astype("Int64")
expected_arm_data = expected_arm_data[["x", "y", "z", "metadata"]]
assert_frame_equal(transformed.arm_data, expected_arm_data)
Expand Down
1 change: 0 additions & 1 deletion ax/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@ def _get_status_quo_df(
col for col in df.columns if col.endswith("_mean") or col.endswith("_sem")
]
status_quo_df = pd.DataFrame(status_quo_rows)[["trial_index", *all_metric_cols]]
# pyrefly: ignore [bad-return]
return status_quo_df


Expand Down
1 change: 0 additions & 1 deletion ax/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,6 @@ def _subsample_one_metric(
else:
filtered_df = df_g.iloc[:: int(derived_keep_every)]
filtered_dfs.append(filtered_df)
# pyrefly: ignore [bad-return]
return pd.concat(filtered_dfs)


Expand Down
3 changes: 1 addition & 2 deletions ax/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,13 +735,12 @@ def _sort_trials(
(
_time_trial_completed_safe(
trial=t # pyrefly: ignore [bad-argument-type]
).timestamp() # pyrefly: ignore [bad-argument-type]
).timestamp()
if not trials_are_running
else default_time_run_started.timestamp()
)
- _time_trial_started_safe(
trial=t, # pyrefly: ignore [bad-argument-type]
# pyrefly: ignore [bad-argument-type]
default_time_run_started=default_time_run_started,
).timestamp()
)
Expand Down
1 change: 0 additions & 1 deletion ax/generators/discrete/ashr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def fit(
lambdas = lambdas.astype(np.float64)

results = fit_ashr_em(
# pyrefly: ignore [bad-argument-type]
ll=self.ll,
# pyrefly: ignore [bad-argument-type]
lambdas=lambdas,
Expand Down
2 changes: 0 additions & 2 deletions ax/generators/tests/test_botorch_moo_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ def test_get_weighted_mc_objective(self) -> None:
weighted_obj = get_weighted_mc_objective(
objective_weights=objective_weights,
)
# pyrefly: ignore [bad-argument-type]
self.assertTrue(torch.equal(weighted_obj.weights, torch.tensor([1.0, 1.0])))
# pyrefly: ignore [not-callable]
self.assertEqual(weighted_obj.outcomes.tolist(), [1, 3])

# test infer objective thresholds alone
Expand Down
2 changes: 0 additions & 2 deletions ax/generators/torch/tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def setUp(self) -> None:
# pyrefly: ignore [bad-assignment]
Keys.OPTIMIZER_KWARGS: self.optimizer_options,
Keys.ACQF_KWARGS: {"eta": 3.0},
# pyrefly: ignore [bad-assignment]
Keys.AX_ACQUISITION_KWARGS: {Keys.SUBSET_MODEL: True},
},
)
Expand Down Expand Up @@ -1128,7 +1127,6 @@ def test_MOO(self) -> None:
self.assertIsInstance(ckwargs["objective"], WeightedMCMultiOutputObjective)
self.assertTrue(
torch.equal(
# pyrefly: ignore [bad-argument-type]
ckwargs["objective"].weights,
extract_objectives(self.moo_objective_weights)[1],
)
Expand Down
16 changes: 8 additions & 8 deletions ax/generators/torch/tests/test_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def test_scalematern_kernel_active_dims(self) -> None:
base_kernel = assert_is_instance(covar.base_kernel, MaternKernel)
# active_dims lands on the inner MaternKernel, and the ScaleKernel
# inherits it (so subsetting happens exactly once at the wrapper level).
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
self.assertEqual(covar.active_dims.tolist(), active_dims)
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
self.assertEqual(base_kernel.active_dims.tolist(), active_dims)
self.assertEqual(base_kernel.ard_num_dims, len(active_dims))
# The kernel only consumes the active columns: perturbing an inactive
Expand Down Expand Up @@ -121,11 +121,11 @@ def test_scale_rbf_linear_kernel_active_dims(self) -> None:
rbf = assert_is_instance(scale_rbf.base_kernel, RBFKernel)
# active_dims lands on both leaves, and the ScaleKernel inherits it
# from the wrapped RBF kernel (so subsetting happens exactly once).
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
self.assertEqual(scale_rbf.active_dims.tolist(), active_dims)
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
self.assertEqual(rbf.active_dims.tolist(), active_dims)
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
self.assertEqual(linear.active_dims.tolist(), active_dims)
# ard_num_dims matches the number of active dims.
self.assertEqual(rbf.ard_num_dims, len(active_dims))
Expand Down Expand Up @@ -283,9 +283,9 @@ def test_default_kernel(self) -> None:
self.assertIsNone(botorch_kernel.active_dims)
else:
self.assertEqual(
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
ax_kernel.active_dims.tolist(),
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
botorch_kernel.active_dims.tolist(),
)

Expand All @@ -301,5 +301,5 @@ def test_default_mle(self) -> None:
self.assertTrue((kernel.lengthscale == sqrt(2) / 10).all())
self.assertEqual(kernel.lengthscale.shape, torch.Size([3, 1, 2]))
self.assertFalse(hasattr(kernel, "lengthscale_prior"))
# pyrefly: ignore [missing-attribute, not-callable]
# pyrefly: ignore [missing-attribute]
self.assertEqual(kernel.active_dims.tolist(), active_dims)
1 change: 0 additions & 1 deletion ax/generators/torch/tests/test_surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def test__make_botorch_input_transform(self) -> None:
dataset=dataset,
)
transform = assert_is_instance(transform, Normalize)
# pyrefly: ignore [not-callable]
self.assertEqual(transform.indices.tolist(), [0])
self.assertEqual(transform.bounds.tolist(), [[1.0], [5.0]])

Expand Down
1 change: 0 additions & 1 deletion ax/generators/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ax.generators.winsorization_config import WinsorizationConfig
from botorch.acquisition import AcquisitionFunction

# pyre-ignore[33]: `TConfig` cannot alias to a type containing `Any`.
TConfig = dict[
str,
int
Expand Down
1 change: 0 additions & 1 deletion ax/generators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ def best_observed_point(
fixed_features=fixed_features,
options=options,
)
# pyrefly: ignore [bad-return]
return None if best_point_and_value is None else best_point_and_value[0]


Expand Down
1 change: 0 additions & 1 deletion ax/metrics/tests/test_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def _get_fake_multiplexer(
# pyre-ignore[8] Return fake tags when content is requested
mul.PluginRunToTagToContent = lambda plugin: {".": {"loss": ""}}

# pyre-ignore[8] Return fake data when tensors requested
mul.Tensors = lambda run, tag: [
_TensorEvent(step=i, tensor_proto=_TensorProto(double_val=[dat]))
for i, dat in enumerate(fake_data)
Expand Down
2 changes: 0 additions & 2 deletions ax/plot/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ def _get_in_sample_arms(
cov_dict=obs.data.covariance_matrix,
agg_metric_weight_dict=agg_metric["weight"],
)
# pyrefly: ignore [unsupported-operation]
obs_y[agg_metric_name] = agg_mean
# pyrefly: ignore [unsupported-operation]
obs_se[agg_metric_name] = np.sqrt(agg_var)
if training_in_design[i]:
# Update with the input fixed features
Expand Down
4 changes: 0 additions & 4 deletions ax/service/tests/test_ax_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def get_branin_currin_optimization_with_N_sobol_trials(
"branin": ObjectiveProperties(
minimize=minimize,
threshold=(
# pyrefly: ignore [bad-index]
float(branin_currin.ref_point[0])
if include_objective_thresholds
else None
Expand All @@ -165,7 +164,6 @@ def get_branin_currin_optimization_with_N_sobol_trials(
"currin": ObjectiveProperties(
minimize=minimize,
threshold=(
# pyrefly: ignore [bad-index]
float(branin_currin.ref_point[1])
if include_objective_thresholds
else None
Expand Down Expand Up @@ -3068,9 +3066,7 @@ def helper_test_get_pareto_optimal_points(
for obs in observed_pareto.values():
branin: float = obs[1][0]["branin"]
currin: float = obs[1][0]["currin"]
# pyrefly: ignore [bad-index]
self.assertGreater(branin, branin_currin.ref_point[0].item())
# pyrefly: ignore [bad-index]
self.assertGreater(currin, branin_currin.ref_point[1].item())
if outcome_constraints is not None:
self.assertEqual(branin + currin, obs[1][0]["c"])
Expand Down
1 change: 0 additions & 1 deletion ax/utils/stats/no_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def check_experiment_effects(
effective = np.min(ps) < no_effect_alpha
bounds_df = pd.DataFrame(fx_bounds, columns=["metric_name", "min", "max", "p"])
bounds_df.sort_values(by="p", inplace=True)
# pyrefly: ignore [bad-return]
return effective, ineffective_on_objectives, bounds_df


Expand Down
Loading