Skip to content

Commit

Permalink
Bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
daphne12345 committed Aug 29, 2024
1 parent 3212f2f commit 6fbdffc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions deepcave/evaluators/mo_fanova.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,11 @@ def calculate(
df = df.dropna(subset=objectives_normed)
X = df[self.hp_names].to_numpy()
weightings = self.get_weightings(objectives_normed, df)
print(weightings)
df_all = pd.DataFrame([])

# calculate importance for each weighting generated from the pareto efficient points
for w in weightings:
Y = sum(df[obj] * weighting for obj, weighting in zip(objectives_normed, w)).to_numpy()
print(Y)

self._model = FanovaForest(self.cs, n_trees=n_trees, seed=seed)
self._model.train(X, Y)
Expand All @@ -164,13 +162,11 @@ def calculate(
.loc[0:1]
.T.reset_index()
)
print(df_res)
df_res["weight"] = w[0]
df_all = pd.concat([df_all, df_res])
self.importances_ = df_all.rename(
columns={0: "importance", 1: "variance", "index": "hp_name"}
).reset_index(drop=True)
print(self.importances_)

def get_importances(
self, hp_names: Optional[List[str]] = None, sort: bool = True
Expand Down
5 changes: 3 additions & 2 deletions deepcave/evaluators/mo_lpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def calculate(
df = self.run.get_encoded_data(
objectives=objectives, budget=budget, specific=True, include_combined_cost=True
)
X = df[self.hp_names].to_numpy()


# normalize objectives
assert isinstance(objectives, list)
Expand All @@ -173,7 +173,8 @@ def calculate(
df[obj.name].max() - df[obj.name].min()
)
objectives_normed.append(normed)

df = df.dropna(subset=objectives_normed)
X = df[self.hp_names].to_numpy()
df_all = pd.DataFrame([])
weightings = self.get_weightings(objectives_normed, df)

Expand Down

0 comments on commit 6fbdffc

Please sign in to comment.