标签: scikits

查看numpy阵列?

我有一个2D numpy数组.有没有办法在其上创建包含第一k行和所有列的视图?

关键是要避免复制基础数据(数组太大,以至于无法制作部分副本.)

python numpy scikits

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

将scikits.learn.hmm.GaussianHMM拟合到可变长度训练序列

我想将scikits.learn.hmm.GaussianHMM与不同长度的训练序列相匹配.然而,拟合方法通过这样做来防止使用不同长度的序列

obs = np.asanyarray(obs)
Run Code Online (Sandbox Code Playgroud)

它只适用于同样形状的数组列表.有人提示如何继续吗?

python scikits hidden-markov-models scikit-learn

38
推荐指数
1
解决办法
2020
查看次数

在scikits机器学习中缺少值

是否有可能在scikit-learn中缺少值?他们应该如何代表?我找不到任何关于这方面的文件.

python machine-learning missing-data scikits scikit-learn

30
推荐指数
4
解决办法
3万
查看次数

即使它似乎已安装,也无法导入scikits-learn

根据scikit-learn用户指南,我安装了scikit-learn使用pip install -U scikit-learn.

所以使用pip search scikit-learn,我得到这个搜索结果:

scikit-learn - A set of python modules for machine learning and data mining
INSTALLED: 0.12.1 (latest)
Run Code Online (Sandbox Code Playgroud)

但是当我进入Python尝试时import sklearn,我得到了一个ImportError: No module named sklearn.这真的应该有效.

我在Mac OS 10.6.8上使用Enthought免费发布Python(2.7.3),使用NumPy 1.6.1和SciPy 0.10.1.是的,我知道EPD Free带有scikit-learn但是pip应该升级我的版本,以便我可以实际使用scikit-learn.

python scikits scikit-learn

26
推荐指数
3
解决办法
8万
查看次数

Python统计包:statsmodel和scipy.stats之间的区别

我需要一些关于为Python选择统计软件包的建议,我做了很多搜索,但不确定我是否做得对,特别是statsmodels和scipy.stats之间的区别.

我知道的一件事是scikits命名空间是scipy的特定"分支",而以前的scikits.statsmodels现在称为statsmodels.另一方面,还有scipy.stats.两者之间有什么区别,哪一个是Python 统计软件包?

谢谢.

- 编辑 -

我更改了标题,因为有些答案与问题没有关系,我认为这是因为标题不够明确.

python scipy scikits statsmodels

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

如何在scikit中创建sklearn.datasets.base.Bunch对象 - 从我自己的数据中学习?

在大多数Scikit-learn算法中,数据必须作为Bunch对象加载.对于教程中的许多示例,load_files()或其他函数用于填充Bunch对象.像load_files()这样的函数希望数据以某种格式存在,但我有以不同格式存储的数据,即每个字段都包含字符串的CSV文件.

如何解析此并以Bunch对象格式加载数据?

scikits scikit-learn

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

Numpy:如何将矩阵随机分割/选择为n个不同的矩阵

  • 我有一个形状为(4601,58)的numpy矩阵.
  • 我想根据行数按60%,20%,20%的比例随机分割矩阵
  • 这是我需要的机器学习任务
  • 是否存在随机选择行的numpy函数?

python random numpy scipy scikits

13
推荐指数
2
解决办法
7740
查看次数

scikits learn and nltk:Naive Bayes分类器性能差异很大

我正在比较两个Naive Bayes分类器:一个来自NLTK,另一个来自scikit-learn.我正在处理一个多类分类问题(3个类:正(1),负(-1)和中性(0)).

在不执行任何特征选择的情况下(即,使用所有可用功能),并使用70,000个实例的训练数据集(噪声标记,实例分布为17%为正,4%为负,78%为中性),我训练了两个分类器,第一个是nltk.NaiveBayesClassifier,第二个是sklearn.naive_bayes.MultinomialNB(带fit_prior=True).

训练结束后,我在30,000个实例的测试集上评估了分类器,得到了以下结果:

**NLTK's NaiveBayes**
accuracy: 0.568740
class: 1
     precision: 0.331229
     recall: 0.331565
     F-Measure: 0.331355
class: -1
     precision: 0.079253 
     recall: 0.446331 
     F-Measure: 0.134596 
class: 0
     precision: 0.849842 
     recall: 0.628126 
     F-Measure: 0.722347 


**Scikit's MultinomialNB (with fit_prior=True)**
accuracy: 0.834670
class: 1
     precision: 0.400247
     recall: 0.125359
     F-Measure: 0.190917
class: -1
     precision: 0.330836
     recall: 0.012441
     F-Measure: 0.023939
class: 0
     precision: 0.852997
     recall: 0.973406
     F-Measure: 0.909191

**Scikit's MultinomialNB (with fit_prior=False)**
accuracy: 0.834680
class: 1
     precision: 0.400380
     recall: 0.125361 …
Run Code Online (Sandbox Code Playgroud)

python machine-learning nltk scikits scikit-learn

13
推荐指数
2
解决办法
4542
查看次数

在张量因子分解后重新构成张量

我正在尝试使用python库scikit-tensor分解3D矩阵.我设法将我的Tensor(尺寸为100x50x5)分解为三个矩阵.我的问题是如何使用Tensor分解产生的分解矩阵再次组合初始矩阵?我想检查分解是否有任何意义.我的代码如下:

import logging
from scipy.io.matlab import loadmat
from sktensor import dtensor, cp_als
import numpy as np

//Set logging to DEBUG to see CP-ALS information
logging.basicConfig(level=logging.DEBUG)
T = np.ones((400, 50))
T = dtensor(T)
P, fit, itr, exectimes = cp_als(T, 10, init='random')
// how can I re-compose the Matrix T? TA = np.dot(P.U[0], P.U[1].T)
Run Code Online (Sandbox Code Playgroud)

我正在使用scikit-tensor库函数cp_als提供的规范分解.此外,分解矩阵的预期维数是多少?

python math scikits data-science

13
推荐指数
1
解决办法
660
查看次数

使用python setup.py egg_info时安装scikits.audiolab时出错

我正在尝试使用pip工具安装scikits.audiolab.Pip似乎python setup.py egg_info从scikits.audiolab源目录中运行命令.当它这样做时,我收到此错误:

Andrews-MacBook-Pro-2:scikits.audiolab-0.11.0 andrewhannigan$ pip install scikits.audiolab
Collecting scikits.audiolab
  Using cached scikits.audiolab-0.11.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/var/folders/xb/qwlsm44s1wxfr82kytrgjtl80000gn/T/pip-build-vSZaU8/scikits.audiolab/setup.py", line 32, in <module>
        from numpy.distutils.core import setup
    ImportError: No module named numpy.distutils.core

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/xb/qwlsm44s1wxfr82kytrgjtl80000gn/T/pip-build-vSZaU8/scikits.audiolab
Run Code Online (Sandbox Code Playgroud)

问题显然是无法导入numpy.distutils.core.查看setup.py脚本,这个导入很早就发生了(在下面的代码片段的底部):

#! /usr/bin/env python
# Last Change: Fri Mar 27 05:00 PM 2009 J

# Copyright (C) 2006-2007 …
Run Code Online (Sandbox Code Playgroud)

python pip scikits

9
推荐指数
1
解决办法
2037
查看次数