Skip to content

Commit

Permalink
improvement mean and std output adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-cie committed Jan 14, 2024
1 parent 021f726 commit a309f2d
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/WMSDTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ def improvement_mean(
alternative_to_overcome,
epsilon,
allow_std=False,
solutions_number = None,
solutions_number = 5,
**kwargs,
):
"""TO DO
Expand Down Expand Up @@ -1114,6 +1114,7 @@ def improvement_mean(
alternative_to_improve["Mean"] += epsilon
else:
return None
result_means, result_stds = self.wmsd_transformer.transform_US_to_wmsd(np.array(result))
objectives = self.wmsd_transformer.objectives
value_range = self.wmsd_transformer._value_range
result -= alternative_to_improve[:-3]
Expand All @@ -1129,6 +1130,8 @@ def improvement_mean(
result[j][i] = (
-value_range[j] * result[result.columns[j]][i]
)
result['Mean'] = result_means - m_start
result['Std'] = result_stds - std_start
return result

def __check_boundary_values(
Expand Down Expand Up @@ -1595,7 +1598,7 @@ def improvement_std(
alternative_to_improve,
alternative_to_overcome,
epsilon,
solutions_number = None,
solutions_number = 5,
**kwargs,
):
"""TO DO
Expand All @@ -1614,6 +1617,7 @@ def improvement_std(

w = np.mean(self.wmsd_transformer.weights)
std_start = alternative_to_improve["Std"]
m_start = alternative_to_improve["Mean"]
sd_boundary = self.wmsd_transformer.max_std_calculator(
alternative_to_improve["Mean"], self.wmsd_transformer.weights
)
Expand Down Expand Up @@ -1656,6 +1660,7 @@ def improvement_std(
inverse_solutions = self.wmsd_transformer.inverse_transform(alternative_to_improve["Mean"], alternative_to_improve["Std"], "==")
reduced_solutions = self.reduce_population_agglomerative_clustering(inverse_solutions, solutions_number)
result = pd.DataFrame(reduced_solutions, columns=alternative_to_improve.index[:-3])
result_means, result_stds = self.wmsd_transformer.transform_US_to_wmsd(np.array(result))
objectives = self.wmsd_transformer.objectives
value_range = self.wmsd_transformer._value_range
result -= alternative_to_improve[:-3]
Expand All @@ -1671,6 +1676,8 @@ def improvement_std(
result[j][i] = (
-value_range[j] * result[result.columns[j]][i]
)
result['Mean'] = result_means - m_start
result['Std'] = result_stds - std_start
return result


Expand Down Expand Up @@ -1788,7 +1795,7 @@ def improvement_std(
alternative_to_improve,
alternative_to_overcome,
epsilon,
solutions_number = None,
solutions_number = 5,
**kwargs,
):
"""TO DO
Expand All @@ -1807,6 +1814,7 @@ def improvement_std(

w = np.mean(self.wmsd_transformer.weights)
std_start = alternative_to_improve["Std"]
m_start = alternative_to_improve["Mean"]
sd_boundary = self.wmsd_transformer.max_std_calculator(
alternative_to_improve["Mean"], self.wmsd_transformer.weights
)
Expand Down Expand Up @@ -1849,6 +1857,7 @@ def improvement_std(
inverse_solutions = self.wmsd_transformer.inverse_transform(alternative_to_improve["Mean"], alternative_to_improve["Std"], "==")
reduced_solutions = self.reduce_population_agglomerative_clustering(inverse_solutions, solutions_number)
result = pd.DataFrame(reduced_solutions, columns=alternative_to_improve.index[:-3])
result_means, result_stds = self.wmsd_transformer.transform_US_to_wmsd(np.array(result))
objectives = self.wmsd_transformer.objectives
value_range = self.wmsd_transformer._value_range
result -= alternative_to_improve[:-3]
Expand All @@ -1864,6 +1873,8 @@ def improvement_std(
result[j][i] = (
-value_range[j] * result[result.columns[j]][i]
)
result['Mean'] = result_means - m_start
result['Std'] = result_stds - std_start
return result


Expand Down Expand Up @@ -1988,7 +1999,7 @@ def improvement_std(
alternative_to_improve,
alternative_to_overcome,
epsilon,
solutions_number = None,
solutions_number = 5,
**kwargs,
):
"""TO DO
Expand All @@ -2007,6 +2018,7 @@ def improvement_std(

w = np.mean(self.wmsd_transformer.weights)
std_start = alternative_to_improve["Std"]
m_start = alternative_to_improve["Mean"]
sd_boundary = self.wmsd_transformer.max_std_calculator(
alternative_to_improve["Mean"], self.wmsd_transformer.weights
)
Expand Down Expand Up @@ -2096,6 +2108,7 @@ def improvement_std(
inverse_solutions = self.wmsd_transformer.inverse_transform(alternative_to_improve["Mean"], alternative_to_improve["Std"], "==")
reduced_solutions = self.reduce_population_agglomerative_clustering(inverse_solutions, solutions_number)
result = pd.DataFrame(reduced_solutions, columns=alternative_to_improve.index[:-3])
result_means, result_stds = self.wmsd_transformer.transform_US_to_wmsd(np.array(result))
objectives = self.wmsd_transformer.objectives
value_range = self.wmsd_transformer._value_range
result -= alternative_to_improve[:-3]
Expand All @@ -2111,4 +2124,6 @@ def improvement_std(
result[j][i] = (
-value_range[j] * result[result.columns[j]][i]
)
result['Mean'] = result_means - m_start
result['Std'] = result_stds - std_start
return result

0 comments on commit a309f2d

Please sign in to comment.