我将拼花文件上传到files存储器,并通过Azure创建了一个数据资产。这些步骤是准确和明确的,结果也是理想的。为了将来的使用,我想使用CLI来创建数据资产和它的新版本。
基本命令是az ml create data -f <file-name>.yml。文档提供了一个极小的例子文件的MLTable文件,该文件应该驻留在地板文件旁边。
# directory in blobstorage
├── data
│ ├── MLTable
│ ├── file_1.parquet
.
.
.
│ ├── file_n.parquet我仍然不确定如何正确指定这些文件,以便创建具有列转换的表格数据集。
是否需要在yml文件中指定完整路径或模式?
$schema: https://azuremlschemas.azureedge.net/latest/data.schema.json
type: mltable
name: Test data
description: Basic example for parquet files
path: azureml://datastores/workspaceblobstore/paths/*/*.parquet # pattern or path to dir?对于MLTable文件,我有更多的困惑:
type: mltable
paths:
- pattern: ./*.parquet
transformations:
- read_parquet:
# what comes here?例如,我有一列带有格式%Y-%m%d %H:%M:%S的日期,应该转换为时间戳。(我至少可以在GUI中提供这些信息!)
有关此主题的任何帮助或指向文档的隐藏链接都将是很棒的。
发布于 2022-11-15 14:23:22
转换字符串列与拼图文件的工作MLTable文件如下所示:
---
type: mltable
paths:
- pattern: ./*.parquet
transformations:
- read_parquet:
include_path_column: false
- convert_column_types:
- columns: column_a
column_type:
datetime:
formats:
- "%Y-%m-%d %H:%M:%S"
- convert_column_types:
- columns: column_b
column_type:
datetime:
formats:
- "%Y-%m-%d %H:%M:%S"(顺便说一句,在编写此命令时,将多列指定为数组不起作用,例如columns: [column_a, column_b])
发布于 2022-10-03 08:29:03
为了执行这个操作,我们需要检查实验的安装和要求。我们需要有效的订阅和工作区。
安装所需的mltable库。
Azure ML中有4种不同的支持路径作为参数
·本地计算机路径
*在公共服务器上的路径,如HTTP/HTTPS
·天蓝色存储的路径(如本例中的blob )
·数据存储的路径
在作为断言文件名创建的文件夹中创建YAML文件可以是任何东西(filename.yml)
$schema: https://azuremlschemas.azureedge.net/latest/data.schema.json
type: uri_folder
name: <name_of_data>
description: <description goes here>
path: <path>
to create the data assert using CLI.
az ml data create -f filename.yml将特定文件创建为数据资产
$schema: https://azuremlschemas.azureedge.net/latest/data.schema.json
# Supported paths include:
# local: ./<path>/<file>
# blob: https://<account_name>.blob.core.windows.net/<container_name>/<path>/<file>
# ADLS gen2: abfss://<file_system>@<account_name>.dfs.core.windows.net/<path>/<file>
# Datastore: azureml://datastores/<data_store_name>/paths/<path>/<file>
type: uri_file
name: <name>
description: <description>
path: <uri>所有路径都需要根据您的工作区凭据来说明。
若要将MLTable文件创建为数据资产,请执行以下操作。
使用数据模式创建一个yml文件,如下所示
type: mltable
paths:
- pattern: ./*.filetypeextension
transformations:
- read_delimited:
delimiter: ,
encoding: ascii
header: all_files_same_headers使用下面的python代码来使用MLTable
import mltable
table1 = mltable.load(uri="./data")
df = table1.to_pandas_dataframe()若要创建MLTable数据资产,请执行以下操作。使用下面的代码块。
$schema: https://azuremlschemas.azureedge.net/latest/data.schema.json
# path must point to **folder** containing MLTable artifact (MLTable file + data
# Supported paths include:
# blob: https://<account_name>.blob.core.windows.net/<container_name>/<path>
type: mltable
name: <name_of_data>
description: <description goes here>
path: <path>Blob是当前需求中的存储机制。
相同的过程用于创建MLTable的数据资产。
az ml data create -f <file-name>.ymlhttps://stackoverflow.com/questions/73906466
复制相似问题