Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ cran-comments.md
^CRAN-SUBMISSION$
^codecov\.yml$
revdep
.vscode
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ src/models/*.o
src/models/*.so
src/models/*.dll
docs
.vscode/settings.json
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: CEC
Type: Package
Title: Cross-Entropy Clustering
Version: 0.11.1
Date: 2024-01-08
Version: 0.11.2
Date: 2024-10-10
Authors@R: c(
person("Kamieniecki", "Konrad", email = "konrad.kamieniecki@alumni.uj.edu.pl",
role = c("aut")),
Expand Down Expand Up @@ -30,6 +30,6 @@ Imports:
utils
NeedsCompilation: yes
License: GPL-3
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Suggests:
covr
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# CEC v0.11.2

## New features

* N/A.

## Minor improvements and fixes

* Fixing CRAN NO_REMAP error with R > 4.5.0.

---

# CEC v0.11.1

## New features
Expand Down
73 changes: 4 additions & 69 deletions R/CEC-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,75 +14,10 @@
#'
#' @seealso \code{\link{cec}}
#'
#' @keywords package multivariate cluster models
#' @keywords internal package multivariate cluster models
#'
NULL


#' @title Four Gaussian Clusters
#'
#' @description Matrix of 2-dimensional points forming four Gaussian clusters.
#'
#' @name fourGaussians
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(fourGaussians)
#' plot(fourGaussians, cex = 0.5, pch = 19);
#'
NULL

"_PACKAGE"

#' @title Three Gaussian Clusters
#'
#' @description Matrix of 2-dimensional points forming three Gaussian clusters.
#'
#' @name threeGaussians
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(threeGaussians)
#' plot(threeGaussians, cex = 0.5, pch = 19);
#'
NULL


#' @title Mixed Shapes Clusters
#'
#' @description Matrix of 2-dimensional points that form circular and elliptical
#' patterns.
#'
#' @name mixShapes
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(mixShapes)
#' plot(mixShapes, cex = 0.5, pch = 19);
#'
NULL


#' @title T-Shaped Clusters
#'
#' @description Matrix of 2-dimensional points that form the letter T.
#'
#' @name Tset
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(Tset)
#' plot(Tset, cex = 0.5, pch = 19);
#'
## usethis namespace: start
## usethis namespace: end
NULL
14 changes: 7 additions & 7 deletions R/cec.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#' Possible values are: "covariance", "fixedr", "spherical", "diagonal",
#' "eigenvalues", "all" (default).
#'
#' Currently, if the \code{centers} argument is a vector, only a single type can
#' be used.
#' Currently, if the \code{centers} argument is a vector, only a single type
#' can be used.
#'
#' @param iter.max The maximum number of iterations of the clustering algorithm.
#'
Expand Down Expand Up @@ -62,8 +62,8 @@
#' visible in the results as NA in the "centers" matrix (as well as the
#' corresponding values in the list of covariances).
#'
#' @param interactive If \code{TRUE}, the result of clustering will be plotted after
#' every iteration.
#' @param interactive If \code{TRUE}, the result of clustering will be plotted
#' after every iteration.
#'
#' @param threads The number of threads to use or "auto" to use the default
#' number of threads (usually the number of available processing units/cores)
Expand Down Expand Up @@ -344,7 +344,7 @@ cec <- function(x,

card.min <- max(card.min, n + 1)
k <- max(var.centers)
startTime <- proc.time()
# startTime <- proc.time()

centers.r <- list(init.method = init.method.name,
var.centers = as.integer(var.centers),
Expand Down Expand Up @@ -378,7 +378,7 @@ cec <- function(x,
}

k.final <- nrow(Z$centers)
execution.time <- as.vector((proc.time() - startTime))[3]
# execution.time <- as.vector((proc.time() - startTime))[3]
Z$centers[is.nan(Z$centers)] <- NA
tab <- tabulate(Z$cluster)
probability <- vapply(tab, function(c.card) {
Expand Down Expand Up @@ -427,7 +427,7 @@ cec <- function(x,

structure(
list(data = x, cluster = Z$cluster, centers = Z$centers, probability = probability, cost.function = Z$energy,
nclusters = Z$nclusters, iterations = Z$iterations, time = execution.time, covariances = Z$covariances,
nclusters = Z$nclusters, iterations = Z$iterations, covariances = Z$covariances,
covariances.model = covariances.model, means.model = means.model),
class = "cec")
}
Expand Down
69 changes: 69 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,72 @@ mouseset <- function(n = 4000, r.head = 2, r.left.ear = 1.1, r.right.ear = 1.1,

M
}


#' @title Four Gaussian Clusters
#'
#' @description Matrix of 2-dimensional points forming four Gaussian clusters.
#'
#' @name fourGaussians
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(fourGaussians)
#' plot(fourGaussians, cex = 0.5, pch = 19);
#'
NULL


#' @title Three Gaussian Clusters
#'
#' @description Matrix of 2-dimensional points forming three Gaussian clusters.
#'
#' @name threeGaussians
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(threeGaussians)
#' plot(threeGaussians, cex = 0.5, pch = 19);
#'
NULL


#' @title Mixed Shapes Clusters
#'
#' @description Matrix of 2-dimensional points that form circular and elliptical
#' patterns.
#'
#' @name mixShapes
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(mixShapes)
#' plot(mixShapes, cex = 0.5, pch = 19);
#'
NULL


#' @title T-Shaped Clusters
#'
#' @description Matrix of 2-dimensional points that form the letter T.
#'
#' @name Tset
#'
#' @docType data
#'
#' @keywords datasets
#'
#' @examples
#' data(Tset)
#' plot(Tset, cex = 0.5, pch = 19);
#'
NULL
2 changes: 2 additions & 0 deletions man/CEC-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/Tset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/cec.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fourGaussians.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading