在我的应用程序中,我有一个约会页面.我想放一个圆形的矩形按钮,当我按下它时,我就可以发送一封电子邮件给公司,并带有一个嵌入式电子邮件地址.
有没有这方面的教程?
提前致谢.
我正在尝试使用内核密度估计器(KDE)制作过滤器(以去除异常值和噪声)。我在我的 3D (d=3) 数据点中应用了 KDE,这给了我概率密度函数 (PDF) f(x)。现在我们知道密度估计的局部最大值 f(x) 定义了数据点集群的中心。所以我的想法是定义合适的 f(x) 来确定这些集群。
我的问题是如何以及哪种方法更适合于在 f(x) 中找到局部最大值的这个目的。如果有人可以为我提供一些示例代码/想法,我将非常感激。
这是查找在 3D 数据中给出 f(x) 的 KDE 的代码。
import numpy as np
from scipy import stats
data = np.array([[1, 4, 3], [2, .6, 1.2], [2, 1, 1.2],
[2, 0.5, 1.4], [5, .5, 0], [0, 0, 0],
[1, 4, 3], [5, .5, 0], [2, .5, 1.2]])
data = data.T
kde = stats.gaussian_kde(data)
minima = data.T.min(axis=0)
maxima = data.T.max(axis=0)
space = [np.linspace(mini,maxi,20) for mini, maxi in zip(minima,maxima)]
grid = …Run Code Online (Sandbox Code Playgroud) 我有像下面这样的数据集,我试图找出具有最佳带宽的核密度估计。
data = np.array([[1, 4, 3], [2, .6, 1.2], [2, 1, 1.2],
[2, 0.5, 1.4], [5, .5, 0], [0, 0, 0],
[1, 4, 3], [5, .5, 0], [2, .5, 1.2]])
Run Code Online (Sandbox Code Playgroud)
但我不知道如何处理它。还怎么找的?矩阵。
更新
我尝试了 scikit-learn 工具包中的 KDE 函数来找出单变量(1D)kde,
# kde function
def kde_sklearn(x, x_grid, bandwidth):
kde = KernelDensity(kernel='gaussian', bandwidth=bandwidth).fit(x)
log_pdf = kde.score_samples(x_grid[:, np.newaxis])
return np.exp(log_pdf)
# optimal bandwidth selection
from sklearn.grid_search import GridSearchCV
grid = GridSearchCV(KernelDensity(), {'bandwidth': np.linspace(.1, 1.0, 30)}, cv=20)
grid.fit(x)
bw = grid.best_params_
# pdf using kde …Run Code Online (Sandbox Code Playgroud) 我正在使用CircularRevealLibrary来显示我的标题布局。但是我想要的是能够半途停止动画。这该怎么做?我正在使用以下代码。
int x = v.getRight(), y = v.getBottom(), startRadius = 0;
int endRadius = (int) Math.hypot(v.getWidth(), v.getHeight());
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(v, x, y, startRadius, endRadius);
animator.start();
Run Code Online (Sandbox Code Playgroud)
我得到这个
我得到一些奇怪的错误,崩溃我的Android应用程序.它是一个测验应用程序.因此,当用户正确回答2/3问题时,请单击它崩溃的下一个按钮.并显示索引13错误.但我无法弄清楚在哪里修理/寻找.这是我的代码片段.
public Vector<Sprite> defaultTile;
private void GameResults()
{
if(result.equals("right"))
{
GameOver();
Log.e("Gaa", "Right Here ->");
}
}
private void GameOver() {
{
for (int i = 0; i < defaultTile.size(); i++) {
defaultTile.get(i).setVisible(false);
}
for (int i = 0; i < defaultTile.size(); i++)
{
unregisterTouchArea(defaultTile.get(i));
}
questionText.detachSelf();
}
@Override
public boolean onAreaTouched(TouchEvent event, ITouchArea area, float posX,
float posY) {
if(event.isActionUp())
{
if(area instanceof Sprite)
{
Sprite sprite = (Sprite)area;
int userData = (Integer) sprite.getUserData();
switch(userData)
{
case BTN_NEXT:
if(gameState.equals("alpha") …Run Code Online (Sandbox Code Playgroud) 我无法弄清楚我们从类似Kinect的设备(其中包含xyz和深度信息)获得的深度数据与点云数据之间的区别。有人可以向我解释一下吗?提前致谢。
我有两节课。一个叫做GameManager,另一个叫做Enemies。我在GameManager 中有两个变量,我已经从检查器currentLevel=1和totalEnemy=10.
// GameManager.cs
private static GameManager instance = new GameManager();
public static GameManager get(){ return instance; }
public int currentLevel;
public int curLevel { get; set; }
public int totalEnemy;
public int totLevel { get; set; }
void Start () {
curLevel = currentLevel;
totLevel = totalEnemy;
}
Run Code Online (Sandbox Code Playgroud)
我试图从这样的Enimes类中访问这两个变量;但每次它给我curLevel = 0,但我期待得到curLevel = 1。我做错了什么?
// Enemies.cs
void Start () {
Debug.Log (GameManager.get().curLevel); // always output …Run Code Online (Sandbox Code Playgroud) 我正在尝试从指令函数访问父控制器范围。当我尝试获取它的值时,$scope.$parent它会返回该对象。但是当我尝试从该对象访问任何变量时,它会返回Undefined。
app.controller('myCtrl', function ($scope, $http, $timeout) {
$scope.init = function(){
$http.get('url.php').success(function(data){
$scope.assignmentInfo = data.record;
});
};
});
app.directive('getInfo', [function(){
return {
restrict: 'A',
scope:{
data:'=',
title: '='
},
link:function(scope, elem, attrs){
scope.$watch('data.visible', function(val){
// do something
});
},
controller: function($scope) {
console.log($scope.$parent); // return an object
console.log($scope.$parent.assignmentInfo); // return undefined
},
templateUrl: 'template.html'
};
}]);
Run Code Online (Sandbox Code Playgroud)
首先console.log($scope.$parent)返回以下输出:

但$scope.$parent.assignmentInfo返回underfined
我如何访问assignmentInfo?
我的代码是这样的
<div class="a">
<div class="b">
<a class="c" href="#"><span class="d"></span></a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
和js代码是这样的
$(".d").click(function(){
var aClass = $(this).parent().parent().parent(); // to get class "a"
});
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来捕捉班级?