Skip to content

Commit

Permalink
deleted empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
tmnp19 committed Jul 26, 2024
1 parent ccff038 commit e701dea
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
3 changes: 0 additions & 3 deletions piglot/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def scalarise(self, composition: Composition = None) -> float:
raise ValueError(
f"Invalid scalarisation '{self.scalarisation}'. Use 'mean' or 'stch'."
)

if self.scalarisation == "stch":
# Sanitise the weights
weights = np.array(self.weights)
Expand All @@ -243,9 +242,7 @@ def scalarise(self, composition: Composition = None) -> float:
# Calculate the Tchebycheff function value
tch_values = (np.abs((norm_funcs - ideal_point) * costs) / u) * weights
return np.log(np.sum(np.exp(tch_values))) * u

return np.mean(self.values)

return composition.composition(self.values, self.params).item()

def scalarise_mo(self, composition: Composition = None) -> List[float]:
Expand Down
2 changes: 0 additions & 2 deletions piglot/objectives/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def __composition(
# Sanitise scalarisation method
if scalarisation not in ['mean', 'stch']:
raise ValueError(f"Invalid scalarisation '{scalarisation}'. Use 'mean' or 'stch'.")

return ResponseComposition(
scalarise=scalarise,
stochastic=stochastic,
Expand Down Expand Up @@ -275,7 +274,6 @@ def _objective(self, values: np.ndarray, concurrent: bool = False) -> ObjectiveR
# Build statistical model for the target
results.append(target.weight * np.mean(targets))
variances.append(target.weight * np.var(targets) / len(targets))

return ObjectiveResult(
values,
results,
Expand Down
3 changes: 0 additions & 3 deletions piglot/utils/composition/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ def composition_torch(self, inner: torch.Tensor, params: torch.Tensor) -> torch.
# Sanitise the scalarisation method
if self.scalarise and self.scalarisation not in ['mean', 'stch']:
raise ValueError(f"Invalid scalarisation '{self.scalarisation}'. Use 'mean' or 'stch'.")

# Split the inner responses
responses = self.concat.split_torch(inner)
# Unflatten each response
Expand All @@ -422,7 +421,6 @@ def composition_torch(self, inner: torch.Tensor, params: torch.Tensor) -> torch.
reduction.reduce_torch(time, data, self._expand_params(time, params))
for (time, data), reduction in zip(unflattened, self.reductions)
], dim=-1)

# Mean scalarisation if requested
if self.scalarise:
# Smooth TCHebycheff scalarisation (STCH) if requested
Expand Down Expand Up @@ -450,5 +448,4 @@ def composition_torch(self, inner: torch.Tensor, params: torch.Tensor) -> torch.
# Apply the weights
objective = objective * torch.tensor(self.weights).to(inner.device)
return torch.mean(objective, dim=-1)

return objective * torch.tensor(self.weights).to(inner.device)

0 comments on commit e701dea

Please sign in to comment.