Principal component analysis (PCA) is a technique for reducing the dimensionality of a data set by finding a set of orthogonal vectors that capture most of the variance in the data. Here is how you can perform PCA on a NumPy array without using any other libraries:

```python
import numpy as np

# Assume data is a NumPy array of shape (n, d), where n is the number of samples and d is the number of features
data = np.array(...) # Replace with your data

# Step 1: Center the data by subtracting the mean of each feature
mean = np.mean(data, axis=0) # Compute the mean vector of shape (d,)
data_centered = data - mean # Center the data by subtracting the mean vector

# Step 2: Compute the covariance matrix of the centered data
cov = np.cov(data_centered.T) # Compute the covariance matrix of shape (d, d)

# Step 3: Compute the eigenvalues and eigenvectors of the covariance matrix
eigvals, eigvecs = np.linalg.eig(cov) # Compute the eigenvalues and eigenvectors of shape (d,) and (d, d), respectively

# Step 4: Sort the eigenvalues and eigenvectors in descending order
idx = np.argsort(eigvals)[::-1] # Get the indices that sort the eigenvalues in descending order
eigvals = eigvals[idx] # Sort the eigenvalues
eigvecs = eigvecs[:, idx] # Sort the eigenvectors accordingly

# Step 5: Select the k largest eigenvalues and corresponding eigenvectors as the principal components
k = ... # Replace with your desired number of principal components
pc_vals = eigvals[:k] # Select the k largest eigenvalues as the principal component values
pc_vecs = eigvecs[:, :k] # Select the corresponding eigenvectors as the principal component vectors

# Step 6: Compute the fraction of the total variance explained by each principal component
total_var = np.sum(eigvals) # Compute the total variance as the sum of all eigenvalues
pc_frac = pc_vals / total_var # Compute the fraction of variance explained by each principal component value

# Step 7: Project the data onto the principal component vectors
data_pca = np.dot(data_centered, pc_vecs) # Project the centered data onto the principal component vectors

# The output is:
# pc_vals: a NumPy array of shape (k,) containing the k largest eigenvalues of the covariance matrix
# pc_vecs: a NumPy array of shape (d, k) containing the k principal component vectors as columns
# pc_frac: a NumPy array of shape (k,) containing the fraction of variance explained by each principal component value
# data_pca: a NumPy array of shape (n, k) containing the projected data onto the k principal component vectors
```
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence