- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个生成对抗网络,其中鉴别器通过 MSE 最小化,生成器应该最大化。因为两者都是追求相反目标的对手。
generator = Sequential()
generator.add(Dense(units=50, activation='sigmoid', input_shape=(15,)))
generator.add(Dense(units=1, activation='sigmoid'))
generator.compile(loss='mse', optimizer='adam')
generator.train_on_batch(x_data, y_data)
最佳答案
更新:
原版MSE实现如下所示:
def mean_squared_error(y_true, y_pred):
if not K.is_tensor(y_pred):
y_pred = K.constant(y_pred)
y_true = K.cast(y_true, y_pred.dtype)
return K.mean(K.square(y_pred - y_true), axis=-1)
def mean_squared_error_max(y_true, y_pred):
if not K.is_tensor(y_pred):
y_pred = K.constant(y_pred)
y_true = K.cast(y_true, y_pred.dtype)
return K.mean(K.square(1 / (y_pred - y_true)), axis=-1)
-loss
方法收敛得更快一些。我不确定它是否总是提供最佳解决方案或任何解决方案,因为可能存在问题
here .
-loss
也:
def mean_squared_error(y_true, y_pred):
if not K.is_tensor(y_pred):
y_pred = K.constant(y_pred)
y_true = K.cast(y_true, y_pred.dtype)
return - K.mean(K.square(y_pred - y_true), axis=-1)
I have a generative adversarial networks, where the discriminator gets minimized with the MSE and the generator should get maximized. Because both are opponents who pursue the opposite goal.
Meanwhile, the generator is creating new, synthetic images that it passes to the discriminator. It does so in the hopes that they, too, will be deemed authentic, even though they are fake. The goal of the generator is to generate passable hand-written digits: to lie without being caught. The goal of the discriminator is to identify images coming from the generator as fake.
binary_crossentropy
,所以模型的任务是尽量减少这种损失。
self.discriminator.compile(loss='binary_crossentropy', optimizer=optimizer)
self.generator.compile(loss='binary_crossentropy', optimizer=optimizer)
关于python - 最大化 keras 模型的 MSE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59303939/
给定一个包含 n 个非负整数的数组:A1、A2、...、AN。如何找到一对整数 Au, Av (1 ≤ u ans) { ans=arr[i] & arr[j
有人知道这段代码的正确解决方案吗? BOOL maximized = [myWindow isMaximized]; 最佳答案 也许看看 isZoomed 关于cocoa - NSWindow 最大化
当前有一个 MySQL 数据库,但遇到 MySQL 以 600% CPU 使用率运行的问题。 规范: 2.3 GHz Intel Xeon® E5-2686 v4 (Broadwell) 处理器或 2
我已将 Skype 配置为在 Windows 启动时最小化启动。 现在我需要通过全屏应用程序按钮中的一个按钮将 Skype 置于最前面。我有这段代码: For Each p As Proces
我已经有一段时间没有做任何生疏的程序了。我正在研究代码以最大化和最小化其他应用程序。所以我找到了一些基本的东西,这就是我所拥有的,对原来的东西稍作修改。它希望我生成一些我所做的 FindWindow
我有一个 Windows CE 应用程序,它记录移动设备的击键。有一个用于初始化录制功能的按钮,它通过调用强制主窗口最小化: ShowWindow (hWnd, SW_MINIMIZE); 在最小化窗
我想显示一个占据尽可能多屏幕空间的对话框。 所以,这是一个示例: AlertDialog dialog = new AlertDialog.Builder(ctx)......create(); Wi
对Wndows用户来说,最小化/最大化/关闭按钮放在系统窗口的右上角是肯定的。而大多数朋友都是成为Wndows用户之后才成为Ubuntu用户的,因此Ubuntu程序窗口中将这些按键放在左上角使用起来
1.Ctrl+Alt+T调出终端 2.首先安装gconf-editor: sudo apt-get install gconf-editor 会提示叫你安装 gconf-editor 安装完成
Width最大化窗口时,屏幕的属性似乎没有更新到完全最大化的宽度。如果我调整它的大小,一切正常,但在最大化时就不行。 我的代码如下: private void Window_SizeChanged(o
我正在这个 fiddle 中使用指令和 = 绑定(bind)。我收到以下错误: Uncaught Error: 10 $digest() iterations reached. Aborting! W
是否有任何快捷方式可以最大化您在 Eclipse 中使用的选项卡?假设我正在处理代码的一部分,并且我想最大化选项卡而不是使用鼠标双击它,有人知道一种方法吗? 最佳答案 CtrlM 将最大化/恢复编辑器
在 Glassdoor 评论中遇到这个问题,觉得很有趣。 Given an integer consisting of 4 digits, we need to maximize it in 24 h
在 VB6 中,我创建了一个带有一些文本框、列表框和命令按钮的表单。我使用类似 的方法设置所有这些控件的 X-Y 位置 control2.Top = form.Height * 0.50 'set
到处都有人告诉我使用这个: frame.setExtendedState(JFrame.MAXIMIZED_BOTH); 但问题是我的 JMenuBar 时断时续地消失(发生在我身上的奇怪错误),并且
我有一个 JDesktopPane 和一个 JInternalFrame。我希望 JInternalFrame 在创建后自动最大化。如何对“最大化窗口”事件进行硬编码? 最佳答案 使用JInterna
这个问题已经有答案了: JFrame doesn't take the actual screen size (2 个回答) 已关闭 3 年前。 我想最大化我的 JFrame,就像按下“关闭”旁边的按
我正在使用 vim 和 python 编程,并使用 tpope's vim-dispatch通过运行当前文件 :Dispatch python main.py 程序的打印输出被定向到quickfix窗
假设我们有一个名为 total 的 NSDecimal 常量,它包含 3.33333333 除以 10/3 的值。 10 和 3 都是NSDecimalNumber。我们希望 Swift 中的 NSD
有谁知道如何在发生特定操作后最大化 JFrame?我将在下面发布我的代码,我是一个不评论我的代码的恶魔(我会在某个时候这样做)但它应该是相当 self 解释的。我试图做的是在从菜单中选择选项后使框架最
我是一名优秀的程序员,十分优秀!