Skip to content

Double dispatch for #fit: method #2

@hernanmd

Description

@hernanmd

Currently I'm using k-means with DataFrame as follows:

| df kmeans |
df := Datasets loadIris columnsFrom: 1 to: 4.
kmeans := KMeans numberOfClusters: 3.
kmeans fit: (df asArrayOfRows collect: #asArray).

It would be nice if the argument to #fit: could be just the DataFrame, which knows how to be fitted with a KMeans algorithm:

kmeans fit: df

This way fit could receive also PMMatrix and similar matrix-like objects. And each one is responsible to implement:

DataFrame>>fitKMeans: aKmeans
  aKmeans fit: (self asArrayOfRows collect: #asArray).

and so on...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions