标签: classification

从python输出创建ARFF文件

gardai-plan-crackdown-on-troublemakers-at-protest-2438316.html': {'dail': 1, 'focus': 1, 'actions': 1, 'trade': 2, 'protest': 1, 'identify': 1, 'previous': 1, 'detectives': 1, 'republican': 1, 'group': 1, 'monitor': 1, 'clashes': 1, 'civil': 1, 'charge': 1, 'breaches': 1, 'travelling': 1, 'main': 1, 'disrupt': 1, 'real': 1, 'policing': 3, 'march': 6, 'finance': 1, 'drawn': 1, 'assistant': 1, 'protesters': 1, 'emphasised': 1, 'department': 1, 'traffic': 2, 'outbreak': 1, 'culprits': 1, 'proportionate': 1, 'instructions': 1, 'warned': 2, 'commanders': 1, 'michael': 2, 'exploit': 1, 'culminating': 1, 'large': 2, 'continue': 1, 'team': …
Run Code Online (Sandbox Code Playgroud)

python classification file weka arff

8
推荐指数
2
解决办法
7738
查看次数

识别图像中的图案

鉴于所有图像都是从相同的角度拍摄,这意味着要识别的模式将是图像中识别图案(可能是文本,签名,徽标,不是面孔,物体,人等)的最佳方法始终以相同的角度可见,但不是位置/尺寸/质量/亮度等.

假设我有徽标,我想对1000张不同尺寸和质量的图像进行测试,并获得嵌入此图案的图像,或者至少很有可能嵌入此图案.

谢谢,

classification image-processing image-recognition computer-vision

8
推荐指数
2
解决办法
1967
查看次数

如何计算roc曲线?

我写了一个分类器(高斯混合模型)来分类五个人类行为.对于每次观察,分类器计算属于群集的后验概率.

我想要用阈值参数化我的系统的性能,值为0到100.对于每个阈值,对于每个观察,如果属于一个簇的概率大于阈值,我接受分类器的结果否则我丢弃它.

对于每个阈值,我计算真阳性,真阴性,假阳性,假阴性的数量.

比我计算两个函数:灵敏度和特异性为

sensitivity = TP/(TP+FN);

specificity=TN/(TN+FP);
Run Code Online (Sandbox Code Playgroud)

在matlab中:

plot(1-specificity,sensitivity);
Run Code Online (Sandbox Code Playgroud)

有ROC曲线.但结果并不是我所期望的.

这是丢弃,错误,纠正,敏感性和特异性功能的图,改变了一个动作的阈值.

这是丢弃,错误,纠正,敏感性和特异性功能改变阈值的图

这是一个动作的ROC曲线图 这是ROC曲线的图

这是同一动作的ROC曲线的主干 在此输入图像描述

我错了,但我不知道在哪里.也许我错误地计算了FP,FN,TP,TN,特别是当分类器的结果小于阈值时,所以我丢弃了.当丢弃时我必须增加什么?

matlab classification false-positive threshold roc

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

如何用彩色分支创建树状图?

我想在R中创建一个树状图,它有彩色分支,如下图所示. 在此输入图像描述

到目前为止,我使用以下命令创建标准树形图:

d <- dist(as.matrix(data[,29]))   # find distance matrix 
 hc <- hclust(d)                # apply hirarchical clustering 
 plot(hc,labels=data[,1], main="", xlab="") # plot the dendrogram
Run Code Online (Sandbox Code Playgroud)

我该如何修改此代码以获得所需的结果?

在此先感谢您的帮助.

r classification dendrogram dendextend

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

使用插入符号在R中进行分类的预测(模型)和预测(模型$ finalModel)之间的差异

什么区别

predict(rf, newdata=testSet)
Run Code Online (Sandbox Code Playgroud)

predict(rf$finalModel, newdata=testSet) 
Run Code Online (Sandbox Code Playgroud)

我训练模型 preProcess=c("center", "scale")

tc <- trainControl("repeatedcv", number=10, repeats=10, classProbs=TRUE, savePred=T)
rf <- train(y~., data=trainingSet, method="rf", trControl=tc, preProc=c("center", "scale"))
Run Code Online (Sandbox Code Playgroud)

当我在一个居中和缩放的testSet上运行它时,我会收到0个正数

testSetCS <- testSet
xTrans <- preProcess(testSetCS)
testSetCS<- predict(xTrans, testSet)
testSet$Prediction <- predict(rf, newdata=testSet)
testSetCS$Prediction <- predict(rf, newdata=testSetCS)
Run Code Online (Sandbox Code Playgroud)

但是当我在一个未缩放的testSet上运行它时会收到一些真正的积极因素.我必须使用rf $ finalModel在居中和缩放的testSet和未缩放的rf对象上接收一些真正的postive ...我缺少什么?


编辑

测试:

tc <- trainControl("repeatedcv", number=10, repeats=10, classProbs=TRUE, savePred=T)
RF <-  train(Y~., data= trainingSet, method="rf", trControl=tc) #normal trainingData
RF.CS <- train(Y~., data= trainingSet, method="rf", trControl=tc, preProc=c("center", "scale")) #scaled and centered trainingData
Run Code Online (Sandbox Code Playgroud)

在正常的testSet上:

RF predicts …
Run Code Online (Sandbox Code Playgroud)

r classification prediction r-caret

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

理想的HoG功能数量

因此,有很多选项可以提取HoG功能.使用不同的方向,每个单元的不同像素数和不同的块大小.

但是有标准或最佳配置吗?我有50x100大小的训练图像,我选择了8个方向.我正在从训练数据中提取特征以进行车辆分类.但我真的不知道什么是"最佳".

例如,我在这里有2个配置,有没有理由选择其中一个?就个人而言,我觉得第二个是更好的选择,但为什么呢?

在此输入图像描述

在此输入图像描述

classification image-processing feature-extraction training-data

8
推荐指数
1
解决办法
2692
查看次数

在特定文件上测试NLTK分类器

以下代码运行Naive Bayes电影评论分类器.该代码生成一个信息最丰富的功能列表.

注意: **movie review**文件夹在nltk.

from itertools import chain
from nltk.corpus import stopwords
from nltk.probability import FreqDist
from nltk.classify import NaiveBayesClassifier
from nltk.corpus import movie_reviews
stop = stopwords.words('english')

documents = [([w for w in movie_reviews.words(i) if w.lower() not in stop and w.lower() not in string.punctuation], i.split('/')[0]) for i in movie_reviews.fileids()]


word_features = FreqDist(chain(*[i for i,j in documents]))
word_features = word_features.keys()[:100]

numtrain = int(len(documents) * 90 / 100)
train_set = [({i:(i in tokens) for i in …
Run Code Online (Sandbox Code Playgroud)

nlp classification nltk python-2.7 text-classification

8
推荐指数
1
解决办法
2396
查看次数

年龄的神经网络序数分类

我创建了一个简单的神经网络(Python,Theano),根据他们从不同商店选择的消费历史来估计一个人的年龄.不幸的是,它并不是特别准确.

网络不了解普通性这一事实可能会损害准确性.对于网络,年龄分类之间没有关系.它目前正在从softmax输出层中选择概率最高的年龄.

我考虑将输出分类更改为每个年龄的加权概率的平均值.

例如,给定年龄概率:(年龄10:20%,年龄20:20%,年龄30:60%)

Rather than output: Age 30 (Highest probability)
Weighted Average: Age 24 (10*0.2+20*0.2+30*0.6 weighted average)
Run Code Online (Sandbox Code Playgroud)

该解决方案感觉次优.是否有更好的方法在神经网络中实现序数分类,还是有更好的机器学习方法可以实现?(例如逻辑回归)

regression classification machine-learning neural-network theano

8
推荐指数
1
解决办法
3473
查看次数

如何在scikit-learn中将数字特征与文本(词袋)正确组合?

我正在为网页编写分类器,所以我有多种数字特征,我也想对文本进行分类.我正在使用词袋方法将文本转换为(大)数字向量.代码最终是这样的:

from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
import numpy as np

numerical_features = [
  [1, 0],
  [1, 1],
  [0, 0],
  [0, 1]
]
corpus = [
  'This is the first document.',
  'This is the second second document.',
  'And the third one',
  'Is this the first document?',
]
bag_of_words_vectorizer = CountVectorizer(min_df=1)
X = bag_of_words_vectorizer.fit_transform(corpus)
words_counts = X.toarray()
tfidf_transformer = TfidfTransformer()
tfidf = tfidf_transformer.fit_transform(words_counts)

bag_of_words_vectorizer.get_feature_names()
combinedFeatures = np.hstack([numerical_features, tfidf.toarray()])
Run Code Online (Sandbox Code Playgroud)

这有效,但我很关心准确性.请注意,有4个对象,只有两个数字特征.即使是最简单的文本也会产生具有九个特征的向量(因为语料库中有九个不同的单词).显然,对于真实文本,将会有数百个或数千个不同的单词,因此最终的特征向量将是<10个数字特征但是> 1000个单词的特征向量.

因此,分类器(SVM)不会将数字特征上的单词加权100到1倍吗?如果是这样,我该如何补偿以确保单词包的数量与数字特征的权重相等?

python classification scikit-learn text-classification

8
推荐指数
1
解决办法
2341
查看次数

如何选择要用于我的模型的预训练权重?

我是一个初学者,对于如何选择可以改善我的模型的预训练模型,我感到非常困惑。

我正在尝试使用模型的预训练权重创建猫品种分类器,比如说在数字数据集上训练的VGG16,这会改善模型的性能吗?或者如果我仅在数据库上训练模型而不使用其他权重会更好,或者两者都与那些预先训练的权重相同只是一个起点。

另外,如果我使用针对猫和狗数据训练的VGG16的权重作为我的猫品种分类模型的起点,这将有助于我改进模型吗?

classification deep-learning pre-trained-model transfer-learning

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