为了处理微服务架构,它通常与反向代理(例如nginx或apache httpd)一起使用,并且对于交叉关注问题,使用实现 API网关模式.有时反向代理执行API网关的工作.
很高兴看到这两种方法之间存在明显的差异.看起来API网关使用的潜在好处是调用多个微服务并聚合结果.API网关的所有其他职责可以使用反向代理实现.例如:
基于此,有几个问题:
我实现了梯度下降算法以最小化成本函数,以获得用于确定图像是否具有良好质量的假设.我在Octave做到了.这个想法以某种方式基于Andrew Ng 的机器学习类的算法
因此,我有880个值"y",其中包含从0.5到12的值.我在"X"中有880个值,从50到300,可以预测图像的质量.
遗憾的是,算法似乎失败了,经过一些迭代后,theta的值非常小,theta0和theta1变为"NaN".而我的线性回归曲线有奇怪的价值......
这是梯度下降算法的代码:(theta = zeros(2, 1);,alpha = 0.01,iterations = 1500)
function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters)
m = length(y); % number of training examples
J_history = zeros(num_iters, 1);
for iter = 1:num_iters
tmp_j1=0;
for i=1:m,
tmp_j1 = tmp_j1+ ((theta (1,1) + theta (2,1)*X(i,2)) - y(i));
end
tmp_j2=0;
for i=1:m,
tmp_j2 = tmp_j2+ (((theta (1,1) + theta (2,1)*X(i,2)) - y(i)) *X(i,2));
end
tmp1= theta(1,1) - (alpha * ((1/m) * tmp_j1))
tmp2= …Run Code Online (Sandbox Code Playgroud) 我试图从下面的xml字符串中获取Absoluteentry标记的值,但是它显示的objectrefrence没有设置异常
<?xml version="1.0" ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<AddResponse xmlns="http://www.sap.com/SBO/DIS">
<PickListParams>
<Absoluteentry>120072</Absoluteentry>
</PickListParams>
</AddResponse>
</env:Body>
</env:Envelope>
Run Code Online (Sandbox Code Playgroud)
码
XDocument doc = XDocument.Parse(xmlstring);
doc.Element("Envelope").Element("Body").Element("AddResponse").Element("PickListParams").Element("Absoluteentry").Value;
Run Code Online (Sandbox Code Playgroud)