小编jos*_*osh的帖子

Python导致:IOError:[Errno 28]设备上没有剩余空间:'../results/32766.html'在磁盘上有很多空间

我正在运行导致上述错误的Python脚本.不寻常的是这个脚本在不同的机器上运行,没有任何问题.

区别在于导致我写入外部硬盘驱动器问题的机器上.为了使事情变得更奇怪,这个脚本已在问题机器上运行,并已编写超过30,000个文件.

一些相关信息(导致错误的代码):

nPage = 0
while nPage != -1:
    for d in data:
        if len(d.contents) > 1:
            if '<script' in str(d.contents):
                l = str(d.contents[1])
                start = l.find('http://')
                end = l.find('>',start)
                out = get_records.openURL(l[start:end])
                print COUNT

                with open('../results/'+str(COUNT)+'.html','w') as f:
                    f.write(out)
                COUNT += 1

    nPage = nextPage(mOut,False)
Run Code Online (Sandbox Code Playgroud)

我正在写的目录:

10:32@lorax:~/econ/estc/bin$ ll ../
total 56
drwxr-xr-x 3 boincuser boincuser  4096 2011-07-31 14:29 ./
drwxr-xr-x 3 boincuser boincuser  4096 2011-07-31 14:20 ../
drwxr-xr-x 2 boincuser boincuser  4096 2011-08-09 10:38 bin/
lrwxrwxrwx 1 boincuser …
Run Code Online (Sandbox Code Playgroud)

python filesystems hard-drive

29
推荐指数
5
解决办法
10万
查看次数

在R中组合使用不同训练集构建的随机森林

我是R的新手(第2天),他的任务是建造一片随意的森林.每个随机森林将使用不同的训练集建立,我们将结束所有森林进行预测.我在R中实现这个,并且在使用不使用相同集合构建的两个森林时遇到一些困难.我的尝试如下:

d1 = read.csv("../data/rr/train/10/chunk0.csv",header=TRUE)
d2 = read.csv("../data/rr/train/10/chunk1.csv",header=TRUE)

rf1 = randomForest(A55~., data=d1, ntree=10)
rf2 = randomForest(A55~., data=d2, ntree=10)

rf = combine(rf1,rf2)
Run Code Online (Sandbox Code Playgroud)

这当然会产生错误:

Error in rf$votes + ifelse(is.na(rflist[[i]]$votes), 0, rflist[[i]]$votes) : 
non-conformable arrays
In addition: Warning message:
In rf$oob.times + rflist[[i]]$oob.times :
longer object length is not a multiple of shorter object length
Run Code Online (Sandbox Code Playgroud)

我已经浏览网页一段时间了解这一点,但尚未取得任何成功.这里的任何帮助将非常感激.

statistics r machine-learning random-forest

11
推荐指数
1
解决办法
8251
查看次数

配置:错误:构建 GCC 需要 GMP 4.2+、MPFR 2.3.1+ 和 MPC 0.8.0+

我正在尝试在运行 OS X 10.7.4 的 MacBook Pro 上构建 GCC-4.7.0。但是,我继续遇到同样的错误:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Run Code Online (Sandbox Code Playgroud)

运行以下行后发生此错误:

./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/
Run Code Online (Sandbox Code Playgroud)

为了摆脱这个错误,我尝试了以下操作:

  • 我使用自制软件下载了 gmp-5.0.4、mpc-0.21 和 mpfr-3.1.0。此时,我尝试使用以下命令指向 gmp、mpc 和 mpfr 所在的位置:

    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/     --with-gmp=/usr/local/Cellar/ --with-mpfr=/usr/local/Cellar/ --with-mpc=/usr/local/Cellar/
    
    Run Code Online (Sandbox Code Playgroud)

    但是,这导致了同样的错误。因此,我尝试将 gcc 指向 Cellar 目录周围的各个位置:

    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/ --with-mpfr=/usr/local/Cellar/mpfr --with-mpc=/usr/local/Cellar/mpc/
    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/5.0.4/ --with-mpfr=/usr/local/Cellar/mpfr/3.1.0/ --with-mpc=/usr/local/Cellar/mpc/0.21/
    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/5.0.4/include/ --with-mpfr=/usr/local/Cellar/mpfr/3.1.0/include/ --with-mpc=/usr/local/Cellar/mpc/0.21/share/
    
    Run Code Online (Sandbox Code Playgroud)

    最后这些都产生了同样的错误。然后我下载了从 gcc 错误消息(在这里找到:ftp : //gcc.gnu.org/pub/gcc/infrastructure/)链接的 gmp、mpc 和 mpfr 的版本。从源代码构建这些并运行所有相同的配置后,我遇到了同样的问题。我在此安装中尝试过的配置是:

    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/
    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/ --with-mpfr=/usr/local/ --with-mpc=/usr/local/
    ./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/include/ --with-mpfr=/usr/local/include/ …
    Run Code Online (Sandbox Code Playgroud)

gcc compiler-errors compilation build

2
推荐指数
1
解决办法
5074
查看次数

在闭包Rust中使用函数指针参数

我期待创建一个函数,agg它接受另一个函数作为参数get_id,并返回一个FnMut使用该get_id函数的闭包.

具体例子:

struct CowRow {
    pub id : i32,
}
impl CowRow {
    fn get_id(&self) -> i32       { self.id }
}

pub fn agg<F>(col: F) -> Box<FnMut(&CowRow) -> i32>
    where F: Fn(&CowRow) -> i32 {
    let mut res = 0;
    Box::new(move |r| { res += col(&r); return res })
}

fn main() {
    let mut cow = CowRow { id: 0 };
    let a = agg(CowRow::get_id);
    a(&cow);
Run Code Online (Sandbox Code Playgroud)

哪会产生错误:

the parameter type `F` …
Run Code Online (Sandbox Code Playgroud)

closures function-pointers lifetime rust

2
推荐指数
1
解决办法
404
查看次数