我目前正在使用R在Azure Machine Learning中使用CLIv2创建一个机器学习作业。我有一个仓库,我已经加载到AML与类似的结构如下。
的数据
我目前正在努力理解从我的数据存储加载数据,更具体地说,是从注册的数据资产加载数据。我不确定如何在r scripts optparse函数中引用该数据资产。我试图指向的特定路径是uri_file。
的
YAML
command: >
Rscript r-source.R
--data_file ${{inputs.datafile}}
code: src # this is the code directory
inputs:
datafile: # this is a registered data asset
type: uri_file
path: azureml:versiontest@latest <--- I think this is right
字符串
R脚本
library(optparse)
parser <- OptionParser()
parser <- add_option(
parser,
"--data_file",
type = "character",
action = "store",
default = "" <-- not sure what goes here, or how to reference the data asset
)
args <- parse_args(parser)
型
在单击实际数据资产时,只需添加相对路径,就可以成功运行作业。但是,不确定如何从这里拉取数据或证明数据已加载。
1条答案
按热度按时间xzabzqsa1#
default
只是在没有参数传递给脚本时要使用的值。你想怎么样就怎么样。参见https://cran.r-project.org/web/packages/optparse/optparse.pdf
要查看是否成功获取数据,请读取数据并在R中显示,例如,如果它是csv文件,请用途:
字符串