我目前正在阅读Tom Mitchell撰写的机器学习书.在讨论神经网络时,米切尔说:
"虽然当训练样例可线性分离时感知器规则找到一个成功的权重向量,但如果这些例子不是线性可分的话,它就无法收敛."
我在理解"线性可分"的含义时遇到了问题?维基百科告诉我"如果二维空间中的两组点可以完全由一条线分开,则它们可以线性分离."
但这如何适用于神经网络的训练集?输入(或动作单元)如何可线性分离?
我不是几何学和数学方面最好的 - 有人可以向我解释,好像我是5岁吗?;) 谢谢!
根据这篇文章http://slurp.doc.ic.ac.uk/pubs/observing/linking.html#assignment:
由于Java代码和字节码之间的信息不同(字节码不包含局部变量的类型),验证者不需要检查子类型以分配局部变量或参数.
我的问题:为什么字节码不包含局部变量的类型信息,而它确实包含参数和返回值的类型信息?
我正在尝试制作透明的底部页面布局,这样我就可以看到它下方视图的内容.底部工作表按预期工作,但是当我将背景设置为@null或时@android:color/transparent,布局的视图是白色的,而不是透明的.我的布局如下:
app_bar_main.xml:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinatorLayout"
android:background="@android:color/transparent"
android:fitsSystemWindows="true"
tools:context=".core.activities.MainActivity">
<!-- stuff here -->
<LinearLayout
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@null"
android:orientation="vertical"
app:layout_behavior="@string/bottom_sheet_behavior">
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
带有id的线性布局bottom_sheet,就是我的底页.表单本身定义如下:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@null"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottom_sheet_placeholder_layout"
android:layout_weight="0.6"
android:layout_width="match_parent"
android:background="@null"
android:layout_height="50dp"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottom_sheet_layout"
android:layout_margin="0dp"
android:layout_weight="0.4"
android:layout_width="match_parent"
android:background="@color/my_background"
android:layout_height="wrap_content"
android:orientation="vertical">
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/my_progress_bar" />
<TextView
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:textColor="@color/my_text"
android:id="@+id/txt_my_info" …Run Code Online (Sandbox Code Playgroud) 我试图根据NDPR(磁盘页面读取次数)计算(最有效的)块嵌套循环连接的开销.假设您有一个表单查询:
SELECT COUNT(*)
FROM county JOIN mcd
ON count.state_code = mcd.state_code
AND county.fips_code = mcd.fips_code
WHERE county.state_code = @NO
Run Code Online (Sandbox Code Playgroud)
其中@NO代替每次执行查询时的状态代码.
我知道我可以使用以下方法推导出NPDR: NPDR(R x S) = |Pages(R)| + Pages(R) / B - 2 . |P ages(S)|
(其中较小的表用作外部以便产生较少的页面读数.Ergo:R = county,S = mcd).
我也知道Page size = 2048字节
Pointer = 8 byte
Num. rows in mcd table = 35298
Num. rows in county table = 3141
Free memory buffer pages B = 100
Pages(X) = (rowsize)(numrows) / pagesize
Run Code Online (Sandbox Code Playgroud)
我想弄清楚的是" WHERE county.state_code = @NO"会影响我的成本吗? …
我的PyParsing任务的继续是解析嵌套的三元表达式(例如(x == 1 ? true : (y == 10 ? 100 : 200))).因此,我构造了以下表达式.对我来说,这看起来很直观.但是我没有匹配:
any = Word(printables)
conditional = Forward()
sub_exp = (conditional | any)
conditional = Literal('(') + sub_exp + Literal('?') + sub_exp + Literal(':') + sub_exp + Literal(')')
for exp in conditional.scanString(block_str):
print exp
Run Code Online (Sandbox Code Playgroud)
最初我认为问题是印刷品消耗一切; 我将excludeChars设置为不匹配:?)(,但这也没有帮助.另一种方法是构造嵌套表达式,每个用于" (? "," ?: "和" :) "块.但这种方法非常混乱.有人对解析三元表达式有什么建议吗?
更新 使用下面的答案,但修改为使用scanString:
但是,当使用scanString时,它也会返回许多其他匹配(基本上,与atom匹配的任何内容).
lpar = Literal('(').suppress()
rpar = Literal(')').suppress()
any = Combine(OneOrMore(Word(printables, excludeChars='()?:') | White(' ', max=1)))
expr = Forward()
atom = any …Run Code Online (Sandbox Code Playgroud) 我目前正在阅读Wiley和Woolridge的多代理系统简介,我希望是否有人可以向我澄清以下内容.在谈到效用函数时,作者说:
实用程序是表示状态"好"的数值:效用越高越好.
然后,代理的任务是实现最大化效用的状态- 我们不会向代理指定如何执行此操作.在这种方法中,任务规范只是一个功能
Run Code Online (Sandbox Code Playgroud)u:E -> R它将真实价值与每种环境状态联系起来.
鉴于这种性能指标,我们可以通过几种不同的方式定义代理在某些特定环境中的整体效用.一种(悲观)方式是将代理的效用定义为代理可能遇到的最差状态的效用; 另一种可能是将整体效用定义为遇到的所有州的平均效用.没有正确或错误的方法:措施取决于您希望代理执行的任务类型.
这种方法的主要缺点是它为当地国家分配公用事业; 在将实用程序分配给各个州时很难指定长期视图.
我在理解缺点以及究竟是什么样的本地状态时遇到了问题.有人可以澄清一下吗?
我正在使用 ACTION_EDIT 意图来启动 Android 图像编辑器以编辑图像:
Intent editIntent = new Intent(Intent.ACTION_EDIT);
editIntent.setDataAndType(uri, "image/*");
Run Code Online (Sandbox Code Playgroud)
当启动带有结果的意图时,如何检索编辑/保存图像的路径?
我正在学习Ember 2,并尝试编写一个简单的内联编辑器.我的问题是自动聚焦输入元素.组件的模板如下:
{{#if isEditing}}
{{input type="text" placeholder="Line item" autofocus="autofocus" value=value class="form-control" focus-out="save"}}
{{/if}}
{{#unless isEditing}}
<a href="#" {{action "toggleEditor"}}>{{value}}</a>
{{/unless}}
Run Code Online (Sandbox Code Playgroud)
控制器是:
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
toggleEditor: function () {
this.set('isEditing', !this.get('isEditing'));
},
save: function () {
var object = this.get('object');
var property = this.get('property');
object.set(property, this.get('value'));
var promise = object.save();
promise.finally(() => {
this.send('toggleEditor');
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
使用autofocus="autofocus"作品设置时isEditing参数设置为true.但是,当锚元素可见,并且用户单击链接时,焦点将不会传输到新显示的输入元素.因此我的问题是:聚焦输入元素的最佳方法是什么?在里面toggleEditor,我如何通过ID访问输入元素,如何使用Ember来关注它?
我正在使用Retrofit与我的REST API进行交互,并且想知道是否有人有任何设计建议.
我的应用程序包含以下包:
该服务包中包含用于改造的接口.例如:
public interface FooService {
@FormUrlEncoded
@POST("foo/do")
@Headers("Content-Type: application/x-www-form-urlencoded; charset=UTF-8")
Call<FooBar> do();
}
Run Code Online (Sandbox Code Playgroud)
模型包含......好吧,不同的模型.例如,FooBar.到目前为止一切都很好 - 就像Retrofit文档一样.
我创建了一个API类,它处理Retrofit构建逻辑(Retrofit retrofit = new Retrofit.Builder()等),并公开一个静态字段:retrofit.在我的活动中,我可以按如下方式执行我的请求:
FooService service = API.retrofit.create(FooService.class);
Call<FooBar> call = service.do();
try {
retrofit2.Response response = call.execute();
// ...do stuff...
} catch(IOException) {}
Run Code Online (Sandbox Code Playgroud)
随之而来的是我的问题:进一步抽象上述内容会更好吗?所以我不需要在任何地方重复上述内容?例如,类似于:
MyOtherFooService service = new MyOtherFooService();
FooBar fooBar = service.do();
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?建议?
字符串在Ruby中是可变的。这意味着-与Java不同,解释器不能使用相同的对象来表示字符串文字(即"test",在for循环中,每次迭代都会创建一个新对象)。
有人可以向我解释为什么会这样吗?即,为什么可变性会阻止使用同一对象来表示字符串文字?