training data set in FANN - c#

I have a question.
I have a file with training data set. It looks like:
1 6 4 12 5 5 3 4 1 67 3 2 1 2 1 0 0 1 0 0 1 0 0 1 1
2 48 2 60 1 3 2 2 1 22 3 1 1 1 1 0 0 1 0 0 1 0 0 1 2
4 24 2 34 3 5 3 2 3 31 3 1 2 2 1 0 0 1 0 0 1 0 0 1 1
4 9 4 21 1 3 3 4 3 48 3 3 1 2 1 1 0 1 0 0 1 0 0 1 1
I have a neural network with 24 neurons in input layer, 12 neurons in hidden layer and 2 neurons in output layer.
When I start to train a network - an error appears:
The number of input neurons in the ann (24) and data (6) don't match.
But why? How you see there are 24 input data! Can you tell me, why this error is appear? Thx!
I use VS 2015, C#, Win forms;

FANN expects training data to be stored in a very particular format, see here.
The first line in the file is a kind of header, consisting of three space-separated numbers: the number of training records, the number of input neurons and the number of output neurons. Subsequent lines alternate input data and output data, so that each pair of lines constitutes a complete training record.
You have not included the header line, but FANN does not know that - so it is assuming that you have one training record, six input neurons and four output neurons. As the number of input neurons in your ANN does not match what it assumes to be the number of input neurons in your training file it is throwing an error.
It would normally then struggle to read the rest of the file anyway as it is not in the expected format.

Related

how to find digits (in min-max range) and all sequence with equal to sum of digits=one number

Input:
Number of digits in the number
Sum of digits
Range of digits that can be used
Output:
All possible numbers where the sum of digits equals the one defined as an input.
Examples:
(num_digits = 4, sum = 12, range = 0-4)
3 4 4 1
4 4 4 0
4 0 4 4
1 4 4 3
(num_digits = 5, sum = 18, range = 0-7)
5 5 5 2 1
1 2 5 5 5
5 5 2 1 5
0 2 2 7 7
7 7 0 2 2
2 2 7 7 0
(num_digits = 3, sum = 20, range = 0-8)
8 8 4
4 8 8
8 4 8
7 7 6
7 8 5
general method (algorithm) is preferred, however, C# can be a language to chose to resolve
regards
If I were you, I would use recursion, since in 1234 and 1235 sum of 123 is common, so it shouldn't be calculated multiple times.
Your recursive function has two main rules:
The max depth of recursion = number of digits.
The top-level calls the lower level with every possible digit
possible in your case = the range of digits.
Things you need to use in this exercise:
an exit condition for the recursion
loops in a given range
recursive functions
Some type of array/list (be aware that they are copied by memory address and not by value. https://stackoverflow.com/a/4347957/8549369)
This should be enough to write the program, but get used to one thing on StackOverflow: Copy an A-Z solution is not solving an algorithmic task.

RDLC Group not insert Page Break if Table bigger than 1 Page (Data Print/Export)

My problem is only in Tables longer than 1 page, and only when i export/print data (Primarly in PDF format).
I've a report that is structured like below grouped by "Team" (I use "GroupProperties" --> "PageBreak" --> "Between Each Instance Of a Group" to insert the page break):
TeamName: MyTeam
service1 6 50.00
service2 10 30.00
service3 5 20.00
service4 21 90.00
------PAGE BREAK-------
TeamName: MyTeam2
service5 7 250.00
service6 6 500.00
service7 62 750.00
service8 50 1000.00
------PAGE BREAK-------
TeamName: MyTeam3
service9 7 250.00
service10 6 500.00
It works great since the number of the team rows fit 1 page, but if one of the teams has more rows than the number of the rows that the page can handle, the 2nd page miss the page break between the Teams (that it should be inserted by the option "PageBreak - Between Each Instance Of a Group"). Example:
TeamName: MyTeam
service1 6 50.00
service2 10 30.00
service3 5 20.00
service4 21 90.00
------PAGE BREAK-------
TeamName: MyTeam2
service5 7 250.00
service6 6 500.00
service7 62 750.00
service8 50 1000.00
------PAGE BREAK------- (Because i reach the end of the page with the rows of "Team2")
service98 62 750.00
service99 50 1000.00
// NO PAGE BREAK HERE IS TRIGGERED!!!!!
TeamName: MyTeam3
service9 7 250.00
service10 6 500.00
Is a Report limit or i'm missing something?
Thanks,
EDIT:
Using the Flag "Also at the end of a Group" i see nothing changed.
Using the flag "Also at the start of a Group" i go the error:
ScalableList: Index -1 outside the allowed range [0::1]

Adding values on XOR for Checksum

On the internet the rules says for XOR it becomes one if one value is 0 and another is 1. I got that point so:
0 1 1 1 0
0 1 1 0 1
0 0 0 1 1
What I don't get is how come when I add
23
12
31
How did it come up with 31?
What I suspect is the following:
23 is actually 2 followed with 3
12 is actually 1 followed with 2
In binary:
2 3 -> 10 11
1 2 -> 01 10
XOR gives you:
11 01 -> 3 1
Edit:
As suggested in comments, it could also be that you used OR instead of XOR:
10111 // 23
01100 // 12
11111 // 31

How to store a graph in sqlite and vb.net or c#

I have a 2D graph generated with data from a experiment, I want to store all graphs and dat for several experiments
I was thinking about using a table like
id | value | n
--------------------------------------------------------------------------------
1 | {"(0,0)","(125,100)","(200,200)","(297,300)","(4,400)","(5,500)"} | 6
even
id | x | y
------------
1 0 0
1 125 100
1 200 200
1 297 300
1 4 400
1 5 500
but I do not think that is a good aproach, What woul be the best way?
I would suggest this structure:
ExpirementsTable
id | Title | Descirption | .... more info
------------------------------------------------------------------
10 Experiment title some description
20 Experiment title some description
30 Experiment title some description
NodesTable
id| Name | Description | ExperimentID ....
------------------------------------------
1 text more text... 10
2 text more text... 10
3 text more text... 10
TableEdges
id| SourceNode| TargetNode
----------------------------
1 1 2
2 1 3
3 3 2
4 3 1
if you need to store pixel based position for each node then add (x,y) to the Nodes Table...

convert number to combination of letters

I need to convert a number between 1 and 6000000 to a letter combination like ABCDE.
Less letters is better. but i'm guessing i will need 4 or 5.
Can someone point me in the right direction as how to write an algorithm to convert numbers to letters and back? only A-Z. (caps).
You need to convert to base-26 numbering: 0 is A, 1 is B, 25 is Z, 26 is BA, etc.
The Hexavigesimal Wikipedia article has code for conversion to base 26.
There are 26 letters in the alphabet.
TYou have 26^4 < 6 000 000 and 26^5 > 6 000 000
Then you will need 5 letters, for most of your elements
Now you just need to express your number in base 26.
Their is only one way to write an X in 0 ... 6 000 000 as follow:
X = a4*26^4 + a3*26^3+ a2*26^2+ a1*26^1+a0
ai in {0,...25} then you just map ai with a letter from A to Z
The most naive thing to do would be to let A,B,...,Z represent the numbers 0,1,...,25 and the just convert your number to base 26 to get the alphabetic conversion.
For example, there is a C# implementation in this answer to this post.
Well if you want to convert from the decimal representation, then there are 10 digits [0-9] and if you want to have one character per decimal digit in the result, then you will need ten alpha characters. But if you convert from the binary representaion, just replace every 0 with an 'A' and every 1 with a 'B'...
everything depends on how you want to do it... The base you decide to use will determine how many letters you will need.
as an example, to do it from a binary representation,
take the number mod 2. If the result is 0 add an 'A' if its a 1, add a 'B'
Divide the number by 2 (or rightshift it one position.)
repeat until number is zero.
start with value of 57
1. 57 Mod 2 = 1 A
2. 57 / 2 = 28
3. 28 Mod 2 = 0 BA
4. 28 / 2 = 14
5. 14 mod 2 = 0 BBA
6. 14 / 2 = 7
7. 7 mod 2 = 1 ABBA --- A musical group !
8. 7 / 2 = 3
9. 3 mod 2 = 1 AABBA
10. 3/ 2 = 1
11. 1 mod 2 = 1 AAABBA
12. 1 / 2 = 0 --- -done
You should equate A = 0, B = 1 and so on upto Z = 25.
This would become a number system with the base (or radix) 26.
With this in mind, two digits can represent numbers ranging from 0 - 675 (ZZ = 675).
3 Digits would represent 26^3. i.e 0 - 17575.
With 5 digits you can represent from 0 - 11881375 (ZZZZZ).
You can take any standard algorithm that converts between decimal to its own radix to do that.
Conversion between Number bases can be referenced for help.

Categories

Resources