将数据从输入数据集转换为输出数据集。
用法
rxFeaturize(data, outData = NULL, overwrite = FALSE, dataThreads = NULL,
randomSeed = NULL, maxSlots = 5000, mlTransforms = NULL,
mlTransformVars = NULL, rowSelection = NULL, transforms = NULL,
transformObjects = NULL, transformFunc = NULL, transformVars = NULL,
transformPackages = NULL, transformEnvir = NULL,
blocksPerRead = rxGetOption("blocksPerRead"),
reportProgress = rxGetOption("reportProgress"), verbose = 1,
computeContext = rxGetOption("computeContext"), ...)
参数
data
RevoScaleR 数据源对象、数据帧或指向 .xdf 文件的路径。
outData
输出文本或 xdf 文件名或其中具有写入功能的 RxDataSource,用于存储转换后的数据。 如果为 NULL,则返回数据帧。 默认值是 NULL。
overwrite
如果为 TRUE,则覆盖现有的 outData;如果为 FALSE,则不覆盖现有的 outData。 默认值为 /codeFALSE。
dataThreads
一个整数,指定数据管道中所需的并行度。 如果为 NULL,则使用的线程数在内部确定。 默认值是 NULL。
randomSeed
指定随机种子。 默认值是 NULL。
maxSlots
向量值列要返回的最大槽数(<=0 表示返回所有槽)。
mlTransforms
指定在训练前要对数据执行的 MicrosoftML 转换的列表;如果不需要执行任何转换,则指定为 NULL。 有关支持的转换,请参阅 featurizeText、categorical 和 categoricalHash。 这些转换在任何指定的 R 转换之后执行。 默认值是 NULL。
mlTransformVars
指定要在 mlTransforms 中使用的变量名称的字符向量;如果不使用任何变量名称,则指定为 NULL。 默认值是 NULL。
rowSelection
使用数据集中的逻辑变量名称(带引号)或通过使用数据集中的变量的逻辑表达式指定模型要使用的数据集中的行(观察值)。 例如,rowSelection = "old" 将仅使用变量 old 的值为 TRUE 的观察值。
rowSelection = (age > 20) & (age < 65) & (log(income) > 10) 仅使用 age 变量值介于 20 和 65 之间且 income 变量的 log 值大于 10 的观察值。 在处理任何数据转换之后执行行选择(请参阅参数 transforms 或 transformFunc)。 与所有表达式一样,可以使用表达式函数在函数调用之外定义 rowSelection。
transforms
表示第一轮变量转换的窗体 list(name = expression, ``...) 的表达式。 与所有表达式一样,可以使用表达式函数在函数调用之外定义 transforms(或 rowSelection)。 默认值是 NULL。
transformObjects
一个命名列表,其中包含可由 transforms、transformsFunc 和 rowSelection 引用的对象。 默认值是 NULL。
transformFunc
变量转换函数。 有关详细信息,请参阅 rxTransform。 默认值是 NULL。
transformVars
转换函数所需的输入数据集变量的字符向量。 有关详细信息,请参阅 rxTransform。 默认值是 NULL。
transformPackages
一个字符向量,用于指定将提供和预加载以在变量转换函数中使用的附加 R 包(在 rxGetOption("transformPackages") 中指定的包之外)。 例如,在 RevoScaleR 函数中通过 transforms 和 transformFunc 参数显式定义的那些包,或者通过 formula 或 rowSelection 参数隐式定义的包。
transformPackages 参数也可能为 NULL,表示未预加载 rxGetOption("transformPackages") 以外的包。 默认值是 NULL。
transformEnvir
用户定义环境,充当内部开发并用于变量数据转换的所有环境的父级。 如果为 transformEnvir = NULL,则改用具有父级 baseenv() 的新“哈希”环境。默认值为 NULL。
blocksPerRead
为从数据源读取的每个数据块指定要读取的块数。
reportProgress
一个整数值,指定行处理进度的报告级别:
-
0:不报告进度。 -
1:打印并更新已处理的行数。 -
2:报告已处理的行数和计时。 -
3:报告已处理的行数和所有计时。
默认值是1。
verbose
一个整数值,指定需要的输出量。 如果为 0,则计算期间不会打印详细输出。 从 1 到 4 的整数值表示提供的信息量逐步增加。 默认值是 1。
computeContext
设置执行计算的上下文,使用有效的 RxComputeContext 指定。 目前支持本地和 RxInSqlServer 计算上下文。
...
要直接传递到 Microsoft 计算引擎的其他参数。
值
表示创建的输出数据的数据帧或 RxDataSource 对象。
作者
Microsoft Corporation Microsoft Technical Support
另请参阅
rxDataStep、rxImport、rxTransform。
示例
# rxFeaturize basically allows you to access data from the MicrosoftML transforms
# In this example we'll look at getting the output of the categorical transform
# Create the data
categoricalData <- data.frame(
placesVisited = c(
"London",
"Brunei",
"London",
"Paris",
"Seria"
),
stringsAsFactors = FALSE
)
# Invoke the categorical transform
categorized <- rxFeaturize(
data = categoricalData,
mlTransforms = list(categorical(vars = c(xDataCat = "placesVisited")))
)
# Now let's look at the data
categorized