neural-network

Cross validation with KNN classifier in Matlab

大憨熊 提交于 2019-12-24 00:50:53
问题 I am trying to extend this answer to knn classifier: load fisheriris; % // convert species to double isnum = cellfun(@isnumeric,species); result = NaN(size(species)); result(isnum) = [species{isnum}]; % // Crossvalidation vals = crossval(@(XTRAIN, YTRAIN, XTEST, YTEST)fun_knn(XTRAIN, YTRAIN, XTEST, YTEST), meas, result); the fun_knn funcion is: function testval = fun_knn(XTRAIN, YTRAIN, XTEST, YTEST) yknn = knnclassify(XTEST, XTRAIN, YTRAIN); [~,classNet] = max(yknn,[],2); [~,classTest] = max

Using scikit-learn's MLPClassifier in AdaBoostClassifier

时光怂恿深爱的人放手 提交于 2019-12-24 00:34:39
问题 For a binary classification problem I want to use the MLPClassifier as the base estimator in the AdaBoostClassifier . However, this does not work because MLPClassifier does not implement sample_weight , which is required for AdaBoostClassifier (see here). Before that, I tried using a Keras model and the KerasClassifier within AdaBoostClassifier but that did also not work as mentioned here . A way, which is proposed by User V1nc3nt is to build an own MLPclassifier in TensorFlow and take into

Is it possible to use arbitrary image sizes in caffe?

让人想犯罪 __ 提交于 2019-12-24 00:22:17
问题 I know that caffe has the so called spatial pyramid layer, which enables networks to use arbitrary image sizes. The problem I have is, that the network seems to refuse, to use arbitrary image sizes within a single batch. Do I miss something or is this the real problem?. My train_val.prototxt: name: "digits" layer { name: "input" type: "Data" top: "data" top: "label" include { phase: TRAIN } transform_param { scale: 0.00390625 } data_param { source: "/Users/rvaldez/Documents/Datasets/Digits

Getting errors while using neuralnet function

僤鯓⒐⒋嵵緔 提交于 2019-12-24 00:02:17
问题 I tried neural net in R on Boston data set available. data("Boston",package="MASS") data <- Boston Retaining only those variable we want to use: keeps <- c("crim", "indus", "nox", "rm" , "age", "dis", "tax" ,"ptratio", "lstat" ,"medv" ) data <- data[keeps] In this case the formula is stored in an R object called f. The response variable medv is to be “regressed” against the remaining nine attributes. I have done it as below: f <- medv ~ crim + indus + nox + rm + age + dis + tax + ptratio +

Convolutional ImageNet network is invariant to flipping images

一个人想着一个人 提交于 2019-12-23 22:15:33
问题 I am using Deep learning caffe framework for image classification. I have coins with faces. Some of them are left directed some of them are right. To classify them I am using common aproach - take weights and structure from pretrained ImageNet network that have already capture a lot of image patterns and train mostly the last layer to fit my training set. But I have found that netowork does not works on this set: I have taken some coin for example leftdirected , generated horizontally flipped

Using nntool [MATLAB] from command line

末鹿安然 提交于 2019-12-23 21:26:48
问题 I have this code: in = [5 columns of data-points]; out = [1 column of data-points]; net = newfit(in,out,5); net = train(net,in,out); now I want to access the error variable that is generated (so that I can calculate the mean error etc.) run this in a loop, so I want to re-initialize weights between loops. access the variable that stores the time it took to run How can these three things be done from command line ? [I know how these things can be done with nntool GUI] 回答1: Example: % some

3-D batch matrix multiplication without knowing batch size

痴心易碎 提交于 2019-12-23 21:11:44
问题 I'm currently writing a tensorflow program that requires multiplying a batch of 2-D tensors (a 3-D tensor of shape [None,...] ) with a 2-D matrix W . This requires turning W into a 3-D matrix, which requires knowing the batch size. I have not been able to do this; tf.batch_matmul is no longer usable, x.get_shape().as_list()[0] returns None , which is invalid for a reshaping/tiling operation. Any suggestions? I've seen some people use config.cfg.batch_size , but I don't know what that is. 回答1:

Custom median pooling in tensorflow

我怕爱的太早我们不能终老 提交于 2019-12-23 20:14:23
问题 I am trying to implement a median pooling layer in tensorflow. However there is neither tf.nn.median_pool and neither tf.reduce_median . Is there a way to implement such pooling layer with the python api ? 回答1: You could use something like: patches = tf.extract_image_patches(tensor, [1, k, k, 1], ...) m_idx = int(k*k/2+1) top = tf.top_k(patches, m_idx, sorted=True) median = tf.slice(top, [0, 0, 0, m_idx-1], [-1, -1, -1, 1]) To accommodate even sized median kernels and multiple channels, you

How can I intentionally overfit a convolutional neural net in Keras to make sure the model is working?

元气小坏坏 提交于 2019-12-23 19:54:33
问题 I'm trying to diagnose what's causing low accuracies when training my model. At this point, I just want to be able to get to high training accuracies (I can worry about testing accuracy/overfitting problems later). How can I adjust the model to overindex on training accuracy? I want to do this to make sure I didn't make any mistakes in a preprocessing step (shuffling, splitting, normalizing, etc.). #PARAMS dropout_prob = 0.2 activation_function = 'relu' loss_function = 'categorical

Quick search of the face descriptors in the db

我与影子孤独终老i 提交于 2019-12-23 19:17:51
问题 I want to implement something like face recognition application using neural networks. So I found this incredible article. When we put the face image in the OpenFace network we get 128 measurements which we can use to compare faces. But here we get the main question: how we can quickly find the same face in the database with the closest 128 values? If we will use SVM(as it is written in the article) we should to retrain the classifier every time when we put the new face in the db, but it's