neuralnetwork how to choose the best model
I am using nftool to train my data (90 piece of data), and my training algorithm is "Bayesian Regularization" I am going to use different neurons to compare and find which one is the best model. Is there any appropriate step I need to follow? Do I need to retrain again and again until getting the good performance of model for each neurons?
See also questions close to this topic

Matlab: copy array in file txt
I want to copy elements of an array in a file txt. I read the first 50 samples of a wav file in array a and I want to copy a in a file txt. This is my code:
[s,fs]=wavread('file.wav'); for k=1:50 a=s(k) end fid = fopen('file.txt','wt'); fprintf(fid,'%f\n',a); fclose(fid);
With this code in file txt there is only the last element of a, not all samples.

Add some points to the graph manually and update indexes using MATLAB
I have an algorithm to find peaks and nadirs in the data but sometimes the algorithms fail to identify peaks and nadirs. Please check the following figure, as you can see after peak 11 it failed to select peak:
I want to write a code in which:
 I can select a peak/nadir point on the graph and save it in the vector
 update the indexes.
Here is part of the code: In the first part I tried to mark the peaks and nadirs and find the maximum amplitude
mn_ln=min(size(peaks,2), size(nadirs,2)); amp=zeros(1,mn_ln); fig=figure(10), hold on, plot(y,'r') , plot(peaks,y(peaks),'ro');plot(nadirs,y(nadirs),'bo'); for i=1:length(amp)1 text( peaks(i)+0.3, y(peaks(i)) , sprintf(num2str(i))) text( nadirs(i)+0.3, y(nadirs(i)) , sprintf(num2str(i))) if y(nadirs(i))>y(nadirs(i+1)) amp(i)=abs(y(peaks(i))y(nadirs(i+1))); line([peaks(i),peaks(i)],[y(peaks(i)),y(nadirs(i+1))],'Color','k','LineWidth',2) else y(nadirs(i))<=y(nadirs(i+1)) amp(i)=abs(y(peaks(i))y(nadirs(i))); line([peaks(i),peaks(i)],[y(peaks(i)),y(nadirs(i))],'Color','k','LineWidth',2) end end dcm_obj = datacursormode(fig); set(dcm_obj,'DisplayStyle','datatip','SnapToDataVertex','off','Enable','on') c_info = getCursorInfo(dcm_obj) peaks(i), y(peaks(i)=c_info.Position
I am new to Matlab, I am sorry in advance if my question seems too easy. But I could not add coordinates of new points to the vector and update all the indexes. My goal is to add a peak in the local maxima (peaks 12, between nadirs 12 and 13 and update all the indexes (make the next peaks 13,..and so on). Thanks and I appreciate your help

Plot vector field within given region (between two circles) in matlab
I want to plot below vector field in Matlab:
u = cos(xx_0).*yy_0; v = sin(x+x_0).*y+y_0;
I can do it easily in a grid, for example from 2 to 2 in x and y direction:
x_0=2; y_0=1; [x,y] = meshgrid(2:0.2:2, 2:0.2:2); figure quiver(x,y,u,v)
But I want to plot the vector field in a certain region which isn't square like above. The region I want to plot the vector field is the region between two circles, both centered at (x_0,y_0) with radii equal to
r_1=5
andr_2=10
How can I do that?

Is there a way to normalize a Caffe Blob along a certain dimension?
I've got a blob with the shape n * t * h * w (Batch number, features, height, width). Within a Caffe layer I want to do an L1 normalization along the t axis, i.e. for fixed n, h and w the sum of values along t should be equal to 1. Normally this would be no big deal, but since it's within a Caffe layer it should happen very quickly, preferably through the Caffe math functions (based on BLAS). Is there a way to achieve this in an efficient manner?
I unfortunately can't change the order of the shape parameters due to later processing, but I can remove the batch number (have a vector of blobs with just t * h * w) or I could convert the blob to an OpenCV Mat, if it makes things easier.
Edit 1: I'm starting to suspect I might be able to solve my task with the help of caffe_gpu_gemm, where I'd multiply a vector of ones of length t with a blob from one batch of shape t * h * w, which should theoretically give me the sums along the feature axis. I'll update if I figure out the next step.

Caffe process label data in python layer as int
I'm trying to make label data using python layer. Namely, I have an LMDB database of caffe datums where label is composed of 6 labels using bit mask and I need to extract one of them to learn with it.
But when passed to MyPythonLayer.forward method label field appeares to have np.float32 type and is rounded so that being converted back to int has different value then original one. Naturally it makes extracting part of it with bit mask useless. Is where a way to force Caffe to pass label data to MyPythonLayer.forward as int?
MyNet.prototxt:
layer { name: "data" type: "Data" top: "data" top: "label" include { phase: TRAIN } transform_param { scale: 1 } data_param { source: "SUMTH.../train_lmdb" batch_size: 3400 backend: LMDB } } ... layer { name: 'convert_compose_label_py' type: 'Python' bottom: 'label' top: 'extracted_label' python_param { module: 'convert_compose_label' layer: 'ComposeLabelToSingleLabel' param_str: '1' } } layer { name: "loss" type: "SoftmaxWithLoss" bottom: "ip2" bottom: "extracted_label" top: "loss" }
Module convert_compose_label.py:
class ComposeLabelToSingleLabel(caffe.Layer): ... def forward(self, bottom, top): batch_size = bottom[0].data.shape[0] out_file1 = open(self.log_file1, 'a') for i in range(batch_size): out_file1.write("%d\n" % bottom[0].data[i]) # result differs from label values in LMDB at 12 lowest digits single_label = (compose_label.astype(np.int32) >> self.shift) & self.kLabelMask # if not use astype(np.int32) it produces error that >> can not be used with np.float32. top[0].data[i]=single_label # Obviously result is incorrect when self.shift==0 ...

What machine learning model would be best for this use case?
I want generate a list of songs by accessing Youtube that can make a user laugh.
What features could I use and what model would be best? Currently I'm thinking of accessing the user's activity and find all videos that they liked which have a content_id of comedy or music and find those videos' tags. Then use those tags and feed them into a RNN and generate a search keyword to return a list of songs. But there are problems regarding whether or not their history is a good indicator of what they like or not.
Am I heading in the right direction? Would really appreciate some help on what direction to follow.