Liking cljdoc? Tell your friends :D

josh.meanings.records.cluster-result

Cluster results are the result of a clustering operationg. They contain a reference to the models centroids, the assignments which generated those centroids, the objective function cost of the clustering, the format that the cluster is saved in, and some configuration details about how the clustering process was run.

Callers who wish to use the cluster result can get access to the centroids with:

(.load-centroids cluster-result)

They can get access to the assignments with:

(.load-assignments-datasets cluster-result)

They can also cluster points with the cluster result with:

(.classify cluster-result x)

Where x is a vector of points in (-> cluster-result :configuration :col-names) order or a map that contains every col-name as a key.

To save a cluster result to disk

(.save-model cluster-result filename)

To load a cluster result from disk

(load-model filename)
Cluster results are the result of a clustering operationg.  They contain 
a reference to the models centroids, the assignments which generated those 
centroids, the objective function cost of the clustering, the format that 
the cluster is saved in, and some configuration details about how the clustering 
process was run.

Callers who wish to use the cluster result can get access to the centroids with:

```
(.load-centroids cluster-result)
```

They can get access to the assignments with:

```
(.load-assignments-datasets cluster-result)
```

They can also cluster points with the cluster result with:

```
(.classify cluster-result x)
```

Where x is a vector of points in `(-> cluster-result :configuration :col-names)` order or a map
that contains every col-name as a key.

To save a cluster result to disk

```
(.save-model cluster-result filename)
```

To load a cluster result from disk

```
(load-model filename)
```
raw docstring

classify-implcljmultimethod

Classifies the specified point using the cluster result.

The input must be either a vector of points in the order specified by the col-names configuration field, or a map with keys corresponding to the col-names field.

Returns the index of the centroid that is closest to the point.

Example usage:

(def cluster-result (load-model 'cluster-result.edn')) (def col-names (:col-names (:configuration cluster-result)))

;; classify a point vector (classify cluster-result [5.1 3.5 1.4 0.2])

;; classify a point map (classify cluster-result (zipmap col-names [5.1 3.5 1.4 0.2]))

Classifies the specified point using the cluster result.
  
The input must be either a vector of points in the order specified by the
`col-names` configuration field, or a map with keys corresponding to the 
`col-names` field.

Returns the index of the centroid that is closest to the point.

Example usage:

(def cluster-result (load-model 'cluster-result.edn'))
(def col-names (:col-names (:configuration cluster-result)))
  
;; classify a point vector
(classify cluster-result [5.1 3.5 1.4 0.2])
  
;; classify a point map
(classify cluster-result (zipmap col-names [5.1 3.5 1.4 0.2]))
sourceraw docstring

classify-mapclj

(classify-map this x)
source

classify-vectorclj

(classify-vector this point)
source

load-assignments-implclj

(load-assignments-impl this)

Loads the assignments dataset sequence from disk.

Loads the assignments dataset sequence from disk.
sourceraw docstring

load-centroids-implclj

(load-centroids-impl this)

Loads the centroids dataset sequence from disk.

Loads the centroids dataset sequence from disk.
sourceraw docstring

load-modelclj

(load-model filename)

Loads a ClusterResult from the specified filename. Returns the ClusterResult.

Example Usage

To load a model from disk, first you need to save a model. This can be done with the save-model method:

(.save-model (k-mean 'dataset.csv' 5) 'cluster-result.edn')

Then you can load that model from with the load-model function:

(load-model 'cluster-result.edn')

Loads a `ClusterResult` from the specified `filename`. Returns the `ClusterResult`.

__Example Usage__

To load a model from disk, first you need to save a model. This can be done 
with the `save-model` method:

`(.save-model (k-mean 'dataset.csv' 5) 'cluster-result.edn')`

Then you can load that model from with the load-model function:

`(load-model 'cluster-result.edn')`
sourceraw docstring

save-model-implclj

(save-model-impl this filename)

Saves the cluster result to disk. Returns the filename that the cluster result was saved to.

Example usage:

(save-model cluster-result 'cluster-result.edn')

Saves the cluster result to disk.  Returns the filename that the cluster result 
was saved to.

Example usage:

(save-model cluster-result 'cluster-result.edn')
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close