如何使用深度神经网络解决线性逆问题 Ax=b?

我正在尝试使用深度神经网络解决线性逆问题 Ax=b。但我是机器学习的新手,所有教程都是关于分类的。所以,任何人能提供一些教程链接(代码、视频、论文)关于如何使用深度神经网络解决 Ax=b 问题吗?


回答:

来自这个博客的示例

import torchdim = 2A = torch.rand(dim, dim, requires_grad=False)b = torch.rand(dim, 1,  requires_grad=False)x = torch.autograd.Variable(torch.rand(dim, 1), requires_grad=True)stop_loss = 1e-2step_size = stop_loss / 3.0print('Loss before: %s' % (torch.norm(torch.matmul(A, x) - b)))for i in range(1000*1000):    Δ = torch.matmul(A, x) - b    L = torch.norm(Δ, p=2)    L.backward()    x.data -= step_size * x.grad.data # step    x.grad.data.zero_()    if i % 10000 == 0: print('Loss is %s at iteration %i' % (L, i))    if abs(L) < stop_loss:        print('It took %s iterations to achieve %s loss.' % (i, step_size))        breakprint('Loss after: %s' % (torch.norm(torch.matmul(A, x) - b)))

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注