- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 Azure 机器学习 - 文本分析 REST API,位于此处。需要通过 POST 向服务器发送有效负载。我正在尝试获得与 IBM watson 类似的结果
这是我在控制台应用程序中尝试的内容,这是核心代码:
static IRestResponse GetResp(string url, string key, string jsonText) {
IRestClient client = new RestClient(url);
IRestRequest request = new RestRequest() { RequestFormat = DataFormat.Json };
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Ocp-Apim-Subscription-Key", key);
IRestResponse response = client.ExecuteAsPost(request, "POST");
}
// Here the code that serializes the object to look precisely like body advertised calls it:
string json = JsonConvert.SerializeObject(documents);
IRestResponse resp = GetResponse("https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/keyPhrases", TaxonomyGlueKey, json);
序列化“文档”的消息正文是:
{
"documents": [
{
"language": "en",
"id": "4",
"text": "Lateral internal sphincterotomy and fissurectomy"
},
{
"language": "en",
"id": "5",
"text": "Fissurectomy and Botox injection"
}
]}
我收到错误请求错误。我已验证我的请求已发送并通过身份验证(之前已失败)。我也尝试过很多变体。
我可以尝试我的请求正文,并且将文本从调试变量直接复制到 Azure 提供的正文时它可以正常工作:
如果我使用上述内容进行测试,我会得到预期的响应,状态 200:
Transfer-Encoding: chunked
x-aml-ta-request-id: c4ea9fff-8068-42a3-99c4-68717acddcf5
X-Content-Type-Options: nosniff
apim-request-id: e5eb593b-96a3-4806-9143-1d83424569be
Date: Thu, 21 Jul 2016 14:14:44 GMT
Content-Type: application/json; charset=utf-8
{
"documents": [
{
"keyPhrases": [
"fissurectomy"
],
"id": "4"
},
{
"keyPhrases": [
"Botox injection"
],
"id": "5"
}
],
"errors": []
}
最佳答案
我正在使用 JQuery
和 REST API
进行情感分析。我收到了与您收到的相同的错误。我设法通过提供输入的 JSON 序列化版本
作为请求正文来使其正常工作。
这是工作代码-
$(function() {
var params ={
"documents": [
{
"language": "en",
"id": "1",
"text": "this is AWESOME!"
}
]
};
$.ajax({
url: "https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment?" + $.param( params );,
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","<your subscription key here>");
xhrObj.setRequestHeader("Accept","application/json");
},
type: "POST",
// Request body
data: JSON.stringify(params)
})
.done(function(data) {
alert("Sentiment score is " + data.documents[0].score);
})
.fail(function() {
alert("error");
});
});
关于c# - Azure 机器学习 - 文本分析 C# 错误请求正文,即使在验证 JSON 正文后也是如此,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38507113/
PyCaret是一个开源、低代码Python机器学习库,能够自动化机器学习工作流程。它是一个端到端的机器学习和模型管理工具,极大地加快了实验周期,提高了工作效率。PyCaret本质上是围绕几个机器学习
在我的研究进展中,我现在已经将寄生虫从图像中分离出来。寄生虫看起来像蠕虫。我希望 MATLAB 读取所有输入图像,查找类似深紫色图像的蠕虫,如果检测到,则给出检测到的答复。我尝试使用直方图比较,但我认
目前我正在尝试了解机器学习算法的工作方式,但我没有真正了解的一件事是预测标签的计算准确度与视觉混淆矩阵之间的明显差异。我会尽量解释清楚。 这是数据集的片段(这里你可以看到 9 个样本(在真实数据集中大
第一章 绪论 机器学习 : 致力于研究如何通过计算的手段,利用经验来改善系统自身的性能。在计算机系统中, “经验” 通常以“数据“形式存在,因此,机器学习所研究的主要内容,是关于在计算
1. 算法原理(K-Nearest Neighbor) 本质是通过距离判断两个样本是否相似,如果距离够近就认为他们足够相似属于同一类别 找到离其最近的 k 个样本,并将这些样本称
前言 K-means是一种经典的无监督学习算法,用于对数据进行聚类。K-means算法将数据集视为具有n个特征的n维空间,并尝试通过最小化簇内平方误差的总和来将数据点划分为簇。本文将介绍K-m
目录 前言 介绍LightGBM LightGBM的背景和起源 L
前言 可以说掌握了机器学习,你就具备了与机器对话,充分利用机器为人类服务的能力。在人工智能时代,这将成为一项必备技能,就好比十年前你是编程大牛,二十年前你英语超好一样。因此,无论你是什么专业的
几个贯穿始终的概念 当我们把人类学习简单事物的过程抽象为几个阶段,再将这些阶段通过不同的方法具体化为代码,依靠通过计算机的基础能力-- 计算 。我们就可以让机器能够“学会”一些简单的事物。
1、选题背景 人脸识别技术是模式识别和计算机视觉领域最富挑战性的研究课题之一,也是近年来的研究热点,人脸性别识别作为人脸识别技术
每当我们在公有云或者私有云发布训练好的大数据模型,为了方便大家辨识、理解和运用,参照huggingface所制定的标准制作一个Model Card展示页,是种非常好的模型展示和组织形式。 下面就是一
2. 支持向量机 对偶优化 拉格朗日乘数法可用于解决带条件优化问题,其基本形式为: \[\begin{gather} \min_w f(w),\\ \mathrm{s.t.} \quad
我正在尝试运行以下代码: https://github.com/opencv/opencv/blob/master/samples/dnn/classification.cpp 我在这里找到所有经过预
我是机器学习新手。当我使用 scikit-learn 模块中的波士顿数据集练习具有默认参数的决策树回归模型时。 在此链接解决方案( How to Build a Decision tree Regre
我有用于训练的数据。当我将其输入神经网络时,该数据出现 3% 的错误。 我知道这些数据有一定的过度代表性 - 例如,第 5 类的示例大约是其他类的十分之一。 我的作业指出,我可以通过偏置训练数据(即删
我在 Python 的多类分类中使用 SVM 时遇到问题。事实上,问题在于性别分类(来自图像),其中训练数据集仅包含“y=1”或“ y=-1”作为类标签(二进制)。但是,在预测中,如果是男性,我必须预
以防万一你们不知道,对抗性图像是属于某个类别的图像,但随后被扭曲,而人眼没有任何视觉感知差异,但网络错误地将其识别为完全不同的类别。 有关此内容的更多信息,请参见此处: http://karpathy
我正在进行一个 ML 语言识别项目 (Python),该项目需要具有高维特征输入的多类分类模型。 目前,我所能做的就是通过反复试验来提高准确性。无意识地结合可用的特征提取算法和可用的机器学习模型,看看
import numpy as np def sigmoid(x): return 1.0/(1+np.asmatrix(np.exp(-x))) def graD(X,y,alpha,s0,
所以我有多个列表: ['disney','england','france'] ['disney','japan'] ['england', 'london'] ['disney', 'france'
我是一名优秀的程序员,十分优秀!