智能工件genie的sdk通用进化网络智能引擎
ia-genie-sdk的Python项目详细描述
精灵python sdk
用于智能工件精灵的python sdk。
什么是精灵?
genie是一个通用的网络智能引擎。它是一个人工通用智能平台,可以快速构建任何问题领域的机器智能解决方案。
精灵需要一个关于智能人工制品的帐户。
什么是genie python sdk?
这个名为genie python sdk的包是一个软件开发包,用于与来自python的“genies”和“bottles”进行交互。它提供了有用的工具和服务。
安装
pip install ia-genie-sdk
提供:
- GenomeInfo
- BottleClient
- BackTesting
使用genomeinfo:
你需要从你的智能人工制品帐户下载你的精灵基因组文件。
from ialib.GenomeInfo import Genome
import json
genome_topology = json.loads(genome_json_string)
genome = Genome(genome_topology)
有用的功能有:
genome.agent - returns the name of the agent.
ex: 'focusgenie'
genome.getNodes() - returns 2-tuple of primitives and manipulatives genomic data.
genome.getActions() - returns dictionary of primitives with lists of action IDs.
ex: {'P1': ['ma23b1323',
'm390d053c']}
genome.getActionManipulatives() - returns a list of action manipulative IDs.
ex: ['m390d053c',
'ma23b1323']
genome.getPrimitiveMap() - returns a dictionary of primitive names to primitive IDs.
ex: {'P1': 'p464b64bc'}
genome.getManipulativeMap() - returns a dictionary of manipulative IDs to manipulative names.
ex: {'m390d053c': 'ACTIONPath',
'ma23b1323': 'ACTIONPath',
'mcd6d4d68': 'negateContext',
'm40aaf174': 'vectorFilter',
'med2ed537': 'vectorPassthrough',
'm89aa2c7e': 'reduceVectorsBySubtraction'}
genome.display() - graphically displays the topology.
使用瓶装客户机:
你需要有一个活跃的瓶子运行在智能文物。您可以在您的IA帐户中找到瓶子的信息,如“名称”和“密码”。
如果在IA云上:
from ialib.BottleClient import BottleClient
bottle_info = {'api_key': 'ABCD-1234',
'name': 'genie-bottle',
'domain': 'intelligent-artifacts.com',
'secure': True}
test_bottle = BottleClient(bottle_info)
test_bottle
如果是本地的:
from ialib.BottleClient import BottleClient
bottle_info = {'api_key': 'ABCD-1234',
'name': 'genie-bottle',
'domain': ':8181',
'secure': False}
test_bottle = BottleClient(bottle_info)
test_bottle
将精灵的基因组注入瓶子:
test_bottle.injectGenome(genome)
等待返回状态。
一旦您有了一个正在运行的genie,就可以通过在列表中传递节点名来设置入口和查询节点:
test_bottle.setIngressNodes(['P1'])
test_bottle.setQueryNodes(['P1'])
将数据发送到瓶子:
data = {"strings": ["Hello"], "vectors": [], "determinants": []}
test_bottle.observe(data)
查询瓶子节点:
print(test_bottle.query('showStatus'))
predictions = test_bottle.query('getPredictions')
您还可以将生殖器语言数据传递给生殖器:
from ialib.GenieMetalanguage import CLEAR_ALL_MEMORY, CLEAR_WM, LEARN, SET_PREDICTIONS_ON, SET_PREDICTIONS_OFF
test_bottle.observe(LEARN)
向精灵发送分类时,最好将分类作为序列最后一个事件中的单个符号发送。这允许查询预测“未来”字段中的最后一个事件以获取答案。不过,分类应该与入口节点一起发送到所有查询节点。类的observeClassification
函数为我们这样做:
data = {"strings": ["World!"], "vectors": [], "determinants": []}
test_bottle.observeClassification(data)
使用回溯测试:
有3个内置的回测报告:
-分类:
-训练并预测一个字符串值作为观测数据的分类。
-实用程序-极性:
-极性基本上是一个使用预测的“效用”值的正负二元分类测试。如果预测的极性与预期的极性匹配,则得分正确。
-效用-价值:
-实际预测值与预期值的值测试,如果在提供的tolerance_threshold
内,则得分正确。
对于每个事件,观察到的数据可以是一个或多个事件的序列,包含任何向量或字符串。