Andrew Ng 's machine learning lecture note (14)

本文探讨了无监督学习的基本概念,介绍了K-means聚类算法及其实施步骤,并讨论了如何选择合适的聚类数量。此外,还讲解了主成分分析(PCA)这一降维方法,说明了其在数据可视化、压缩及提高计算效率方面的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Unsupervised learning

(1)In unsupervised learning, data have no labels which means they don't have yi {i=1~m} 

(2)Data has its own structure and a algorithm which can find clusters are called clustering.

K means algorithm

It's a algorithm that can separate the data set into several subsets with the same structure. Here're steps to implement it
suppose that you have m training examples.

Randomly initialize the u1,u2,u3... uK. K means you want to have k clusters
Repeat itself        //it's a iterate algorithm so it's necessary to set how many times you should repeat
{
    
    for i = 1:m
          c(i) = min||x(i) - uk||    //the right part should return the index k   

    for i = 1:K
        ui = the average of the same value c(i)'s x(i)

Optimization objective

In unsupervised learning we have the objective : 

Randomly initialize u(k) { k = 1,2 , ......K}

(1)We should have K integer numbers { i(1) i(2) ...i(K) } , those numbers ranging from 1 to m.
(2)u(1) u(2) ... u(k) = x(i(1)) x(i(2)) x(i(K))

(3)We can plot the cost function correspond to this randomness and we should choose the least cost's initialization. 

How many clusters should we choose?

(1)We can plot the cost function correspond to cluster number, then we can choose the elbow joint as our cluster number. 

Dimensionality reduction

Dimensionality reduction can help us visualize the data and can compress the data and also can accelerate the computing process.

PCA algorithm

PCA algorithm can help us reduce the dimension from n to k which is smaller than n. In order to use the PCA, we need to know how we choose number k. Here are the steps:
First the x(i) may be used feature scaling first.
then :

We use PCA only when we have a strong proof that we need a higher computing speed or more disk space.

Remember that PCA can be used on supervised learning, and we can map the input to a lower dimension on the training set , for the new input we can use the same mapping method.

Reconstruct from compressed representation

Remember that the result is only the approximation
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值