MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / main

Function main

machine_learning/principle_component_analysis.py:64–80  ·  view source on GitHub ↗

Driver function to execute PCA and display results.

()

Source from the content-addressed store, hash-verified

62
63
64def main() -> None:
65 """
66 Driver function to execute PCA and display results.
67 """
68 data_x, _data_y = collect_dataset()
69
70 # Number of principal components to retain
71 n_components = 2
72
73 # Apply PCA
74 transformed_data, variance_ratio = apply_pca(data_x, n_components)
75
76 print("Transformed Dataset (First 5 rows):")
77 print(transformed_data[:5])
78
79 print("\nExplained Variance Ratio:")
80 print(variance_ratio)
81
82
83if __name__ == "__main__":

Callers 1

Calls 2

apply_pcaFunction · 0.85
collect_datasetFunction · 0.70

Tested by

no test coverage detected