小编Mik*_*ke 的帖子

scikit-learn中的“得分必须返回数字” cross_val_score错误

也许这是一个愚蠢的问题,但是我不明白cross_val_score下面代码中的函数给我的错误。也许答案是X样本格式的,看到的正是崩溃消息中显示的内容,但是我不知道如何解决。这是我的项目中的代码,带有一些随机值。

import numpy as np
from sklearn import mixture,cross_validation

np.random.seed(0)
n_samples = 300
C = np.array([[0., -0.7], [3.5, .7]])
X = np.r_[np.dot(np.random.randn(n_samples, 2), C),
          np.random.randn(n_samples, 2) + np.array([20, 20])]

clf = mixture.GMM(n_components=2, covariance_type='full')
score = cross_validation.cross_val_score(clf, X)
Run Code Online (Sandbox Code Playgroud)

给我错误:

ValueError: scoring must return a number, got (<type 'numpy.ndarray'>) instead
Run Code Online (Sandbox Code Playgroud)

python numpy machine-learning scikit-learn

5
推荐指数
1
解决办法
1075
查看次数

分析简单的ARM汇编代码

我开始使用GNU工具链研究ARM汇编语言,并使用以下代码在C中创建一个非常简单的函数示例:

#include <stdint.h>

    uint32_t *a;
    uint32_t *b;
    uint32_t *c;

     __attribute__((naked)) void f() {

             *a += *c;
             *b += *c;
       }
Run Code Online (Sandbox Code Playgroud)

在终端中使用此命令后查看汇编代码:

arm-none-eabi-gcc -O1 -S -std=c99 example.c -o -
Run Code Online (Sandbox Code Playgroud)

这就是结果:

    @ Function supports interworking.
    @ Naked Function: prologue and epilogue provided by programmer.
    @ args = 0, pretend = 0, frame = 0
    @ frame_needed = 0, uses_anonymous_args = 0
    ldr r3, .L2
    ldr r2, .L2+4
    ldr r3, [r3]
    ldr r2, [r2] ; r2 <- &(*c)
    ldr ip, [r3]
    ldr r0, …
Run Code Online (Sandbox Code Playgroud)

assembly arm

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

标签 统计

arm ×1

assembly ×1

machine-learning ×1

numpy ×1

python ×1

scikit-learn ×1