所以我有一个文件,我想将最后 3000 行移动到另一个不同的文件,然后从原始文件创建一个没有最后 3000 行的新文件。
我使用的是Mac,使用的命令如下:
tail -n 3000 fer2017-testing-reduced.arff >> fer2017-training-reduced-3000-more-instances.arff; head -n -3000 fer2017-testing-reduced.arff > fer2017-testing-reduced-3000-less-instances.arff
Run Code Online (Sandbox Code Playgroud)
但是,当我运行此命令时,我收到错误:
head: illegal line count -- -3000
Run Code Online (Sandbox Code Playgroud)
我不确定我哪里出了问题,或者这是否是 mac 的问题?
为了后续讨论,我使用R 中的keras包。
给定创建的混淆矩阵如下:
# Get confusion matrix for predictions
classes <- model %>% predict_classes(test, batch_size=128)
ct <- table(test.target, classes)
cm <- as.matrix(ct)
Run Code Online (Sandbox Code Playgroud)
给出ct以下混淆矩阵:
classes
test.target 0 1 2
0 805 192 0
1 74 862 0
2 2 0 477
Run Code Online (Sandbox Code Playgroud)
如何计算真阳性 (TP)、假阳性 (FP)、真阴性 (TN) 和假阴性 (FN) 值?
为了澄清起见,我通过获取矩阵的对角线来计算真阳性 (TP) 值:
tp <- diag(cm)
然而,我计算 FP 值的尝试给出了负数(我猜这不可能是正确的,对吗?):
# Get false positive rates (FP)
fp <- c()
for(i in seq_len(ncol(ct))) {
fp <- append(fp, sum(cm[,i])-cm[i,i])
}
Run Code Online (Sandbox Code Playgroud)
编辑:dput(cm) …
我创建了一个表单,其中的操作是我的注册PHP文件.
在我的注册文件中,我有代码:
<?php
if(isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$password - $_POST['password'];
$price = 10;
$custom = urlencode("{$username}|*|{$password}");
$ppEmail = urlencode('myemail@email.com');
$ppURL = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business={$ppEmail}&item_name=Buy Account&amount={$price}¤cy_code=USD&button_subtype=products&custom={$custom}";
header("location".$ppURL);
} else {
return null;
}
?>
Run Code Online (Sandbox Code Playgroud)
在表单提交上,我得到了这个:
Notice: Undefined variable: password in C:\xampp\htdocs\inc\register.php on line 4
Notice: Undefined variable: password in C:\xampp\htdocs\inc\register.php on line 7
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么:(
谁知道?
我已经查看了涉及这种情况的其他问题,但它仍然为我返回0并且包只缩小整个GUI,因此它不是原始大小.
这是我的框架窗口:
package io.ryankshah;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JComponent;
import javax.swing.JFrame;
public class ChatWindow extends JFrame
{
private JComponent loginPanel;
/**
* Creates a default chat window object
*/
public ChatWindow() {
super("Secure Client/Server Chat");
loginPanel = new LoginPanel(this);
setSize(new Dimension(800, 600));
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
addComponents();
pack();
setLocationRelativeTo(null);
setVisible(true);
}
/**
* Adds all chat-related components to the main frame
*/
private void addComponents() {
add(loginPanel);
}
public static void main(String[] args) {
new ChatWindow();
}
}
Run Code Online (Sandbox Code Playgroud)
最后这是我的LoginPanel,其中调用了getContentPane().getWidth():
package io.ryankshah; …Run Code Online (Sandbox Code Playgroud) 我目前正在使用 制作一个ggplot2多面体图,我已经清除了异常值并将 yLim 设置为 5000。
但是,并非所有箱线图(下图开头的箱线图)都接近 5000。如何仅减少图像中选定的少数箱线图的 y 轴?我已经尝试了来自社区的多个答案,但它们似乎已经过时了。
这是我正在使用的代码:
require(reshape2)
require(ggplot2)
data_frame <- read.csv("results.csv", header=T)
p <- ggplot(data=data_frame, aes(x='', y=value)) + geom_boxplot(outlier.shape=NA, aes(fill=policy))
p <- p + facet_wrap( ~ level, scales="free") + coord_cartesian(ylim = c(0, 5000))
p <- p + xlab("") + ylab("Authorisation Time (ms)") + ggtitle("Title")
ggsave("bplots.png", plot=last_plot(), device=png())
Run Code Online (Sandbox Code Playgroud) 我目前正在执行一项任务,包括使用php从文件中获取信息并使用AJAX返回它.当我使用警报对此进行测试时,数据将被发送,但由于某种原因,该行:
param.html(str);
Run Code Online (Sandbox Code Playgroud)
不会改变div中的文字...
这是我的功能:
function updateChat(param) {
var dataString = 'update=true';
var str = '';
$.ajax({
type: "POST",
url: "inc/chat.php",
data: dataString,
success: function(data) {
str = data;
}
});
param.html(str);
}
Run Code Online (Sandbox Code Playgroud)
以下是我调用方法的方法:
setTimeout(function() {
updateChat('#chatbox');
}, 1000);
Run Code Online (Sandbox Code Playgroud) 使用泛型,编译器应该在运行时推断对象T的类型,但是它给了我一个静态违规,如标题中所述,我无法弄清楚(使用其他问题)来解决这个问题.
这是我的方法:
public static <T> boolean linearSearchIterative(T[] array, T obj) {
for(int i = 0; i < array.length; i++) {
if(array[i].equals(obj)) {
return true;
}
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
以下是我在main方法中声明的方法:
int x[] = {2, 3, 5, 6, 1};
int y = 1;
System.out.println(LinearSearch.linearSearchIterative(x, y));
Run Code Online (Sandbox Code Playgroud)