我正在使用th命令从我的Linux shell执行Torch脚本.这个Torch脚本有两个输入参数:
th torch_script.lua input_parameter1 input_parameter2
现在我想通过Torch shell运行这个脚本.为此,我必须使用该dofile命令.但在这种情况下,我不知道如何传递输入参数input_parameter1和input_parameter2.
在Torch中,如何将一些输入参数传递给dofile执行命令?
编辑:这是我正在尝试运行的代码.我无法正常运行,也许你可以告诉我原因
external_command.lua内容:
local arg = arg or {...}
input_parameter = arg[1]
print("input_parameter ".. input_parameter);
Run Code Online (Sandbox Code Playgroud)
在shell上:
$th
th> tempFunc = load "external_command.lua"
th> tempFunc("try")
[string "_RESULT={tempFunc("try")}"]:1: attempt to call global 'tempFunc' (a nil value)
stack traceback:
[string "_RESULT={tempFunc("try")}"]:1: in main chunk
[C]: in function 'xpcall'
/home/davide/torch/install/share/lua/5.1/trepl/init.lua:630: in function 'repl'
...vide/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:185: in main chunk
[C]: at 0x004064d0
Run Code Online (Sandbox Code Playgroud)
编辑2:我尝试过TonyHsu发布的解决方案,但无论如何它都不起作用.这就是我正在做的事情.
我runfile()在脚本中定义了一个函数, …
我有data.txt两列和N行的文件,如下所示:
0.009943796 0.4667975
0.009795735 0.46777886
0.009623984 0.46897832
0.009564759 0.46941447
0.009546991 0.4703958
0.009428543 0.47224948
0.009375241 0.47475737
0.009298249 0.4767201
[...]
Run Code Online (Sandbox Code Playgroud)
文件中的每个值对应一个点坐标(x,y).如果绘制,则此点生成曲线.我想计算该曲线的曲线下面积(AUC).
所以我加载数据:
data = load("data.txt");
X = data(:,1);
Y = data(:,2);
Run Code Online (Sandbox Code Playgroud)
因此,X包含点的所有x坐标和Y所有y坐标.
我怎样才能计算曲线下面积(AUC)?
我在Linux CentOS 7机器上使用Torch7.我正在尝试将人工神经网络(ANN)应用于我的数据集,以解决二进制分类问题.我正在使用一个简单的多层感知器.
我正在使用以下火炬包:optim,torch.
问题是我的感知器总是预测零值(被归类为零的元素),我无法理解为什么......
这是我的数据集("dataset_file.csv").有34个功能和1个标签目标(最后一列,可能是0或1):
0.55,1,0,1,0,0.29,1,0,1,0.46,1,1,0,0.67,1,0.37,0.41,1,0.08,0.47,0.23,0.13,0.82,0.46,0.25,0.04,0,0,0.52,1,0,0,0,0.33,0
0.65,1,0,1,0,0.64,1,0,0,0.02,1,1,1,1,0,0.52,0.32,0,0.18,0.67,0.47,0.2,0.64,0.38,0.23,1,0.24,0.18,0.04,1,1,1,1,0.41,0
0.34,1,0.13,1,0,0.33,0,0.5,0,0.02,0,0,0,0.67,1,0.25,0.55,1,0.06,0.23,0.18,0.15,0.82,0.51,0.22,0.06,0,0,0.6,1,0,0,0,0.42,1
0.46,1,0,1,0,0.14,1,0,0,0.06,0,1,1,0,1,0.37,0.64,1,0.14,0.22,0.17,0.1,0.94,0.65,0.22,0.06,0.75,0.64,0.3,1,1,0,0,0.2,0
0.55,1,0,1,0,0.14,1,0.5,1,0.03,1,1,0,1,1,0.42,0.18,0,0.16,0.55,0.16,0.12,0.73,0.55,0.2,0.03,0.54,0.44,0.35,1,1,0,0,0.11,0
0.67,1,0,1,0,0.71,0,0.5,0,0.46,1,0,1,1,1,0.74,0.41,0,0.1,0.6,0.15,0.15,0.69,0.42,0.27,0.04,0.61,0.48,0.54,1,1,0,0,0.22,1
0.52,1,0,1,0,0.21,1,0.5,0,0.01,1,1,1,0.67,0,0.27,0.64,0,0.08,0.34,0.14,0.21,0.85,0.51,0.2,0.05,0.51,0.36,0.36,1,1,0,0,0.23,0
0.58,1,0.38,1,0,0.36,1,0.5,1,0.02,0,1,0,1,1,0.38,0.55,1,0.13,0.57,0.21,0.23,0.73,0.52,0.19,0.03,0,0,0.6,1,0,0,0,0.42,0
0.66,1,0,1,0,0.07,1,0,0,0.06,1,0,0,1,1,0.24,0.32,1,0.06,0.45,0.16,0.13,0.92,0.57,0.27,0.06,0,0,0.55,1,0,0,0,0.33,0
0.39,1,0.5,1,0,0.29,1,0,1,0.06,0,0,0,1,1,0.34,0.45,1,0.1,0.31,0.12,0.16,0.81,0.54,0.21,0.02,0.51,0.27,0.5,1,1,0,0,0.32,0
0.26,0,0,1,0,0.21,1,0,0,0.02,1,1,1,0,1,0.17,0.36,0,0.19,0.41,0.24,0.26,0.73,0.55,0.22,0.41,0.46,0.43,0.42,1,1,0,0,0.52,0
0.96,0,0.63,1,0,0.86,1,0,1,0.06,1,1,1,0,0,0.41,0.5,1,0.08,0.64,0.23,0.19,0.69,0.45,0.23,0.06,0.72,0.43,0.45,1,1,0,0,0.53,0
0.58,0,0.25,1,0,0.29,1,0,1,0.04,1,0,0,0,1,0.4,0.27,1,0.09,0.65,0.21,0.16,0.8,0.57,0.24,0.02,0.51,0.28,0.5,1,1,1,0,0.63,0
0.6,1,0.5,1,0,0.73,1,0.5,1,0.04,1,0,1,0,1,0.85,0.64,1,0.16,0.71,0.24,0.21,0.72,0.45,0.23,0.1,0.63,0.57,0.13,1,1,1,1,0.65,0
0.72,1,0.25,1,0,0.29,1,0,0,0.06,1,0,0,1,1,0.31,0.41,1,0.17,0.78,0.24,0.16,0.75,0.54,0.27,0.09,0.78,0.68,0.19,1,1,1,1,0.75,0
0.56,0,0.13,1,0,0.4,1,0,0,0.23,1,0,0,1,1,0.42,1,0,0.03,0.14,0.15,0.13,0.85,0.52,0.24,0.06,0,0,0.56,1,0,0,0,0.33,0
0.67,0,0,1,0,0.57,1,0,1,0.02,0,0,0,1,1,0.38,0.36,0,0.08,0.12,0.11,0.14,0.8,0.49,0.22,0.05,0,0,0.6,1,0,0,0,0.22,0
0.67,0,0,1,0,0.36,1,0,0,0.23,0,1,0,0,0,0.32,0.73,0,0.25,0.86,0.26,0.16,0.62,0.35,0.25,0.02,0.46,0.43,0.45,1,1,1,0,0.76,0
0.55,1,0.5,1,0,0.57,0,0.5,1,0.12,1,1,1,0.67,1,1,0.45,0,0.19,0.94,0.19,0.22,0.88,0.41,0.35,0.15,0.47,0.4,0.05,1,1,1,0,0.56,1
0.61,0,0,1,0,0.43,1,0.5,1,0.04,1,0,1,0,0,0.68,0.23,1,0.12,0.68,0.25,0.29,0.68,0.45,0.29,0.13,0.58,0.41,0.11,1,1,1,1,0.74,0
0.59,1,0.25,1,0,0.23,1,0.5,0,0.02,1,1,1,0,1,0.57,0.41,1,0.08,0.05,0.16,0.15,0.87,0.61,0.25,0.04,0.67,0.61,0.45,1,1,0,0,0.65,0
0.74,1,0.5,1,0,0.26,1,0,1,0.01,1,1,1,1,0,0.76,0.36,0,0.14,0.72,0.12,0.13,0.68,0.54,0.54,0.17,0.93,0.82,0.12,1,1,0,0,0.18,0
0.64,0,0,1,0,0.29,0,0,1,0.15,0,0,1,0,1,0.33,0.45,0,0.11,0.55,0.25,0.15,0.75,0.54,0.27,0.05,0.61,0.64,0.43,1,1,0,0,0.23,1
0.36,0,0.38,1,0,0.14,0,0.5,0,0.02,1,1,1,0.33,1,0.18,0.36,0,0.17,0.79,0.21,0.12,0.75,0.54,0.24,0.05,0,0,0.52,1,0,0,0,0.44,1
0.52,0,0.75,1,0,0.14,1,0.5,0,0.04,1,1,1,0,1,0.36,0.68,1,0.08,0.34,0.12,0.13,0.79,0.59,0.22,0.02,0,0,0.5,1,0,0,0,0.23,0
0.59,0,0.75,1,0,0.29,1,0,0,0.06,1,1,0,0,1,0.24,0.27,0,0.12,0.7,0.2,0.16,0.74,0.45,0.26,0.02,0.46,0.32,0.52,1,0,0,0,0.33,0
0.72,1,0.38,1,0,0.43,0,0.5,0,0.06,1,0,1,0.67,1,0.53,0.32,0,0.2,0.68,0.16,0.13,0.79,0.45,0.25,0.09,0.61,0.57,0.15,1,1,0,0,0.22,1
Run Code Online (Sandbox Code Playgroud)
这是我的Torch Lua代码:
-- add comma to separate thousands
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
-- function that computes the confusion matrix …Run Code Online (Sandbox Code Playgroud) 在Matlab中,我有一个包含N个实数值的向量X:
我想创建一个新的向量Xb,它包含X的所有M值,小于0.005(M <= N).我怎么能这样做?
我尝试过:
Xb = X <0.005
但它给了我一个N值为0或1的向量.
感谢名单
感谢StackOverflow社区的帮助,我能够在运行Linux CentOS 7的计算机上正确安装luasql .
现在我在Linux Ubuntu 16上遇到了类似的问题.我尝试了以下命令:
sudo apt-get -y install lua-sql-postgres
sudo apt-get -y install lua-sql-postgres-dev
sudo luarocks install luasql-postgres
Run Code Online (Sandbox Code Playgroud)
这是我从系统得到的错误:
Installing https://rocks.moonscript.org/luasql-postgres-2.3.5-2.rockspec...
Using https://rocks.moonscript.org/luasql-postgres-2.3.5-2.rockspec... switching to 'build' mode
Error: Could not find expected file libpq-fe.h, or libpq-fe.h for PGSQL -- you may have to install PGSQL in your system and/or pass PGSQL_DIR or PGSQL_INCDIR to the luarocks command. Example: luarocks install luasql-postgres PGSQL_DIR=/usr/local
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这个问题?谢谢
我在R中的Bioconductor 的SVA包中使用ComBat()函数时遇到问题.
在我的笔记本电脑上(运行Linux Ubuntu 18操作系统的Latitude 5590),它运行良好.但是如果我在TORQUE集群上运行它,对ComBat()函数的调用会产生一个无限的等待循环:
"ComBat()"Found25batches
注意:一个批次只有一个样本,设置mean.only = TRUE
调整0变量或协变量水平
跨基因标准化数据
OpenBLAS blas_thread_init:pthread_create:资源暂时不可用
OpenBLAS blas_thread_init:RLIMIT_NPROC 903725当前,最大值903725
OpenBLAS blas_thread_init:pthread_create:资源暂时不可用
OpenBLAS blas_thread_init:RLIMIT_NPROC 903725当前,最大值903725
OpenBLAS blas_thread_init:pthread_create:资源暂时不可用
OpenBLAS blas_thread_init:RLIMIT_NPROC 903725当前,最大值903725
OpenBLAS blas_thread_init:pthread_create:资源暂时不可用
OpenBLAS blas_thread_init:RLIMIT_NPROC 903725当前,最大值903725
OpenBLAS blas_thread_init:pthread_create:资源暂时不可用
OpenBLAS blas_thread_init:RLIMIT_NPROC 903725当前,最大值903725
OpenBLAS blas_thread_init:pthread_create:资源暂时不可用
你知道我怎么解决它吗?
我在网上查了一下,有些人已经遇到了这个与Python有关的问题.这对我来说听起来很奇怪:如果它是一个Python问题,它为什么会出现在R?
谢谢
我一直在Matlab编写一个脚本,用于绘制3D图像plot3.
轴在此间隔中运行:
结果如下图所示:

现在我想改变轴的方向,并用这个轴方向重新绘制图形:
我怎么能这样做?
感谢名单!
我还在努力在我的暹罗神经网络上实现小批量梯度更新.以前我有一个实现问题,这里已经正确解决了.
现在我意识到我的神经网络架构中也存在一个错误,这与我对正确实现的不完全理解有关.
到目前为止,我总是使用非小批量梯度下降方法,其中我将训练元素逐个传递给渐变更新.现在,我想通过小批量实现渐变更新,首先是用N = 2个元素构成的小型游戏.
我的问题是:我应该如何改变我的暹罗神经网络的架构,使其能够处理一小批N = 2个元素而不是单个元素?
这是我的暹罗神经网络的(简化)架构:
nn.Sequential {
[input -> (1) -> (2) -> output]
(1): nn.ParallelTable {
input
|`-> (1): nn.Sequential {
| [input -> (1) -> (2) -> output]
| (1): nn.Linear(6 -> 3)
| (2): nn.Linear(3 -> 2)
| }
|`-> (2): nn.Sequential {
| [input -> (1) -> (2) -> output]
| (1): nn.Linear(6 -> 3)
| (2): nn.Linear(3 -> 2)
| }
... -> output
}
(2): nn.CosineDistance …Run Code Online (Sandbox Code Playgroud) 我在具有CentOS Linux版本7.3.1611(Core)操作系统的计算机上使用Python 3.5.1.
我必须安装numpy包.
我尝试通过运行命令来遵循这些说明:
sudo yum -y install python34-setuptools
Run Code Online (Sandbox Code Playgroud)
不幸的是,我收到以下错误:
Transaction check error:
file /usr/lib64/libpython3.so from install of python34-libs-3.4.5-4.el7.x86_64 conflicts with file from package python3-libs-3.3.2-12.el7.nux.x86_64
Run Code Online (Sandbox Code Playgroud)
有关如何解决这个问题的任何想法?谢谢
编辑:在我的机器上,我有Python2.7和Python3.5,我想保留它们
我有一个用Eclipse开发的Java应用程序.我试图将其导出为.jar文件,以独立方式运行它,但如果我尝试使用命令运行它
java -jar application.jar
我收到此错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/data/xy/XYDataset
Caused by: java.lang.ClassNotFoundException: org.jfree.data.xy.XYDataset
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccesController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$%AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
找不到主类:UI.MainWindow.程序将会退出
目前,主类是MainWindow.class.它包含一个public static void main(String [] args)方法.我检查了manifest.mf文件,看起来是正确的:
Run Code Online (Sandbox Code Playgroud)Manifest-Version: 1.0 Main-Class: UI.MainWindow
我在64位Windows 2008系统上使用Eclipse IDE for Java Developers版本:Helios Release.
我能做什么?我该怎么解决这个问题?org/jfree/data/xy/XYDataset错误有什么意义?
谢谢