我在我的系统中安装了python 2.7,我需要使用audiolab模块.我从以下网站下载:http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikits.audiolab
当我导入scikits.audiolab时,我收到以下错误:
Traceback (most recent call last):
File "C:/Python27/trystuff", line 1, in <module>
from scikits.audiolab import formatinfo as format
File "C:\Python27\lib\site-packages\scikits\__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
ImportError: No module named pkg_resources
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
所以我读了scikit-learn包webpate:
我可以使用逻辑回归来拟合数据,在获得LogisticRegression实例后,我可以使用它来对新数据点进行分类.到现在为止还挺好.
有没有办法设置LogisticRegression()实例的系数?因为在我获得训练的系数后,我想使用相同的API来分类新的数据点.
或者也许其他人推荐另一个拥有更好API的python机器学习包?
谢谢
在sklearn.linear_model.LogisticRegression用于拟合训练数据集之后,我想获得训练数据集的成本函数的值和交叉验证数据集.
是否可以sklearn简单地给我最小化函数的值(在最小值)?
该函数在http://scikit-learn.org/stable/modules/linear_model.html#logistic-regression的文档中说明(取决于所选择的正则化).但我找不到如何sklearn给我这个功能的价值.
我原以为这会是什么LogisticRegression.score,但这只会返回准确性(其预测正确分类的数据点的比例).
我发现sklearn.metrics.log_loss,但当然这不是最小化的实际功能.
python machine-learning scikits scikit-learn logistic-regression
我正在尝试此代码段.我正在使用scikits.learn 0.8.1
from scikits.learn import linear_model
import numpy as np
num_rows = 10000
X = np.zeros([num_rows,2])
y = np.zeros([num_rows,1])
# assume here I have filled in X and y appropriately with 0s and 1s from the dataset
clf = linear_model.LogisticRegression()
clf.fit(X, y)
Run Code Online (Sandbox Code Playgroud)
我得到了这个 - >
/usr/local/lib/python2.6/dist-packages/scikits/learn/svm/liblinear.so in scikits.learn.svm.liblinear.train_wrap (scikits/learn/svm/liblinear.c:992)()
ValueError: Buffer has wrong number of dimensions (expected 1, got 2)
Run Code Online (Sandbox Code Playgroud)
这里有什么问题?
我正在使用scikit-learn来查找文档的Tf-idf权重,然后使用朴素
贝叶斯分类器对文本进行分类.但是文档中所有单词的Tf-idf权重都是负数,除了少数.但据我所知,负值意味着不重要的术语.那么有必要将整个Tf-idf值传递给贝叶斯分类器吗?如果我们只需要通过其中的一小部分,我们该怎么做呢?与linearSVC相比,贝叶斯分类器有多好或多坏?除了使用Tf-idf之外,还有更好的方法在文本中查找标签吗?
谢谢
我正在使用数据集训练线性回归模型,该数据集在区间[0,10]中具有实值标签.我在测试集上的预测值有一些超过10的预测.有没有办法将预测限制在10.
我正在考虑进行条件检查,如果预测超过10,我明确地将其设置为10.
有没有更好的办法?
我写下了一个简单的代码,它采用一个参数“query_seq”,进一步的方法计算描述符,最后可以使用“LogisticRegression”(或函数提供的任何其他算法)算法作为“0(给定情况为负)” )”或“1(给定情况下为正)”
def main_process(query_Seq):
LR = LogisticRegression()
GNB = GaussianNB()
KNB = KNeighborsClassifier()
DT = DecisionTreeClassifier()
SV = SVC(probability=True)
train_x, train_y,train_l = data_gen(p)
a = DC_CLASS()
test_x = a.main_p(query_Seq)
return Prediction(train_x, train_y, test_x,LR)
Run Code Online (Sandbox Code Playgroud)
当我们执行交叉验证时,我们已经计算了算法的准确度估计(特异性、灵敏度、mmc 等)的不同统计参数。现在我的问题是,scikit-learn 中是否有任何方法可以让我们估计测试数据预测的置信度分数。
我看attributes的skbio's PCoA方法(见下表).我是新来这个API,我希望能够得到eigenvectors投射到新中轴线和原始点相似.fit_transform的sklearn.decomposition.PCA,所以我可以创造一些PC_1 vs PC_2式的情节.我想出了如何获得eigvals,proportion_explained但features回来了None.
这是因为它处于测试阶段吗?
如果有任何教程使用它,那将非常感激.我是一个狂热的粉丝,scikit-learn并希望开始使用更多的scikit's产品.
| Attributes
| ----------
| short_method_name : str
| Abbreviated ordination method name.
| long_method_name : str
| Ordination method name.
| eigvals : pd.Series
| The resulting eigenvalues. The index corresponds to the ordination
| axis labels
| samples : pd.DataFrame
| The position of the samples …Run Code Online (Sandbox Code Playgroud) machine-learning linear-algebra dimensionality-reduction scikits skbio
我想在 python 中使用 svm 分类器找出错误率,我采取的方法是:
1-svm.predict(test_samples).mean()
Run Code Online (Sandbox Code Playgroud)
但是,这种方法不起作用。sklearn 的评分函数也给出了平均准确度......但是,我不能使用它,因为我想完成交叉验证,然后找到错误率。请在 sklearn 中建议一个合适的函数来找出错误率。
我正在使用 skvideo 包阅读视频
video = skvideo.io.vread(video_path)
Run Code Online (Sandbox Code Playgroud)
这仅返回帧。但我也想读取帧速率,以便在保存处理后的视频时,我可以以相同的帧速率保存它。
我在 StackOverflow 上找到了很多获取帧速率的答案,但它们都使用open-cv. 我不想open-cv仅仅用来读取帧速率。
scikits ×10
python ×8
scikit-learn ×6
bayesian ×1
numpy ×1
python-2.7 ×1
regression ×1
skbio ×1
svm ×1
video ×1