A Data Analytics using R Topic
What is PCA?
PCA for Dimensionality Reduction
Large datasets have many columns and variables. Having many variables (called features) makes the data high dimensional. Imagine a dataset with 100 features. To represent the data points on a graph, we would need 100 axes, one for each feature.
Principal Component Analysis (or PCA) is one method of identifying the most important axes with the most variance. Transforming your data to the new axes, called Principal Components, allows you to see the data from an improved perspective. Plotting data using the Principal Components instead of the original features can make clusters and patterns more apparent. Not only this, PCA is a simple way to discard the less important features to reduce the dimensionality.
Problems at High Dimensions
Say you wanted to train a statistical learning algorithm to distinguish between groups or classes in the data. For this learner to perform well it needs a large sample set. Feeding the algorithm with a representative training sample will make a learner better at predicting classes. Gathering these examples in high dimensional space poses problems. This is because high dimensional spaces are very big and more space has to be searched.
There are more problems than just gathering examples. As the number of dimensions increases, the Euclidean distance between points increases. Consequently, the data becomes more sparse and dissimilar making it more difficult for our learner to group points together by class.
The issue attributed to high dimensional datasets for machine learning algorithms is known as the Curse of Dimensionality.
Principal Component Analysis (or PCA) can help. Lets’s take a look at how.
How to do PCA in R
I generated simulated data with 30 observations for each of the three classes. Each observation has 100 different variables. To make the different classes distinct in some way, each class cluster has a different mean. Let’s visualise a snapshot in just two dimensions with the first two columns.
# obs is the data with 100 variables
plot(obs, col = c(rep("black",30), rep("blue", 30), rep("red", 30)), pch=19)

You can see there are three colours representing the three different classes. However, the groups overlap quite a bit. Let’s apply PCA to make the clusters more apparent. To do this we use the prcomp function in R. Let’s plot the first and second Principal Components now.
pr.out <- prcomp(obs)
plot(obs, col = c(rep("black",30), rep("blue", 30), rep("red", 30)), pch=19)

The three classes become much more apparent. This is an improved visualisation of the data. The training process of a clustering algorithm like K-means will benefit from PCA.
You can see that the classes are spread along PC1. We can plot the proportion of the total variance that each PC accounts for.
pr.sd <- pr.out$sdev # standard deviations
pr.var <- pr.sd ^ 2 # variance
pve <- pr.var/sum(pr.var) # proportion of variance explained
plot(pve[1:20],
xlab = 'Principal Component',
ylab = 'PVE',
type = 'b',
col = 'blue')

Principal Component one always has the greatest proportion of variance explained (PVE) followed by PC2 and PC3 etc. In my data, 40% of the variance is along PC1 alone. The PVE decreases from then on. We can see that the PC1 axis is the most important because the data is separated most along it. Therefore, PC1 will be the most valuable variable for a classifier to consider.
So for this dataset, how much can we reduce the dimensionality by? Let’s plot the cumulative proportion of variance explained against the number of PCs considered with cumsum.
cumsum(pve)
plot(cumsum(pve),
xlab = 'PC',
ylab = 'CPVE',
type = 'b',
col = 'red')

With just 50 PCs, we can half the dimensionalilty of the dataset while retaining over 90% of the variance of the data. Our classifier algorithm can learn to distinguish classes much more effieciently with less dimensions.
In summary then, PCA can reduce the dimensions of the dataset while keeping the most important infromation in the data.
epic
Just stumbled upon bongvip88! Got a good feeling about this site. Any thoughts from the community?
Alright, been messing around on xz88 lately, and I gotta say, it’s pretty solid. Gameplay’s smooth and I haven’t hit any snags. Check it out here: xz88
Yo, just giving f1686s a shoutout. Been having some decent runs. Website’s clean and easy to use. Give it a whirl, maybe you’ll get lucky: f1686s
98win10, huh? Yeah, I’ve dipped my toes in. It’s got a good vibe. Nothing earth-shattering, but definitely worth a look. Here’s the link: 98win10
Yo! For all my Macau sports fans, 7m ma cau is where it’s at. Straight to the point, no fluff, just the scores you need. 7m ma cau
I’m always checking this site for 7m.cn ma cao updates. Keeps me in the loop on all the action. So glad I found it 7m.cn ma cao.
I’ve discovered 7m.ma cao for tracking Macau sports results, and it is awesome! User friendly layout. You guys have to follow it! 7m.ma cao
Ròng bạch kim? Chơi cái này phải kiên nhẫn mới ăn được đó nha. Cứ từ từ rồi khoai sẽ nhừ. Chơi ngay ròng bạch kim đê ae.
Friv is a classic! Been playing on and off for years. Always good for a nostalgia trip and a surprisingly fun way to kill some time. Give it a try here: friv.
Good luck to everyone playing the Bạc Liêu lottery today! I’m hoping someone wins big! I plan to check xosobaclieu.info for tonight’s results. Find the results here: xổ số kiến thiết bạc liêu hôm nay
555okcasino is…okay so far haha. Nothing really stands out, but also nothing to complain about. Solid game selection, easy navigation. A good place to dip your toes in: 555okcasino
Been looking for a solid spot and I think I’ve found it! Baji365win has a great interface and everything is running smoothly. Might have found my new main destination. Decide for yourself using the link baji365win
Been spinning the rp8888slot lately and it’s been pretty good to me! Loads really fast even on my phone and payouts are smooth. Definitely worth a look if you’re trying to win some. See it here rp8888slot
Finally found a platform that actually pays out on time. The interface is very user-friendly and perfect for daily gaming. Highly recommend ph8k8o
Had a great experience with the bonuses here. It feels like the house actually wants you to win for once. Check out area188login and see for yourself.
Very reliable and transparent with their rules. It is refreshing to find a site that treats players fairly. My choice is phjilimk.
The graphics are top notch and the gameplay is very immersive. It is definitely one of the top choices for gaming in the region. See phjili90
Finally found a place where the deposits and withdrawals are actually quick. Using Skrill here makes everything so much easier. Give casinoskrill a shot if you hate waiting for your money.
The installation was a breeze and the login process is secure. I love how everything is just a click away with 93jililoginappapk
I really appreciate the fair play and the transparency of this site. It is hard to find such honest platforms these days. Check out 9ajilicom.
This place feels premium. The graphics are sharp and the gameplay is seamless. If you want a quality gaming session go for jiliglorycasino.
Super easy registration process and I was playing within minutes. The vibe here is just right. phjili6 is simply the best in the game.
Really impressed with the variety of games here. It feels very secure and the bonuses are actually generous. Big thanks to krsos888.
The best place for Jili fans in the Philippines. Everything is localized and the deposit methods are very convenient for us. ph500jili
Feeling like a real VIP here. The rewards are generous and the platform feels very premium. You should check out hn88vip for the best perks.
Fast deposits and even faster withdrawals. That is all I really care about and they nail it every time. Trustworthy service at bdf444
If you like Jili games, this is the place to be. The hit rate feels much better here compared to other sites. Give phjdbjili a try.
The variety of games here is insane. I spend hours playing and never get bored. Definitely check out pharionplaygame if you love gaming.
A solid choice for anyone who loves the casino vibe from home. Everything is organized perfectly and the wins feel rewarding. Big thumbs up for kcwincasino.
This place has a great vibe and the winning streaks are real. I’ve tried a few others but this one feels more rewarding. Definitely visit pkwof777.
The graphics are top notch and the gameplay is very fluid. I am spending a lot of my free time on vnnohu999 these days.
Best betting options for local players. The odds are competitive and the app is very user friendly. Big thumbs up for ph1xbetph.
Really impressed with the transparency and the fair play here. It feels like a community where players are actually valued. I am sticking with vnua88 from now on.
The app version is a total game changer. So much easier to navigate on my phone than the web version. Grab the app at k777bdapk now.
I’ve been looking for a reliable spot to play and this one really delivers. The interface is smooth and the payouts are fast. Definitely check out vntg88ok7 if you want a great experience.
Best Jili games I’ve played in a while. The graphics are crisp and the wins feel rewarding. Big shoutout to 178jilicasino for the top tier service.
I’ve been trying a few different platforms lately and this one really stands out. The interface is smooth and the payouts are fair. Definitely worth a shot for anyone looking for a reliable spot. Check out batikslot77
This place is honestly so much fun. The community is great and the games keep me entertained for hours. If you want a stress free gaming environment go for kr22fun.
The mobile version works perfectly and the graphics are top notch. It is my go to spot for gaming now. Visit phjljl7 for the best action.
Really impressed with the fast registration process. I was playing within two minutes of signing up. Big thumbs up for phwinph22.
The variety of games here is impressive. I spent all weekend exploring different tables and the experience was top-notch. Give vn89bet13 a try if you love diversity in betting.
Great experience overall. The registration process was a breeze and the games load instantly. I’m sticking with bat499 from now on.
This platform has a very unique feel and the rewards are actually generous. I am really enjoying my time on vnf16878vipp.
The payout speed is impressive and the games are always up to date. Highly recommend this platform to anyone looking for fun. Visit vncanohu today!
Love the promotions they run every weekend. It keeps the gameplay exciting and rewarding. I always suggest ph555taya to my buddies.
If you are looking for a site that actually pays out and doesn’t crash every five minutes, this is it. Super satisfied with bdbajji777 so far.
I’ve been playing here for a while now and the payouts are surprisingly fast. Definitely one of the most reliable spots I have found recently. Check out ph26phjoin for a great experience.
Such a chill vibe and the bonuses for new users are actually generous. I’ve tried many sites but bet55game stands out for its honesty.