Description Usage Arguments Value See Also Examples
Compute Silhouette (k-means clustering).
1 2 |
channel |
connection object as returned by |
km |
an object of class |
scaled |
logical: indicates if computation performed on original (default) or scaled values. |
silhouetteTableName |
name of the Aster table to hold silhouette scores. The table persists silhoutte scores
for all clustered elements. Set parameter |
drop |
logical: indicates if the table |
test |
logical: if TRUE show what would be done, only (similar to parameter |
computeSilhouette
returns an object of class "toakmeans"
(compatible with class "kmeans"
).
It adds a named list sil
the km
containing couple of elements: average value of silhouette value
and silhouette profile
(distribution of silhouette values on each cluster) profile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | if(interactive()){
# initialize connection to Lahman baseball database in Aster
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")
km = computeKmeans(conn, "batting", centers=5, iterMax = 25,
aggregates = c("COUNT(*) cnt", "AVG(g) avg_g", "AVG(r) avg_r", "AVG(h) avg_h"),
id="playerid || '-' || stint || '-' || teamid || '-' || yearid",
include=c('g','r','h'), scaledTableName='kmeans_test_scaled',
centroidTableName='kmeans_test_centroids',
where="yearid > 2000")
km = computeSilhouette(conn, km)
km$sil
createSilhouetteProfile(km, title="Cluster Silhouette Histograms (Profiles)")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.