Skip to content

Commit

Permalink
Merge branch 'master' into release/0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
AP6YC committed Nov 30, 2021
2 parents 87ba3d2 + 0b4930b commit 85f3b64
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions examples/art/dvfa_supervised.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""
ddvfa_supervised.jl
dvfa_supervised.jl
Description:
Train and test DDVFA in a supervised fashion on the Iris dataset.
Train and test DVFA in a supervised fashion on the Iris dataset.
Though DVFA is by definition an unsupervised clustering algorithm, a simple supervised learning mode can be done by replacing the internal incremental cluster labels with supervisory ones.
This is done to get a general understanding of the algorithm's performance in cases where supervised labels are available.
"""

using Logging
Expand All @@ -18,9 +21,13 @@ include("../../test/test_utils.jl")
# Load the data and test across all supervised modules
data = load_iris("data/Iris.csv")

# Train and classify
# Instantiate the DVFA module with default options
art = DVFA()

# Train with the simple supervised mode
y_hat_train = train!(art, data.train_x, y=data.train_y)

# Classify with and without the "best matching unit" option to compare performances
y_hat = classify(art, data.test_x)
y_hat_bmu = classify(art, data.test_x, get_bmu=true)

Expand All @@ -29,6 +36,7 @@ perf_train = performance(y_hat_train, data.train_y)
perf_test = performance(y_hat, data.test_y)
perf_test_bmu = performance(y_hat_bmu, data.test_y)

# Log the supervised training performances
@info "DVFA Training Perf: $perf_train"
@info "DVFA Testing Perf: $perf_test"
@info "DVFA Testing BMU Perf: $perf_test_bmu"

0 comments on commit 85f3b64

Please sign in to comment.