cnDiscretize: Data Categorization

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Soft and hard discretization of numerical data.

Usage

1
2
cnDiscretize(data, numcats=3, mode = "soft", marginal = "quantile",
learnset=NULL, cover=0.95, maxiter=100, eps=1e-8, weights=NULL)

Arguments

data

a numerical matrix or data.frame

numcats

an integer, the number of categories per node

mode

a character, the discretization method to be used, "soft" or "hard"

marginal

a character, the marginal model, "quantile", "uniform" or "gauss"

learnset

observation indices to be used for setting the discretization parameters

cover

a numerical between 0 and 1, proportion of the sample to be used for setting the discretization parameters

maxiter

an integer, maximum iterations for the mixture of Gaussians EM algorithm

eps

a numerical, convergence precision number

weights

a numerical, sample record weights

Details

The numerical data is discretized into given number of categories, numcats, using the empirical node quantiles. As in all functions of catnet package that accept data, if the data parameter is a matrix then it is organized in the row-node format. If it is a data.frame, the column-node format is assumed.

The mode specifies the discretization model. Currently, two hard discretization methods are supported - "quantile" and "uniform", which is the default choice. The quantile-based discretization method is applied as follows. For each node, the sample node distribution is constructed, which is then represented by a sum of non-intersecting classes separated by the quantile points of the sample distribution. Each node value is assigned the class index in which it falls into.

The uniform discretization breaks the range of values of each node into numcats equal intervals or of lengths proportional to the corresponding qlevels values.

Currently, the function assigns equal number of categories for each node of the data.

Value

A matrix or data.frame of indices.

Author(s)

N. Balov

See Also

cnSamples

Examples

1
2
3
  ps <- t(sapply(1:10, function(i) rnorm(20, i, 0.1)))
  dps1 <- cnDiscretize(data=ps, numcats=3, mode="hard", marginal="quantile")
  hist(dps1[1,])

sdnet documentation built on May 2, 2019, 12:43 a.m.