找回密码
 注册
查看: 280|回复: 0

R语言 sets包 gset()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 01:33:50 | 显示全部楼层 |阅读模式
gset(sets)
gset()所属R语言包:sets

                                        Generalized sets
                                         广义套

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Creation and manipulation of generalized sets.
创建和操作的广义集。


用法----------Usage----------


gset(support, memberships, charfun, elements, universe, bound)
as.gset(x)
is.gset(x)
gset_support(x)
gset_core(x, na.rm = FALSE)
gset_peak(x, na.rm = FALSE)
gset_height(x, na.rm = FALSE)
gset_universe(x)
gset_bound(x)

gset_memberships(x, filter = NULL)
gset_transform_memberships(x, FUN, ...)
gset_concentrate(x)
gset_dilate(x)
gset_normalize(x, height = 1)
gset_defuzzify(x, method = c("meanofmax", "smallestofmax", "largestofmax", "centroid"))

gset_is_empty(x, na.rm = FALSE)
gset_is_subset(x, y, na.rm = FALSE)
gset_is_proper_subset(x, y, na.rm = FALSE)
gset_is_equal(x, y, na.rm = FALSE)
gset_contains_element(x, e)

gset_is_set(x, na.rm = FALSE)
gset_is_multiset(x, na.rm = FALSE)
gset_is_fuzzy_set(x, na.rm = FALSE)
gset_is_set_or_multiset(x, na.rm = FALSE)
gset_is_set_or_fuzzy_set(x, na.rm = FALSE)
gset_is_fuzzy_multiset(x)
gset_is_crisp(x, na.rm = FALSE)
gset_has_missings(x)

gset_cardinality(x, type = c("absolute", "relative"), na.rm = FALSE)
gset_union(...)
gset_sum(...)
gset_difference(...)
gset_product(...)
gset_mean(x, y, type = c("arithmetic", "geometric", "harmonic"))
gset_intersection(...)
gset_symdiff(...)
gset_complement(x, y)
gset_power(x)
gset_cartesian(...)
gset_combn(x, m)

e(x, memberships = 1L)
is_element(e)

## S3 method for class 'gset'
cut(x, level = 1, type = c("alpha", "nu"), strict = FALSE, ...)
## S3 method for class 'gset'
mean(x, ..., na.rm = FALSE)
## S3 method for class 'gset'
median(x, na.rm = FALSE)
## S3 method for class 'gset'
length(x)



参数----------Arguments----------

参数:x
For e(), as.gset() and is.gset(): an R object. A (g)set object otherwise. gset_memberships() also accepts tuple objects.
e(),as.gset()和is.gset():R对象。 A(G)集对象,否则。 gset_memberships()也可以接受的元组对象。


参数:y
A (g)set object.
A(G)集对象。


参数:e
An object of class element.
对象的类element。


参数:filter
Optional vector of elements to be filtered.
可选的元素向量进行过滤。


参数:m
Number of elements to choose.
选择的元素的数量。


参数:support
A set of elements giving the support of the gset (elements with non-zero memberships). Must be a subset of the universe, if specified.
给予支持GSET(元素与非零籍)的一组的元素。必须是宇宙的一个子集,如果指定的话。


参数:memberships
For an (“ordinary”) set: 1L (or simply missing). For a fuzzy set: a value between 0 and 1.  For a multiset: a positive integer.  For a fuzzy multiset: a list of multisets with elements from the unit interval (or a list of vectors interpreted as such). Otherwise, the argument will be transformed using as.gset.  
(“普通”)组:1L(或失踪)。对于一个模糊集:0和1之间的值。对于multiset的:一个正整数。对于一个模糊multiset的:从单位间隔(或向量的列表,这样的解释为)的多重集的元素的列表。否则,该参数将被转换使用as.gset。


参数:elements
A set (or list) of e objects which are object/memberships-pairs.
e对象的对象/会员资格对一组(或列表)。


参数:charfun
A function taking an object and returning the membership.
一个函数对象并返回的成员。


参数:bound
Integer used to compute the absolute complement for (fuzzy) multisets. If NULL, defaults to the value of sets_options("bound"). If the latter is also NULL, the maximum multiplicity will be used in computations.
整数,用于计算绝对的补充(模糊的)多集。如果NULL,默认的价值sets_options("bound")。如果是后者也NULL,最大多重将在计算中使用。


参数:FUN
A function, to be applied to a membership vector.
一个函数,要施加到成员资格向量。


参数:type
For gset_cardinality(): cardinality type (either "absolute" or "relative"). For gset_mean(): mean type ("arithmetic", "geometric", or "harmonic"). For "cut": either "alpha" or "nu".
对于gset_cardinality():基数类型("absolute"或"relative")。对于gset_mean():平均型("arithmetic","geometric",或"harmonic")。对于"cut"是"alpha"或"nu"。


参数:strict
Logical indicating whether the cut level must be  exceeded strictly (“greater than”) or not (“greater than or equal”).
逻辑指示的切割水平是否严格必须超过(“大于”)或没有(“大于或等于”)。


参数:height
Double from the unit interval for scaling memberships.
双击缩放成员资格的单位间隔。


参数:universe
An optional set of elements. If NULL, defaults to the value of sets_options("universe"). If the latter is also NULL, the support will be used in computations.
一组可选的元素。如果NULL,默认的价值sets_options("universe")。如果是后者也NULL,支撑将在计算中使用。


参数:method
"centroid" computes the arithmetic mean of the set elements, using the membership values as weights. "smallestofmax" / "meanofmax" / "largestofmax" returns the minimum/mean/maximum of all set elements with maximal membership degree.
"centroid"的集合元素计算的算术平均值,作为权重,使用的隶属函数值。 "smallestofmax"/"meanofmax"/"largestofmax"返回最小/平均/最大隶属度最大的集合元素。


参数:level
The minimum membership level.
成员的最低水平。


参数:na.rm
logical indicating whether NA values should be removed.
逻辑是否NA值应该被删除。


参数:...
For gset_<VAR>foo</VAR>(): (g)set objects.  For the mean and sort methods: additional parameters internally passed to mean and order, respectively. For gset_transform_memberships: further arguments passed to FUN. For cut: currently not used.
对于gset_<VAR>foo</VAR>():(G)集对象。内部的平均值和排序方法:额外的参数传递给mean和order,。对于gset_transform_memberships:进一步参数传递给FUN。对于cut:目前没有使用。


Details

详细信息----------Details----------

These functions represent basic infrastructure for handling generalized sets of general (R) objects.
这些功能代表的基础设施,以处理一般(R)对象的广义套。

A generalized set (or gset) is set of pairs (e, f), where e is some set element and f is the characteristic (or membership) function. For (&ldquo;ordinary&rdquo;) sets f maps to \{0, 1\}, for fuzzy sets into the unit interval, for multisets into the natural numbers, and for fuzzy multisets f maps to the set of multisets over the unit interval.
一个的广义集(或GSET)设置对(e, f),其中e是一些元素和f的特点(或成员)的功能。 (“普通”)设置f图\{0, 1\},到单位的时间间隔,为自然数多集,模糊集和模糊多重f图的集合多重集的单位时间间隔内。

The gset_is_<VAR>foo</VAR>() predicates are vectorized. In addition to the methods defined, one can use the following operators: | for the union, &amp; for the intersection, + for the sum, - for the difference,  %D% for the symmetric difference, * and ^<VAR>n</VAR> for the (n-fold) cartesian product, 2^ for the power set, %e% for the element-of predicate, < and <= for the (proper) subset predicate, > and >= for the (proper) superset predicate, and == and != for (in)equality. The Summary methods do also work if defined for the set elements.  The mean and median methods try to convert the object to a numeric vector before calling the default methods. set_combn returns the gset of all subsets of specified length.
gset_is_<VAR>foo</VAR>()谓词的量化。除了定义的方法,可以使用下列运算符:|工会,&amp;的交集,+的总和,-的差异, %D%的对称差,*和^<VAR>n</VAR>(n倍)笛卡尔积,2^电源设置,%e%为元素的谓词,<和<=(正确)的子集的谓词,>和>=(正确的)超谓词,和== 和!=(中)的平等。 Summary方法工作,如果定义的集合元素。 mean和median方法试图将对象转换为一个数值向量,然后再调用默认的方法。 set_combn返回GSET所有指定长度的子集。

gset_support, gset_core, and gset_peak return the set of elements with memberships greater than zero, equal to one, and equal to the maximum membership, respectively. gset_memberships returns the membership vector(s) of a given (tuple of) gset(s), optionally restricted to the elements specified by filter. gset_height returns only the largest membership degree. gset_cardinality computes either the absolute or the relative cardinality, i.e. the memberships sum, or the absolute cardinality divided by the number of elements, respectively. The length method for gsets gives the (absolute) cardinality. gset_transform_memberships applies function FOO to  the membership vector of the supplied gset and returns the transformed gset. The transformed memberships are guaranteed to be in the unit interval. gset_concentrate and gset_dilate are convenience functions, using the square and the square root, respectively. gset_normalize divides the memberships by their maximum and scales with height. gset_product (gset_mean) of some gsets compute the gset with the corresponding memberships multiplied (averaged).
gset_support,gset_core,和gset_peak返回组元素与成员资格大于零,等于1,和分别等于最大隶属。 gset_memberships返回成员向量(s)的一个给定的(元组)GSET(),任选的元素限制在指定的filter。 gset_height只返回最大隶属度。 gset_cardinality计算的绝对或相对基数,即籍总和,或绝对基数除以元素的数目,分别。 length为gsets方法给出了(绝对)的基数。 gset_transform_memberships适用于功能FOO所提供的GSET的成员资格向量,并返回转换后的GSET。转化的成员资格是保证在单位时间间隔。 gset_concentrate和gset_dilate是方便的功能,使用的平方和的平方根,分别。 gset_normalize将其最大和规模的会员资格与height。 gset_product(gset_mean),一些gsets计算GSET与乘以的对应的成员资格(平均)。

The cut method provides both &alpha;- and &nu;-cuts. &alpha;-cuts &ldquo;filter&rdquo; all elements with memberships greater than (or equal to) level&mdash;the result, thus, is a crisp (multi)set. &nu;-cuts select those elements with a multiplicity exceeding level (only sensible for (fuzzy) multisets).
cut方法提供了&alpha; - &nu;-削减。 &alpha;-切割“过滤器”的所有元素与成员资格大于(或等于)level-的结果,因此,是一个清晰的(多)的集。 &nu;切选择这些元素的多重超过level(唯一明智的(模糊的)多集)。

Because set elements are unordered, it is not allowed to use positional indexing. However, it is possible to do indexing using element labels or simply the elements themselves (useful, e.g., for subassignment). In addition, it is possible to iterate over all elements using for and lapply/sapply.
由于集合的元素是无序的,它是不允许使用位置索引。但是,它是能够使用元素标签或简单的元素本身(有用的,例如,用于subassignment)做索引。此外,它是可以重复使用for和lapply/sapply的所有元素。

gset_contains_element is vectorized in e, that is, if e is an atomic vector or list, the is-element operation is performed element-wise, and a logical vector returned. Note that, however, objects of class tuple are taken as atomic objects to correctly handle sets of tuples.
gset_contains_element矢量化e,也就是说,如果e是一个的原子向量或列表,是件工作是明智的元素,并返回一个逻辑向量。请注意,但是,对象的类tuple原子对象正确处理元组套。


参考文献----------References----------

Generalized and customizable sets in R, Journal of Statistical Software 31(2), 1&ndash;27. http://www.jstatsoft.org/v31/i02/

参见----------See Also----------

set for &ldquo;ordinary&rdquo; sets,  gset_outer, and tuple for tuples (&ldquo;vectors&rdquo;).
set“普通”组,gset_outer和tuple的元组(“向量”)。


实例----------Examples----------


## multisets[#多集]
(A <- gset(letters[1:5], memberships = c(3, 2, 1, 1, 1)))
(B <- gset(c("a", "c", "e", "f"), memberships = c(2, 2, 1, 2)))
rep(B, 2)
gset_memberships(tuple(A, B), c("a","c"))

gset_union(A, B)
gset_intersection(A, B)
gset_complement(A, B)

gset_is_multiset(A)
gset_sum(A, B)
gset_difference(A, B)

## fuzzy sets[#模糊集]
(A <- gset(letters[1:5], memberships = c(1, 0.3, 0.8, 0.6, 0.2)))
(B <- gset(c("a", "c", "e", "f"), memberships = c(0.7, 1, 0.4, 0.9)))
cut(B, 0.5)
A * B
A <- gset(3L, memberships = 0.5, universe = 1:5)
!A

## fuzzy multisets[#模糊多重]
(A <- gset(c("a", "b", "d"),
         memberships = list(c(0.3, 1, 0.5), c(0.9, 0.1), gset(c(0.4, 0.7), c(1, 2)))))
(B <- gset(c("a", "c", "d", "e"),
         memberships = list(c(0.6, 0.7), c(1, 0.3), c(0.4, 0.5), 0.9)))
gset_union(A, B)
gset_intersection(A, B)
gset_complement(A, B)

## other operations[#其他业务]
mean(gset(1:3, c(0.1,0.5,0.9)))
median(gset(1:3, c(0.1,0.5,0.9)))

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-21 07:29 , Processed in 0.020116 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表