简体   繁体   中英

How to exclude attributes from clustering in PHP-ML?

I have students data and I want to cluster them according to there attributes. The problem is that the student_id shouldn't be used in the clustering process, because it has nothing to do with the clustering, and I cannot just remove the student_id, because I won't be able then to know what is the according cluster to each student. My Array has the following structure:

    Student_id  |   movies  |   chess   |   football    | ....
    ---------------------------------------------------------
    19324857        1           0           1           ...

Code

    $studentsInfo = [[1,1,0,0,1,1], [1,1,1,1,0,0], [0,1,1,0,0,1], ....];
    $kmeans = new KMeans(6);
    $kmeans->cluster(studentsInfo);

There's a solution to search after the clustering process for each student's parameters, and then find his cluster, but it's not practical and time consuming, and I'm working with a lot of entries.

PR 刚刚合并到 master 分支,因此您可以使用密钥作为某种标签;) http://php-ml.readthedocs.io/en/latest/machine-learning/clustering/k-means/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM