training vs validation accuracy and loss output error
Can anyone help me interpret these graphs.
I have been training some datasets over SENet for image classification (tensorLayer).
I started with cifar10 and got some satisfying results with it I use data augmentation for all my experiments.
Next i tried training it with Caltech256 and the results were pretty unusual Maybe due to less number of images per class(3050)
Finally i used TinyImagenet with enough training samples per class(500) but the results are still looking odd somewhat similar to caltech256 results
Is that supposed to be a problem with the data??
See also questions close to this topic

How to install specific function from package in R?
I have installed 'caret' package using
install.packages('caret', dependencies = c("Depends", "Suggests"))
But I didn't get createDataPartition and dummyVars functions part of 'caret' package.
> dummyVars(formula, data, sep = ".", levelsOnly = FALSE, fullRank = FALSE, ...) >createDataPartition(y, times = 1, p = 0.5, list = TRUE, groups = min(5, length(y)))
even while loading package
library('caret')
it is giving :Error: package or namespace load failed for ‘caret’ in loadNamespace(j < i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘ddalpha’ In addition: Warning message: package ‘caret’ was built under R version 3.4.3
And I installed many packages that I got in error message.
So I want to know, Is there any way to install specific function from package?

extracting patterns from a system using machine learning
The following is the problem statement: I have a system in which I observe and extract various events. A group of events are highly related in time. The groups themselves are not in any way related. For example, let us assume that the system has two blocks  A and B. An event from A (say A.e1) occurs within a time window t1; in response to this, event from B (say B.e2) occurs within a time window t2; in response to this event from A (say A.e3) occurs within a time window t3. So, this is one group of events or one pattern. If a system has many such block (like A and B), many such event groups would happen. The observer in the system generates log of these events when system is operational. A human can look at these events in the log and identify the patterns. What would be the best ML approach for a problem of this type? PS: I am not expecting a solution but more of direction for such problem class.

How to launch oython projects?
I am studing python for a week and machine learning for about 2 days so sorry for asking stupid question. I wanted to learn machine learning via one project on github but I am totally lost how to launch python projects and what is their structure overall...
For example https://github.com/MaxTitkov/Keras_InceptionV3_Binary_classification lots of python files and I can not understand which one to launch first so it will pull up the rest.. None of them has reference to the others files inside the code. So I guess I need to launch them all separately via python + name of the file or how does it work with python projects?

Predictions in the mxnet package
I'm trying to train a neural network and convolutional neural network in R with the package mxnet for a 2class classification problem. I'm using the fucntion "mx.mlp" for the neural network and the function "mx.model.FeedForward.create" for the convolutional neural network (CNN).
My problem is the predictions. I get the exact same probabilities for the 2 classes from both of the 2 functions in the test set which is very strange. This means that the models can only predict one class. I have tried to solve this problem for 3 weeks now without success. Any help would be much appreciated.
here is the links to the:
train set : https://www.dropbox.com/s/m47rx05iahvpild/train_set.csv?dl=0
test set : https://www.dropbox.com/s/ld38q2zq0t3yplo/test_set.csv?dl=0
R code : https://www.dropbox.com/s/nsoc5nb0hlibw7h/rcode.R?dl=0

Code for sampling negative binomial distribution
I would like to write a function that uses a uniform random number generator to sample from the negative binomial distribution. How would I do this?
It's not clear to me if this should be posted here or in stats.stackexchange. I can push it over there if that's a better fit.

How to fit a poisson distribution to a histogram using MATLAB?
I have integervalued data from a physical process that should follow poisson statistics. I'm trying to fit a poisson distribution to the histogram of the data. Here's what the histogram looks like:
I fit the histogram of the data to a poisson distribution using the following code:
figure; histfit(x(x>0),30,'poisson')
And obtain:
Am I doing something wrong? Should the fit be scaled, if so how? To me, the histogram in the first image looks roughly poissonian, so it surprises me that the fit is so poor.

Gstreamer and frame (image) processing  filtering
I noticed that some video players are adding some filters to the frames so they look better and less noisy and then I understand that this is done with
GStreamer
and its plugins for all the rendering.Example of one frame:
Image file:
I'm working on image processing with c++ and I'm interested in the way
GStreamer
is filtering the images. Do you have any idea how it is done?I'm looking at their repository but it is hard to find where they do the image processing and what filters are applying.

How to prevent a lazy Convolutional Neural Network?
How to prevent a lazy Convolutional Neural Network? I end with a ‘lazy CNN’ after training it with KERAS. Whatever the input is, the output is constant. What do you think the problem is?
I try to repeat an experiment of NVIDIA’s End to End Learning for SelfDriving Cars the paper. Absolutely, I do not have a real car but a Udacity’s simulator . The simulator generates figures about the foreground of a car.
A CNN receives the figure, and it gives the steering angle to keep the car in the track. The rule of the game is to keep the simulated car runs in the track safely. It is not very difficult.
The strange thing is sometimes I end with a lazy CNN after training it with KERAS, which gives constant steering angles. The simulated car will go off the trick, but the output of the CNN has no change. Especially the layer gets deeper, e.g. the CNN in the paper.
If I use a CNN like this, I can get a useful model after training.
model = Sequential() model.add(Lambda(lambda x: x/255.0  0.5, input_shape = (160,320,3))) model.add(Cropping2D(cropping=((70,25),(0,0)))) model.add(Conv2D(24, 5, strides=(2, 2))) model.add(Activation('relu')) model.add(Conv2D(36, 5, strides=(2, 2))) model.add(Activation('relu')) model.add(Conv2D(48, 5, strides=(2, 2))) model.add(Activation('relu')) model.add(Flatten()) model.add(Dense(50)) model.add(Activation('sigmoid')) model.add(Dense(10)) model.add(Activation('sigmoid')) model.add(Dense(1))
But, if I use a deeper CNN, I have more chance to receive a lazy CNN. Specifically, if I use a CNN which likes NVIDIA’s, I almost receive a lazy CNN after every training.
model = Sequential() model.add(Lambda(lambda x: x/255.0  0.5, input_shape = (160,320,3))) model.add(Cropping2D(cropping=((70,25),(0,0)))) model.add(Conv2D(24, 5, strides=(2, 2))) model.add(Activation('relu')) model.add(Conv2D(36, 5, strides=(2, 2))) model.add(Activation('relu')) model.add(Conv2D(48, 5, strides=(2, 2))) model.add(Activation('relu')) model.add(Conv2D(64, 3, strides=(1, 1))) model.add(Activation('relu')) model.add(Conv2D(64, 3, strides=(1, 1))) model.add(Activation('relu')) model.add(Flatten()) model.add(Dense(1164)) model.add(Activation('sigmoid')) model.add(Dense(100)) model.add(Activation('sigmoid')) model.add(Dense(50)) model.add(Activation('sigmoid')) model.add(Dense(10)) model.add(Activation('sigmoid')) model.add(Dense(1))
I use ‘relu’ for convolution layers, and the activation function for the fully connected layer is ‘sigmoid’. I try to change the activation function, but there is no effect.
There is my analysis. I do not agree with a bug in my program because I can successfully drive the car with same codes and a simpler CNN. I think the reason is the simulator or the structure of the neural network. In a real selfdriving car, the training signal, that is the steering angle, should contain noise; therefor, the driver never holds the wheel still in the real road. But in the simulator, the training signal is very clean. Almost 60% of the steering angle is zero. The optimizer can easily do the job by turning the output of CNN close to the zero. It seems the optimizer is lazy too. However, when we really want this CNN output something, it also gives zeros. So, I add small noise for these zero steering angles. The chance that I get a lazy CNN is smaller, but it is not disappearing.
What do you think about my analysis? Is there other strategy that I can use? I am wondering whether similar problems have been solved in the long history of CNN research.

How to write a Roi function by hand in opencv2
Could anyone help me with manually writing a function which is the same as roi=img(rect)? I tried one, but the thing is what it returns has no relation with the big picture. if I make roi_img changed, the same position at the big picture won't change at all! seems it's something about memory?could anyone help me?
Mat GetRoi(const Mat &src_image, const Rect &rect){ Mat roi_img(rect.height,rect.width,CV_8UC3); uchar* pxvec = roi_img.ptr<uchar>(0); int i, j; int x = rect.y; int y = rect.x; for (i = 0; i < roi_img.rows; i++) { pxvec = roi_img.ptr<uchar>(i); //三通道数据都在第一行依次排列，按照BGR顺序 y = rect.x; for (j = 0; j < roi_img.cols*roi_img.channels();y++ ) { pxvec[j++] = src_image.at<Vec3b>(x,y)[0]; pxvec[j++] = src_image.at<Vec3b>(x, y)[1]; pxvec[j++] = src_image.at<Vec3b>(x, y)[2]; } x++; } return roi_img; }

How to decode an image so it can be feed into a keras model?
I have one image. I really want to transform/decode it to become a tensor. Why? Because I want to feed this tensor into my neural network written in keras. The question is, how do I transform this image into a tensor with values, that doesn't give me an error when feeding the neural net ?
So suppose there is a PATH, and this has to be changed into a TENSOR, which can be feed into the keras neural network.
Thank you, very much.

All dimensions except 1 must match. Input 1 has shape [600 36] and doesn't match input 0 with shape [1800 36]
I am new in tensorflow and deep learning, i trying to learn to combine CNN and RNN and I facing a problem, where i try to implement a CRNN for a activity recognition dataset from UCI. Link to github file
lstm_size = 36 lstm_layers = 2 batch_size = 600 seq_len = 200 learning_rate = 0.0005 epochs = 200 n_classes = 7 n_channels = 3 conv1 = tf.layers.conv1d(inputs=inputs_, filters=18, kernel_size=2, strides=1, padding='same', activation = tf.nn.relu) n_ch = n_channels *2 lstm_input = tf.transpose(conv1, [1,0,2]) lstm_input = tf.reshape(lstm_input, [1, n_ch]) lstm_input = tf.layers.dense(lstm_input, lstm_size, activation=None) lstm_input = tf.split(lstm_input, seq_len, 0) lstm = tf.contrib.rnn.BasicLSTMCell(lstm_size) dropout = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob_) cell = tf.contrib.rnn.MultiRNNCell([dropout] * lstm_layers) initial_state = cell.zero_state(batch_size, tf.float32)
Below is my state function:
outputs, final_state = tf.contrib.rnn.static_rnn(cell, lstm_input, dtype=tf.float32, initial_state = initial_state) logits = tf.layers.dense(outputs[1], n_classes, name='logits') cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=labels_)) optimizer = tf.train.AdamOptimizer(learning_rate_).minimize(cost) correct_pred = tf.equal(tf.argmax(logits, 1), tf.argmax(labels_, 1)) accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32), name='accuracy')
Below is my session run:
test_acc = [] test_loss = [] train_acc = [] train_loss = [] # with graph.as_default(): saver = tf.train.Saver() # with tf.Session(graph=graph) as sess: # with tf.Session() as sess: sess = tf.Session() sess.run(tf.global_variables_initializer()) # writer = tf.summary.FileWriter("logs/", sess.graph) iteration = 1 for e in range(epochs): # tf.set_random_seed(123) # Loop over batches state = sess.run(initial_state) for x,y in get_batches(X_train, y_train, batch_size): # Feed dictionary feed = {inputs_ : x, labels_ : y, keep_prob_ : 0.5, initial_state : state, learning_rate_ : learning_rate} # Loss loss, _ , state, acc = sess.run([cost, optimizer, final_state, accuracy], feed_dict = feed) train_acc.append(acc) train_loss.append(loss) # Print at each 5 iters if (iteration % 5 == 0): print("Epoch: {}/{}".format(e, epochs), "Iteration: {:d}".format(iteration), "Train loss: {:6f}".format(loss), "Train acc: {:.6f}".format(acc)) # Compute validation loss at every 10 iterations if (iteration%10 == 0): val_state = sess.run(cell.zero_state(batch_size, tf.float32)) val_acc_ = [] val_loss_ = [] for x_t, y_t in get_batches(X_test, y_test, batch_size): # Feed feed = {inputs_ : x_t, labels_ : y_t, keep_prob_ : 1.0, initial_state : val_state} # Loss loss_v, state_v, acc_v = sess.run([cost, final_state,accuracy], feed_dict = feed) val_acc_.append(acc_v) val_loss_.append(loss_v) # Print info print("Epoch: {}/{}".format(e, epochs), "Iteration: {:d}".format(iteration), "Testing loss NOW: {:6f}".format(np.mean(val_loss_)), "Testing acc NOW: {:.6f}".format(np.mean(val_acc_))) # Store test_acc.append(np.mean(val_acc_)) test_loss.append(np.mean(val_loss_)) # Iterate iteration += 1 print("Optimization Finished!") print("Ended!")
When i run my code i got this error...:
All dimensions except 1 must match. Input 1 has shape [600 36] and doesn't match input 0 with shape [1800 36].
All help is appreciated, thank in advance. Really do hope someone able to help me solve this mess

How to determine steps_per_epoch while using Image augumentation as it increase the number of images
model.fit_generator(datagen.flow(X_train,y_train,batch_size=32),epochs=10,steps_per_epoch=5000,validation_data=(X_test,y_test))
My total data size is 5000 and batch size is 32 , Then how to determine value for steps_per_epoch
case 1:When not using ImageAugumentation
cas2 2:When using using ImageAugumentation(Coz number images will increase and how to include that in steps_per_epoch)

Machine Learning Multiclass classification, imbalanced data upsampling
I have been working on a classification problem
I have a data of 296 samples (collecting more samples not possible) . Output attribute has 5 classes and there are 12 input attributes. The data is not balanced one class has around 150 samples, another has around 50, one has around 35, another one also around 25 and last class has around 15 samples. Because of small and imbalanced data, I was not able to build a model with accuracy more than 65%, I have tried multiple algorithms. I tried upsampling but in place of upsampling classes with small samples. I doubled the entire data. So, to increase the size, I used each sample twice So 296x2 = 592 samples
Is it ok to use this technique or not? If not, what would be the better approach.

SVM multi classfication Matlab
I'm PhD student, recently studying machine learning. I'm implementing the source code (Matlab) below which classify the queried data into 3 classes (1,2 and 3) using RBF classification. My question is, how can i plot the classification results on Matlab, namely, when i use parameters 'showplot,true' i get a warning message saying "The display option can only plot 2D training data". Any help, please.
%Code source TrainingSet=[1 2 8;2 3 4;3 2 9;8 4 10;3 1 6;4 7 15]; GroupTrain=[1,1,2,2,3,3]; TestSet=[1 2 8;8 4 10;1 2 8]; results = multisvm_h(TrainingSet, GroupTrain, TestSet); disp('multi class problem'); disp(results); % Function multisvm_h function [result] = multisvm_h(TrainingSet,GroupTrain,TestSet) u=unique(GroupTrain); numClasses=length(u); result = zeros(length(TestSet(:,1)),1); for k=1:numClasses G1vAll=(GroupTrain==u(k)); models(k) = svmtrain(TrainingSet,G1vAll,'kernel_function','rbf'); end %classify test cases for j=1:size(TestSet,1) for k=1:numClasses if(svmclassify(models(k),TestSet(j,:))) break; end end result(j) = k; end
Kind regards.

scikitlearn fit function error
I'm trying to create a simple classifier for the CIFAR10 data, but when I'm trying to execute this python code:
import cPickle from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC def unpickle(file): with open(file, 'rb') as fo: dict = cPickle.load(fo) return dict def main(): s="data_batch_" dicts=[None]*5 for i in xrange(1,6): dicts[i1]=unpickle(s+str(i)) X, y = dicts[0]['data'], dicts[0]['labels'] for i in xrange(1,5): X = np.concatenate((X, dicts[i]['data'])) y = np.concatenate((y, dicts[i]['labels'])) classifier=OneVsRestClassifier(LinearSVC(random_state=0)).fit(X, y)
as long as the size of X and y is not too big  10000,a little more or less, it works fine. but when i tried 20000 samples from 2 batches (or 50000 samples from all the 5 batches), I got popup window of "Python.exe stop working". Is Something wrong with the code itself or the memory run out?
If the memory did run out, what should I do? is it possible to execute fit(X,y) 5 times, each loop for each batch?