classification

get the actual decision tree in pandas

孤者浪人 提交于 2019-12-24 21:32:37
问题 I'm using pandas command tree.DecisionTreeClassifier to build a (binary) classification tree. Something along the lines of: dcrG = tree.DecisionTreeClassifier(criterion='entropy',splitter='best',options_go_here) dcrG.fit(train[features], train['G']) Now that I have succesfully built my decision tree, I would like pandas to print me out the actual decision tree, so something along the lines of if (var1>0.4) if (var4>3.24) if (var2<0.5) return 1 else return 0 else return 1 else if (var3>3.5) if

Dynamic batch size in tensorflow

夙愿已清 提交于 2019-12-24 20:44:49
问题 I have built a classifier using tesnorflow. I generate proposal regions from images and those proposals are individually classified by my classifier. My problem is that I do not have a constant batch size when evaluating my model. Because every image has a different number of proposals, the number of proposals to be evaluated for every image is not constant. Right now I have set the batch size to 1, but this is inefficient and limits the processing speed of my classifier. Below is the

Keras: Input layer and passing input data correctly

大兔子大兔子 提交于 2019-12-24 18:46:57
问题 I am learning to use Keras functional API and I have managed to build and compile a model. But when I call the model.fit passing the data X and labels y , I got an error. It seems I still haven't got the idea of how it works. The task is classifying sentences into 6 types, and the code goes: X_ = ... # shape: (2787, 100) each row a sentence and each column a feature y_= ... # shape: (2787,) word_matrix_weights= ... # code to initiate a lookup matrix for vocabulary embeddings. shape: (9825,300

Plotting a graph on axes but getting no results while trying to classify image based on HoG features

烈酒焚心 提交于 2019-12-24 11:39:37
问题 I need to use boosted cascaded training to classify some images in scikit-learn. I want to classify according to HoG features. My code below is adapted from this example. This part of the code is the only thing that I've really done: import sys from scipy import misc, ndimage from skimage import data, io, filter, color, exposure from skimage.viewer import ImageViewer from skimage.feature import hog from skimage.transform import resize import matplotlib.pyplot as plt from sklearn.datasets

How should audio be pre-processed for classification?

前提是你 提交于 2019-12-24 10:27:05
问题 I am currently developing an audio classifier with the Python API of TensorFlow, using the UrbanSound8K dataset and trying to distinguish between 10 mutually exclusive classes. The audio files are 4 seconds long and contain 176400 data points which results in serious memory issues. How should the audio be pre-processed to reduce memory usage? And how can more useful features be extracted from the audio (using convolution and pooling)? 回答1: I personally prefer spectrograms as input for neural

Results from each fold in 10-fold Cross Validation in WEKA, using command-line.

混江龙づ霸主 提交于 2019-12-24 07:17:16
问题 This question is similar to this one: Weka: Results of each fold in 10-fold CV but I am instead looking to get the same results from the command-line. Hence, if this is my input java -cp "./weka.jar" weka.classifiers.trees.J48 -t ./WEKA_reference_test_set.arff -x 10 -i > test.csv How can I specify my output so that I can see the results for each fold? Thanks. 来源: https://stackoverflow.com/questions/21419588/results-from-each-fold-in-10-fold-cross-validation-in-weka-using-command-line

one class classification with keras

喜你入骨 提交于 2019-12-24 05:44:24
问题 I am trying to build a model to detect whether the input image is something or not(For example, dog or not). I'm coding with keras, but the accuracy is terrible. Do you have any idea to tune this correctly? Or should I use other tools other than keras for one class classification problem? Thank you so much in advance. Here's the code and the output I've wrote so far. train_dir = './path/to/train_dir' vali_dir = './path/to/validation_dir' train_datagen = ImageDataGenerator( rescale=1./255,

3-class AUC calculation in R (pROC package)

情到浓时终转凉″ 提交于 2019-12-24 03:18:10
问题 I met a problem of 3-class ROC analysis in R and obtained a very annoying result (see here ). Now I try to use a different way to solve it. The data is iris and the classifier is multinomial logistic regression which is in nnet package. The code is below: # iris data (3-class ROC) library(nnet) library(pROC) # should be installed first: install.packages('pROC') data(iris) # 3-class logistic regression model = multinom(Species~., data = iris, trace = F) # confusion matrix (z1) & accuracy (E1)

3-class AUC calculation in R (pROC package)

强颜欢笑 提交于 2019-12-24 03:18:06
问题 I met a problem of 3-class ROC analysis in R and obtained a very annoying result (see here ). Now I try to use a different way to solve it. The data is iris and the classifier is multinomial logistic regression which is in nnet package. The code is below: # iris data (3-class ROC) library(nnet) library(pROC) # should be installed first: install.packages('pROC') data(iris) # 3-class logistic regression model = multinom(Species~., data = iris, trace = F) # confusion matrix (z1) & accuracy (E1)

How to plot a ROC curve from Classification Tree probabilities

落爺英雄遲暮 提交于 2019-12-24 03:14:17
问题 I am attempting to plot a ROC curve with classification trees probabilities. However, when I plot the curve, it is absent. I am trying to plot the ROC curve and then find the AUC value from the area under the curve. Does anyone know how to fix this? Thank you if you can. The binary column Risk stands for risk misclassification, which I presume is my label. Should I be applying the ROC curve equation at a different point in my code? Here is the data frame: library(ROCR) data(Risk.table) pred =