I'm using behaviorspace of netlogo.
I now have a list with items such as: [8.916710216805878 9] [10.458910216805876 20]
I would like to change the output to: [8.916710216805878; 9]; [10.458910216805876; 20]
I want this so I can read it more easily to analyse it.
Related
I want to feed the following example data into a RNN:
[[[100 22 1]
[120 30 0]
[232 11 0]]
[[110 23 1]
[230 32 1]
[500 43 1]]]
So there are 3 features, the first two are numerical with different scales and the third is binary. The size is 2x3x3, (2 examples, with sequence length 3, and 3 features.
I would like to normalize these data. I read that you do not have to normalize binary features. But what about the other two?
Lets say i use the following method:
(x-min(x))/(max(x)-min(x))
a) Should i normalize them in each example independently? So that means calculate min and max for each separate example?
b) Or should i normalize based on the whole dataset?
Which one is the correct way?
I would like to ask a question about matlab transpose symbol. For example in this case:
input=input';
It makes transpose of input but i want to learn why we should use transpose via usin Artificial Neural Network in matlab?
Second Question is:
I am trying to create a classification using ANN in matlab. I showed results like that:
a=sim(neuralnetworkname,test)
test is represens my test data in Neural network.
and the results is like that:
a =
Columns 1 through 12
2.0374 3.9589 3.2162 2.0771 2.0931 3.9947 3.1718 3.9813 2.1528 3.9995 3.8968 3.9808
Columns 13 through 20
3.9996 3.7478 2.1088 3.9932 2.0966 2.0644 2.0377 2.0653
If the result of a is about 2, it would benign, if the result of a is about 4,it is malignant.
So, I want to calculate that :for example,there are 100 benign in 500 data.(100/500) How can i write screen this 100/500
I tried to be clear, but if i didn't clear enough, I can try to explain more.Thanks.
First Question
You don't need to transpose input values everytime. Matlab nntool normally gets input values column by column by default. So you have two choice: 1. Change dataset order 2. Transpose input
Second Question
Suppose you have matrix like this:
a=[1 2 3 4 5 6 7 8 9 0 0 0];
To count how many elements below 8, write this:
sum(a<8) %[1 2 3 4 5 6 7 0 0 0]
Output will be:
10
I want to get the value of C in Matlab to Simulink, I could do it by using C but I want to get it as a code so not dependent on environment values. So how to get the matrix X there from Matlab to Simulink?
If I understand correctly your needs, the best is to define your constants in a file (.m or .mat) and call this file automatically using the InitFcn callback (see doc).
Well if you can input A and B, then it should not be hard to input C.
Try inputting the values with these rules:
[ ] Brackets to open and close
, Comma to seperate elements on one row
; Semicolon to separate two rows
Example
C = [ -1/3 0 0 -1/90 0.0037; 6 7 8 9 10; 11 12 13 14 15]
I am looking for an implementation of k-means that will out where each row of data belongs too.
I have found other links like Matlab:K-means clustering
But they do not help.
So I am looking for something like this. If my data is as follows
1, 2, 4, 5, 6, 7, 8, 9
1, 4, 7, 8, 9, 4, 5, 6
I would like to know that Row 1 Belongs to Cluster A and Row 2 Belongs to Cluster B and so on.
Does anyone know if Matlab can show me that, if so how? If not does anyone have a link to some code that would be able to do that?
Yes, the kmeans command from Statistics Toolbox will do this. Here's an example using the Fisher Iris dataset that is supplied with the toolbox. meas is a 100x4 dataset of four anatomical variables (petal length, petal width, sepal length, sepal width) measured on 150 irises. The output variable, which I've here called clusterIndex, tells you which cluster each row of the dataset falls into, and can be used, for example, as a variable to color points in a plot.
>> load fisheriris
>> k = 3;
>> clusterIndex = kmeans(meas,3);
>> scatter(meas(:,1),meas(:,2),[],clusterIndex,'filled')
if i have a node adjacency each number represent node id
A = [ 3 7;
4 7;
6 9;
3 10;
4 10;
7 10]
how can i get the result which suppose to form a pathway
[3 7 10 4]
[4 7 10 3]
[6 9 0 0]
[3 10 4 7]
[4 10 3 7]
[7 10 4 7]
from matrix A the first row with value 3 will lead to value 7 and from 7 it search the matrix A which lead to last row that connected 7 to the number 10. So from number 10 it can choose either value 3 or 4 as next number. i want the answer have no repeating number in one row but doesnt need to end with highest id number it will end if the next number is a repeated from previous . Hope i made myself clear as im a beginner in matlab. many thanks in advance.
This belongs to the graph theory field. If you don't want to reinvent the wheel, there are several toolboxes that provide algrithms common when dealing with such problems:
Bioinformatics Toolbox from MathWorks
Matgraph
grTheory
MatlabBGL
gaimc
Use breadth-first search (http://en.wikipedia.org/wiki/Breadth-first_search). You can either reject paths which are invalid for your criteria during the search or filter them out afterward.
You should clarify your question further. It is not entirely clear what you are asking for.