Python库,广泛用于所有人工智能项目
DXC-Industrialized-AI-Starter的Python项目详细描述
DXC工业化人工智能起动器
DXC工业化的人工智能起动器使你很容易部署你的人工智能算法(工业化)。如果您是一名数据科学家,正在研究您希望在整个企业中部署的算法,DXC的工业化AI starter使您更容易:
- 访问、清理和浏览原始数据
- 构建数据管道
- 运行人工智能实验
- 发布微服务
安装
为了安装和使用DXC AI Starter库,请使用以下代码片段:
1.pipinstallDXC-Industrialized-AI-Starter2.fromdxcimportai
入门
访问、清理和浏览原始数据
使用库访问、清理和浏览原始数据。在
^{pr2}$Click here有关访问、清理的详细信息,请浏览原始数据。在
构建数据管道
管道是处理数据以进行建模和解释的标准方法。默认情况下,dxcai Starter库使用MongoDB Atlas的空闲层来存储原始数据和执行管道。为了开始,您首先需要有一个MongoDB帐户,您可以免费注册并创建一个数据库“connection_string”,并在下面的数据层中指定这些详细信息。下面的代码连接到MongoDB并存储原始数据以进行处理。在
#Insert data into MongoDB:data_layer={"connection_string":"<your connection_string>","collection_name":"<your collection_name>","database_name":"<your database_name>","data_source":"<Source of your datset>","cleaner":"<whether applied cleaner yes/no >"}wrt_raw_data=ai.write_raw_data(data_layer,raw_data,date_fields=[])
一旦存储了原始数据,就可以运行管道来转换数据。此代码指导数据存储如何将原始数据的输出细化为可用于训练机器学习模型的内容。有关如何编写管道的详细信息,请参考MongDB pipelines的语法。下面是创建和执行管道的示例。在
pipeline=[{'$group':{'_id':{"funding_source":"$funding_source","request_type":"$request_type","department_name":"$department_name","replacement_body_style":"$replacement_body_style","equipment_class":"$equipment_class","replacement_make":"$replacement_make","replacement_model":"$replacement_model","procurement_plan":"$procurement_plan"},"avg_est_unit_cost":{"$avg":"$est_unit_cost"},"avg_est_unit_cost_error":{"$avg":{"$subtract":["$est_unit_cost","$actual_unit_cost"]}}}}]df=ai.access_data_from_pipeline(wrt_raw_data,pipeline)#refined data will be stored in pandas dataframe.
单击此处获取有关构建数据管道的详细信息。在
运行人工智能实验
使用DXC AI Starter来构建和测试算法。此代码通过对实验设计运行run_experience()来执行实验。在
experiment_design={#model options include ['tpot_regression()', 'tpot_classification()', 'timeseries']"model":ai.tpot_regression(),"labels":df.avg_est_unit_cost_error,"data":df,#Tell the model which column is 'output'#Also note columns that aren't purely numerical#Examples include ['nlp', 'date', 'categorical', 'ignore']"meta_data":{"avg_est_unit_cost_error":"output","_id.funding_source":"categorical","_id.department_name":"categorical","_id.replacement_body_style":"categorical","_id.replacement_make":"categorical","_id.replacement_model":"categorical","_id.procurement_plan":"categorical"}}trained_model=ai.run_experiment(experiment_design,verbose=False,max_time_mins=5,max_eval_time_mins=0.04,config_dict=None,warm_start=False,export_pipeline=True,scoring=None)
Click here有关运行人工智能实验的详细信息。在
发布微服务
DXC AI Starter库使您可以轻松地将模型发布为工作的微服务。默认情况下,DXC-AI-Starter库使用Algorithmia的免费层将模型作为微服务发布。必须创建一个Algorithmia帐户才能使用。下面是发布微服务的示例。在
#trained_model is the output of run_experiment() functionmicroservice_design={"microservice_name":"<Name of your microservice>","microservice_description":"<Brief description about your microservice>","execution_environment_username":"<Algorithmia username>","api_key":"<your api_key>","api_namespace":"<your api namespace>","model_path":"<your model_path>"}#publish the micro service and display the url of the apiapi_url=ai.publish_microservice(microservice_design,trained_model)print("api url: "+api_url)
Click here有关发布微服务的详细信息。在
文件
有关详细和完整的文档,请单击此处
示例笔记本
以下是各个型号的笔记本示例。这些示例笔记本有助于了解如何使用每个函数、每个函数的预期参数以及模型中每个函数的输出。在
贡献指南
要了解更多关于贡献和指南的信息,请点击这里
报告问题
如果您发现任何问题,请随时在这里报告,并明确说明您的问题。在
- 项目
标签: