Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of error reporting after dimension reduction of artificial intelligence PCA

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to solve the problem of error reporting after the dimension reduction of artificial intelligence PCA". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to solve the problem of error reporting after artificial intelligence PCA dimension reduction"!

Question: if the number of feature after PCA dimensionality reduction is less than the number of samples, why do you report an error? once the n_components is changed to more than 230, there will be errors in the screenshot, that is:

ValueError: n_components=250 must be between 0 and min (n_samples, n_features) = 230with svd_solver='full'

Answer:

Keep in mind that PCA dimensionality reduction is still achieved by reducing features, not the number of samples. Therefore, after dimensionality reduction, the number of samples is unchanged, and the number of feature will be reduced.

Why is there an error in the number of excess samples after pca dimensionality reduction? This is determined by the algorithm itself, which requires that the number of feature after dimensionality reduction is less than the number of samples:

Considering the principle of pca dimensionality reduction, if we want to reduce it to n-dimension, we need to construct an n-dimensional projection space, which is determined by the number of 1 samples. If the number of samples is too small, we can not get an effective projection space. Take the simplest example:

To project a data point onto a straight line, which is understood as projection to one-dimensional space, it is necessary to have two or more points, so that a straight line can be determined and the sum of the distance between the sample and the straight line can be minimized. If there is only one point, there are countless straight lines. Therefore, the number of samples is greater than one.

At this point, I believe you have a deeper understanding of "how to solve the problem of error reporting after artificial intelligence PCA dimensionality reduction". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report