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 2016b ubuntu 17.04
I'm using Matlab 2016b on Ubuntu 17.04 and parpool won't work on it, but before updating my Ubuntu from 16.04 to 17.04 parpool was working, I also reinstalled Matlab but it doesn't fix, what should I do?

dll Library functions not found in matlab
I have a
dll
library and it's Header file but when I useloadlibrary
on matlab it Returns No functions;[notfound,warnings] = loadlibrary('MDF4Reader.dll','CMdf4Reader.h')
http://www.turbolab.de/mdf_libf.htm (a link for the library I want to import)

Exporting data to Excel and applying a format to it
I want to Export a
1xmCellarray
usingxlswrite
. The Cell Array consists ofm
cells each containing aixnCellarray
wherei
is mostly 2, but can also be 3,4,5 or 6. Here's an example of what the data would look like:a=[{{{'a'},{'b'},{'c'},{'d'};{'a'},{'b'},{'c'},{'d'}}},{{{'a'},{'b'},{'c'},{'d'};{'a'},{'b'},{'c'},{'d'};{'a'},{'b'},{'c'},{'d'}}},{{{'a'},{'b'},{'c'},{'d'};{'a'},{'b'},{'c'},{'d'}}}] a = {2x4 cell} {3x4 cell} {2x4 cell}
I want all the cells to be written underneath each other, but I want to be able to see in Excel which rows belonged to one cell. My idea was to put an empty row between on Array cell and another like this
exportTable=[]; for jj=1:numel(a) exportTable=[exportTable;a{jj};repmat({[]},1,18)]; end
and then exporting the
exportTable
usingxlswrite
, but this Looks pretty ugly in the exported sheet and is not easy to read.
Now I'm looking for a way to get the lines of each cell coloured in the same Colour either directly using the Export function in matlab or using Excel with a vector of the corresponding rows as input.
I could achieve the ending Indexes for each cell usingrows=cumsum(cellfun(@(x) size(x,1),a)) rows = 2 5 7
But I don't know how to colour rows in Excel based on rownumbers.
The desired Output for my example would look like this:
Any help using Matlab or Excel is appreciated.

Keras custom metric iteration
I'm pretty new to Keras and I'm trying to define my own metric. It calculates concordance index which is a measure for regression problems.
def cindex_score(y_true, y_pred): sum = 0 pair = 0 for i in range(1, len(y_true)): for j in range(0, i): if i is not j: if(y_true[i] > y_true[j]): pair +=1 sum += 1* (y_pred[i] > y_pred[j]) + 0.5 * (y_pred[i] == y_pred[j]) if pair is not 0: return sum/pair else: return 0 def baseline_model(hidden_neurons, inputdim): model = Sequential() model.add(Dense(hidden_neurons, input_dim=inputdim, init='normal', activation='relu')) model.add(Dense(hidden_neurons, init='normal', activation='relu')) model.add(Dense(1, init='normal')) #output layer model.compile(loss='mean_squared_error', optimizer='adam', metrics=[cindex_score]) return model def run_model(P_train, Y_train, P_test, model): history = model.fit(numpy.array(P_train), numpy.array(Y_train), batch_size=50, nb_epoch=200) plotLoss(history) return model.predict(P_test)
baseline_model, run_model and cindex_score functions are in one.py and the following function is in two.py where I called the model,
def experiment(): hidden_neurons = 250 dmodel=baseline_model(hidden_neurons, train_pair.shape[1]) predicted_Y = run_model(train_pair,train_Y, test_pair, dmodel)
But I get the following error, "object of type 'Tensor' has no len()". It does not work with shape attribute as well.
For instance, y_true is represented as Tensor("dense_4_target:0", shape=(?, ?), dtype=float32) and its shape is Tensor("strided_slice:0", shape=(), dtype=int32).
Could you please help me about how to iterate within a Tensor object?
Best,

Encog NEAT and RBF networks don't work with certain neuron counts
I've been training some C# Encog neural networks with FF, NEAT and RBF models and I've noticed that with certain neuron and input counts the NEAT and RBF models don't learn at all. The training error just keeps the same from epoch 1 to n. With other input counts I get excellent results and the normalization helper seems to work as expected every time so I don't think the data is flawed.
For example: With 30 columns, with 9 being target, so 29 inputs (all floats), this works:
network = new BasicNetwork(); network.AddLayer(new BasicLayer(new ActivationTANH(), true, data.CalculatedInputSize)); network.AddLayer(new BasicLayer(new ActivationTANH(), true, data.CalculatedInputSize*5)); network.AddLayer(new BasicLayer(new ActivationTANH(), true, data.CalculatedInputSize*3)); network.AddLayer(new BasicLayer(new ActivationTANH(), true, 1));
I then added 10 more columns (ints converted to floats) and it just doesn't learn. FF learns but NEAT and RBF don't. But, if I change it to this, it works:
network = new BasicNetwork(); network.AddLayer(new BasicLayer(new ActivationTANH(), true, data.CalculatedInputSize)); network.AddLayer(new BasicLayer(new ActivationTANH(), true, data.CalculatedInputSize*11)); network.AddLayer(new BasicLayer(new ActivationTANH(), true, data.CalculatedInputSize*2)); network.AddLayer(new BasicLayer(new ActivationTANH(), true, 1));
Then again for example with layers 2 and 3 having counts
CalculatedInputSize*11
anddata.CalculatedInputSize*4
it doesn't work.Can someone explain what is happening? With 29 inputs I haven't had any problems with the arbitrary structures but with more inputs the behavior is erratic.

Fit the Imported Data from file when using MLP approach
I am trying to train the network using MLP approach...but i am having trouble when i am importing data from file.
Getting Error:
Traceback (most recent call last):
File "NNwork.py", line 67, in <module> mlp.fit(X=transformed_input_data.values(),y=transformed_output_data.values()) AttributeError: 'list' object has no attribute 'values'
If i remove values() method still i am getting Unknown label type error..
Here is my code...
Sample Files:
import numpy as np input_data = np.fromfile('power.dat' ,dtype=float) transformed_input_data = [[x] for x in input_data] output_data = np.fromfile('coi.dat',dtype=float) transformed_output_data = [[x] for x in output_data] X = transformed_input_data y = transformed_output_data from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y) from sklearn.preprocessing import StandardScaler scaler = StandardScaler() scaler.fit(X_train) X_train = scaler.transform(X_train) X_test = scaler.transform(X_test) from sklearn.neural_network import MLPClassifier mlp = MLPClassifier(hidden_layer_sizes=(1)) mlp.fit(X=transformed_input_data.values(), y=transformed_output_data.values()) predictions = mlp.predict(X_test) from sklearn.metrics import classification_report,confusion_matrix print(confusion_matrix(y_test,predictions)) print(classification_report(y_test,predictions))
I also want to plot a graph of output and error...how can i plot that? can anyone guide me regarding that also...
Thanks in advance