小编Fra*_*urt的帖子

什么决定了 Windows 上“pathdef.m”文件的位置?

http://www.mathworks.com/support/solutions/en/data/1-5YQCPR/index.html?product=ML说:

默认情况下,“pathdef.m”文件可能位于“$MATLABROOT/toolbox/local”目录或“$USERPATH”目录中,其中 $MATLABROOT 和 $USERPATH 是输入命令 matlabroot 后显示的目录(例如C:\Program Files\MATLAB\R2013b) 和用户路径(例如 C:\Users\francky\Documents\MATLAB)

pathdef.m那么,什么决定了文件在 Windows 上的位置(matlabrootuserpath)?

windows matlab configuration-files

3
推荐指数
1
解决办法
6390
查看次数

使用SUMPRODUCT与TRANSPOSE

我正在尝试使用TRANSPOSE内部SUMPRODUCT.我的配方有什么问题?

在此输入图像描述

如果重要的话,我会使用Excel 2013.

excel

3
推荐指数
2
解决办法
8872
查看次数

为什么Python不允许在同一行上放置一个for后跟一个if?

为什么这个代码

for i in range(10):
    if i == 5: print i
Run Code Online (Sandbox Code Playgroud)

复合语句时有效(我知道PEP 8不鼓励这样的编码风格)

for i in range(10): if i == 5: print i
Run Code Online (Sandbox Code Playgroud)

不是?

python

3
推荐指数
2
解决办法
202
查看次数

如何在Ubuntu 14.04 x64上安装Theano,并配置它以便它使用GPU?

我尝试按照关于在当前Ubuntu轻松安装优化Theano的说明但它不起作用:每当我使用GPU运行Theano脚本时,它都会给出错误消息:

已安装CUDA,但设备gpu不可用(错误:无法获取可用的gpus数量:未检测到支持CUDA的设备)


更具体地说,按照链接网页中的说明,我执行了以下步骤:

# Install Theano
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano

# Install Nvidia drivers and CUDA
sudo apt-get install nvidia-current
sudo apt-get install nvidia-cuda-toolkit
Run Code Online (Sandbox Code Playgroud)

然后我重新启动并尝试运行: 

THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python gpu_test.py # gpu_test.py comes from http://deeplearning.net/software/theano/tutorial/using_gpu.html
Run Code Online (Sandbox Code Playgroud)

但我得到:

f@f-Aurora-R4:~$ THEANO_FLAGS=’mode=FAST_RUN,device=gpu,floatX=float32,cuda.root=/usr/lib/nvidia-cuda-toolkit’ python gpu_test.py WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: Unable to get the number of gpus available: no CUDA-capable device is detected) [Elemwise{exp,no_inplace}(<TensorType(float32, vector)>)] …
Run Code Online (Sandbox Code Playgroud)

ubuntu theano

3
推荐指数
1
解决办法
3342
查看次数

在Theano实施GRU

根据官方Theano教程(http://deeplearning.net/tutorial/code/lstm.py)中提供的LSTM代码,我更改了LSTM层代码(即函数lstm_layer()和代码param_init_lstm())以执行GRU.

提供的LSTM代码训练良好,但不是我编码的GRU:使用LSTM的训练集的准确度上升到1(训练成本= 0),而GRU则停滞在0.7(训练成本= 0.3).

以下是我用于GRU的代码.我保留了与教程中相同的函数名,以便可以将代码直接复制粘贴到其中.什么可以解释GRU的糟糕表现?

import numpy as np
def param_init_lstm(options, params, prefix='lstm'):
    """
    GRU
    """
    W = np.concatenate([ortho_weight(options['dim_proj']),  # Weight matrix for the input in the reset gate
                        ortho_weight(options['dim_proj']),
                        ortho_weight(options['dim_proj'])], # Weight matrix for the input in the update gate  
                        axis=1)         
    params[_p(prefix, 'W')] = W

    U = np.concatenate([ortho_weight(options['dim_proj']),  # Weight matrix for the previous hidden state in the reset gate
                        ortho_weight(options['dim_proj']),
                        ortho_weight(options['dim_proj'])], # Weight matrix for the previous hidden state in the update …
Run Code Online (Sandbox Code Playgroud)

python neural-network theano deep-learning gated-recurrent-unit

3
推荐指数
1
解决办法
1868
查看次数

安装rpy2时出错:'sh'无法识别为内部或外部命令,可运行程序或批处理文件

我尝试安装rpy2但我在下面有这个错误.

我在网上看到问题是环境变量,但我在系统变量路径中有 C:\ Rtools\binC:\ Program Files\R\R-3.2.2\bin.

我究竟做错了什么?

错误:

C:\Users\rmalveslocal>pip install rpy2
Collecting rpy2

  Downloading rpy2-2.7.6.tar.gz (177kB)
    100% |################################| 180kB 1.3MB/s

    Complete output from command python setup.py egg_info:
    R version 3.2.2 (2015-08-14) -- "Fire Safety"
    Copyright (C) 2015 The R Foundation for Statistical Computing
    Platform: x86_64-w64-mingw32/x64 (64-bit)

    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under the terms of the
    GNU General Public License versions 2 or 3. …
Run Code Online (Sandbox Code Playgroud)

python r system rpy2

3
推荐指数
1
解决办法
3834
查看次数

nbytes 和 getsizeof 返回不同的值

我注意到,nbytesgetsizeof返回两个不同的值,当银行向NumPy的阵列。

例子:

import sys
import numpy as np
x = np.random.rand(10000, 50)
print('x.nbytes: {0} bytes'.format(x.nbytes))
print('sys.getsizeof(x): {0} bytes'.format(sys.getsizeof(x)))
Run Code Online (Sandbox Code Playgroud)

输出:

x.nbytes: 4000000 bytes
sys.getsizeof(x): 4000112 bytes
Run Code Online (Sandbox Code Playgroud)

为什么?

python memory numpy

3
推荐指数
1
解决办法
2347
查看次数

适用于 Ubuntu 的 python-crfsuite

我想在 Ubuntu 中安装 python-crfsuite。当我使用 pip 安装时,我收到了一些警告并且

在 python-crfsuite 的安装记录中找不到 .egg-info 目录

当我在 python 中导入 crfutils 时,它说找不到模块。可能是什么问题,或者在 Linux 系统中是不可能的?

python pip crf python-crfsuite

3
推荐指数
1
解决办法
926
查看次数

使用R将矩阵划分为N个相等大小的块

如何用R将矩阵或数据帧划分为N个大小相等的块?我想水平切割矩阵或数据框.

例如,给定:

r = 8
c = 10
number_of_chunks = 4
data = matrix(seq(r*c), nrow = r, ncol=c)
>>> data

     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    9   17   25   33   41   49   57   65    73
[2,]    2   10   18   26   34   42   50   58   66    74
[3,]    3   11   19   27   35   43   51   59   67    75
[4,]    4   12   20   28   36   44   52   60   68    76
[5,]    5   13   21   29   37 …
Run Code Online (Sandbox Code Playgroud)

split r matrix dataframe

3
推荐指数
1
解决办法
955
查看次数

如何从 Python 中的 2D 散点图数据创建热图?

如何从 Python 中的 2D 散点图数据创建热图,其中散点图中的每个 (x,y) 点都有与其关联的 az 值?z 值将是用于为热图着色的值。


例如,在 R 中,我可以使用:

# This example is from http://knowledge-forlife.com/r-creating-heatmap-scatterplot-data/
#I'm just setting the seed so you can see the same example on your computer
set.seed(1)

#Our X data
x <- runif(150)

#Our Y data
y <- runif(150)

#Our Z data
z <- c(rnorm(mean=1,100),rnorm(mean=20,50))

#Store the length of our data
N <- length(x)

# View the scatterplot
plot(x, y)

#Here is the interpolation to give the heatmap effect. 
#Use xo and …
Run Code Online (Sandbox Code Playgroud)

python heatmap

3
推荐指数
1
解决办法
2555
查看次数