Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

(python) labeling points which are in the similar region of a 3-D coordinate system

There are 2000+ points in a 3-D sapce (as picture 1) . The points are classified into 7 groups by K-Means methods. the points in picture 1 are presented like this:

point_ID_1    x        y        z       group_label
    1       0.254    0.025      0.007        1
    2       0.201    0.078      0.081        1
    3       0.106    0.153      0.238        2
    4       0.052    0.015      0.084        3
    5       0.078    0.005      0.159        7
   ...       ...      ...        ...         ...

enter image description here

there are other 5000+ points in the same 3-D sapce (as picture 2) . The (x,y,z) of points in the picture 2 is different from the points in the picture 2. But their distribution ranges are very similar.

enter image description here

the point in picture are presented as :

point_ID_2    x        y          z       
    1       0.354    0.025      0.028       
    2       0.125    0.128      0.324
    3       0.068    0.292      0.221
    4       0.051    0.086      0.128
    5       0.028    0.081      0.082
   ...       ...      ...        ... 

I want to label the points in the same region of picture 2 and picture 1 with the same label, as the picture 3 shows. enter image description here

Noted that the points are not in the same surface but in a 3-D space

How can I do this? I searched the Internet for a long time but I didn’t find any solutions. Please help me. Thank you very much!

question from:https://stackoverflow.com/questions/66062856/python-labeling-points-which-are-in-the-similar-region-of-a-3-d-coordinate-sys

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When you classified the first 2000 points in a group with Kmeans you obtained a classifier. You can use this classifier to decide for the other 5000 points in which group they belong. If you used the Kmeans from scipy, then you can use the function sklearn.cluster.KMeans.predict() for this.

You can find information about this in the documentation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...