## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(fussclust)

## -----------------------------------------------------------------------------
X <- iris[, c("Sepal.Length", "Sepal.Width")] |> as.matrix()

cat(
  paste0(
    "Class of `iris`: ", class(iris),
    "; class of `X`: ",
    paste(class(X), collapse = " & ")
  )
)

## -----------------------------------------------------------------------------
model_fcm <- fussclust::FCM(X = X, C = 3)
model_pcm <- fussclust::PCM(X = X, C = 3)

## -----------------------------------------------------------------------------
model_fcm$V

## -----------------------------------------------------------------------------
model_pcm$U[1:10, ]

## -----------------------------------------------------------------------------
iris[1:3, ]

## -----------------------------------------------------------------------------
unique(iris$Species)

## -----------------------------------------------------------------------------
superF <- matrix(0, nrow = nrow(iris), ncol = 3)

superF[iris$Species == "setosa", 1] <- 1
superF[iris$Species == "versicolor", 2] <- 1
superF[iris$Species == "virginica", 3] <- 1

## -----------------------------------------------------------------------------
model_ssfcm <- fussclust::SSFCM(
  X = X,
  C = 3,
  alpha = 1,
  superF = superF
)

## -----------------------------------------------------------------------------
model_sspcm <- fussclust::SSPCM(
  X = X,
  C = 3,
  alpha = 1,
  superF = superF
)

## -----------------------------------------------------------------------------
model_ssfcm$V

## -----------------------------------------------------------------------------
model_sspcm$V

## ----eval = FALSE-------------------------------------------------------------
# model_pcm_init <- fussclust::PCM(
#   X = X,
#   C = 3,
#   initFCM = TRUE
# )

## ----eval = FALSE-------------------------------------------------------------
# model_pcm_custom_gammas <- fussclust::PCM(
#   X = X,
#   C = 3,
#   gammas = c(1, 2, 3)
# )

## -----------------------------------------------------------------------------
model_fcm$U_history

## -----------------------------------------------------------------------------
model_fcm_history <- fussclust::FCM(
  X = X,
  C = 3,
  store_history = TRUE
)

cat(
  paste0(
    "Class of `model_fcm_history$U_history`: ",
    class(model_fcm_history$U_history),
    "; length: ",
    length(model_fcm_history$U_history),
    "; number of AO iterations: ",
    model_fcm_history$counter
  )
)

## -----------------------------------------------------------------------------
model_fcm_history$V_history[[3]]

