1. 以管理员身份进入FATE容器
[root@localhost cen]# docker exec -it fate_python bash
2.编辑配置upload_data_host.json(upload_data_guest.json)文件,主要修改file,? table_name,? namespace字段
vim /fate/examples/dsl/v1/upload_data_host.json
修改内容
{
"file": "examples/data/breast_homo_host.csv",
"head": 1,
"partition": 10,
"work_mode": 0,
"table_name":"breast_homo_host", //指定DTable表名
"namespace": "experiment" //指定DTable表名的命名空间
}
3.执行upload命令,将原始的本地文件breast_homo_host 转换为DTable格式
python /fate/python/fate_flow/fate_flow_client.py -f upload -c /fate/examples/dsl/v1/upload_data_host.json
4. 接下来是模型训练,主要包括对dsl文件和conf文件的编辑
vim /fate/examples/dsl/v1/homo_logistic_regression/test_homolr_train_job_dsl.json
dsl文件来描述任务模块,将任务模块以有向无环土的形式组合在一起
{
"components" : {
"dataio_0": { //数据I/O组件,将本地数据转化为DTable形式
"module": "DataIO",
"input": {
"data": {
"data": [
"args.train_data"
]
}
},
"output": {
"data": ["train"],
"model": ["dataio"]
}
},
"dataio_1": {
"module": "DataIO",
"input": {
"data": {
"data": [
"args.eval_data"
]
},
"model":["dataio_0.dataio"]
},
"output":{
"data":["eval_data"]
}
},
"homo_lr_0": { //横向逻辑回归组件
"module": "HomoLR",
"input": {
"data": {
"train_data": [
"dataio_0.train"
]
}
},
"output": {
"data": ["train"],
"model": ["homolr"]
}
},
"homo_lr_1":{
"module":"HomoLR",
"input":{
"data":{
"eval_data":[
"dataio_1.eval_data"
]
},
//模型评估组件,若无测试数据集,则自动使用训练数据集进行模型评估
"evaluation_0": {
"module": "Evaluation",
"input": {
"data": {
"data": [
"homo_lr_0.train"
5? conf文件用来描述所有参数信息需要修改role_parameter字段下的train_data,l? label_name表示的是标签列对应的属性名。
"role_parameters": {
"guest": {
"args": {
"data": {
"train_data": [
{
"name": "CM1_guest",
"namespace": "experiment"
}
],
"eval_data":[{
"name":"homo_breast_test",
"namespace":"experiment"
}]
}
},
"dataio_0":{
"with_label":[true],
"label_name":["y"],
"label_type":["int"],
"output_format":["dense"]
}
},
"host": {
"args": {
"data": {
"train_data": [
{
"name": "KC1_host",
"namespace": "KC1_host"
}
],
"eval_data":[{
"name":"homo_breast_test",
"namespace":"KC1_host"
}]
}
},
"dataio_0":
{
"with_label":[true],
"label_name":["y"],
"label_type":["int"],
"output_format":["dense"]
},
6.执行submit_job命令,评估函数
python /fate/python/fate_flow/fate_flow_client.py -f submit_job -c /fate/examples/dsl/v1/homo_logistic_regression/test_homolr_evaluate_job_conf.json -d/fate/examples/dsl/v1/homo_logistic_regression/test_homolr_evaluate_job_dsl.json
7. 输入虚拟机IP:8080
|