Skip to content

Commit

Permalink
Fix: Correct the parameters passed to the plotting function in PCA De…
Browse files Browse the repository at this point in the history
…composition
  • Loading branch information
HaibinLai committed Sep 18, 2024
1 parent c4c4bca commit 7273eaa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions geochemistrypi/data_mining/model/decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,10 @@ def special_components(self, **kwargs: Union[Dict, np.ndarray, int]) -> None:
GEOPI_OUTPUT_ARTIFACTS_IMAGE_MODEL_OUTPUT_PATH = os.getenv("GEOPI_OUTPUT_ARTIFACTS_IMAGE_MODEL_OUTPUT_PATH")
# Draw graphs when the number of principal components > 3
if kwargs["components_num"] > 3:

# choose two of dimensions to draw
two_dimen_axis_index, two_dimen_pc_data = self.choose_dimension_data(self.pc_data, 2)
two_dimen_axis_index, two_dimen_pc_data = self.choose_dimension_data(self.X_reduced, 2)

two_dimen_reduced_data = self.X_reduced.iloc[:, two_dimen_axis_index]
self._biplot(
reduced_data=two_dimen_reduced_data,
Expand All @@ -340,7 +342,7 @@ def special_components(self, **kwargs: Union[Dict, np.ndarray, int]) -> None:
)

# choose three of dimensions to draw
three_dimen_axis_index, three_dimen_pc_data = self.choose_dimension_data(self.pc_data, 3)
three_dimen_axis_index, three_dimen_pc_data = self.choose_dimension_data(self.X_reduced, 3)
three_dimen_reduced_data = self.X_reduced.iloc[:, three_dimen_axis_index]
self._triplot(
reduced_data=three_dimen_reduced_data,
Expand All @@ -352,7 +354,7 @@ def special_components(self, **kwargs: Union[Dict, np.ndarray, int]) -> None:
)
elif kwargs["components_num"] == 3:
# choose two of dimensions to draw
two_dimen_axis_index, two_dimen_pc_data = self.choose_dimension_data(self.pc_data, 2)
two_dimen_axis_index, two_dimen_pc_data = self.choose_dimension_data(self.X_reduced, 2)
two_dimen_reduced_data = self.X_reduced.iloc[:, two_dimen_axis_index]
self._biplot(
reduced_data=two_dimen_reduced_data,
Expand Down

0 comments on commit 7273eaa

Please sign in to comment.