PDL::OpenCV wraps a kmeans function, so that might also help. Best regards, Ed ________________________________ From: Boyd Duffee <boyd.duf...@gmail.com> Sent: Wednesday, November 22, 2023 12:19 PM To: Aldobranti <aldobra...@gmail.com> Cc: pdl-general@lists.sourceforge.net <pdl-general@lists.sourceforge.net> Subject: Re: [Pdl-general] getting started with K-means
Hi Aldo, The documentation is pretty good. You can change the number of clusters like so my $k = $pdl->kmeans( {NCLUS => 10} ); There are also a few blog posts that show some of the process from a learners' perspective https://blogs.perl.org/users/enkidu/2019/12/its-beginning-to-look-a-lot-like-k-means.html There's not a lot of examples out there, so if you can blog your experience (good or bad), that'll add to the available docs for the next person. dev.to<http://dev.to> gets a lot of exposure these days. best of luck, Boyd On Wed, 22 Nov 2023 at 10:48, Aldobranti <aldobra...@gmail.com<mailto:aldobra...@gmail.com>> wrote: my problem area is to analyse electrical power switching events and tie back readings of reactive and resistive loads aiming to point back at specific items of plant hardware. So I thought cluster analysis and got a steer towards PDL In a perl script I write use PDL::Stats::KMeans; ... my $sql = "select resistv_chg,reactv_chg from metered_events where matched_event_id is not null"; my $pdl = rdbi2D( $dbh, $sql ); # pdl info tells me that i have a 2D array of ~ 1400 x 2 my $k = $pdl->kmeans( {} ); First up I see that this is not unrestrained -- the default of NCLUS is 3 and [seems to me] that I am being defeated in trying to identify between 10 and 20 clusters associated with the electrical characteristics of the 10 - 20 items in my plant being a simple minded chap all I want is an array[10] of mean and stdvars for the data set Could anybody spare the time to get me started? Aldo -- Aldobranti: A performance in digital social media and large sheets of photographic film https://aldobranti.org _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/pdl-general -- Boyd Duffee No pain, no French bread - Teresa Monachino
_______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general