Skip to content

Added Perceptron implemented in Dana#82

Merged
kostis merged 3 commits intokostis:masterfrom
nspyrop03:perceptron
Aug 26, 2025
Merged

Added Perceptron implemented in Dana#82
kostis merged 3 commits intokostis:masterfrom
nspyrop03:perceptron

Conversation

@nspyrop03
Copy link
Contributor

Implemented a simple Perceptron in Dana(using fixed-point arithmetic) that can learn OR and AND logical functions. There are four input/results files. One set for the OR operation and the other for the AND operation.

@kostis
Copy link
Owner

kostis commented Aug 25, 2025

Thanks for your contribution. Unfortunately, the test suite's current organization is such that each program has only one input file and corresponding result file. So, I suggest to change this PR to either keep only one of the two sets, or add a loop in the program so that it processes a file containing a number of inputs (two in this case) and produce a result file that contains all the corresponding outputs (again, two in this case) one after the other.

@nspyrop03
Copy link
Contributor Author

Changed the code so it gets one input file and the perceptron first learns the OR operation and then the AND operation.

@kostis
Copy link
Owner

kostis commented Aug 25, 2025

Better, but perhaps it would be even better to have some extra info about the input(s) that will also allow the program to not have hard-coded magic numbers. I am thinking that the input looks something along the lines of:

2
4
0 0 0
0 1 1
1 0 1
1 1 1
4
0 0 0
0 1 0
1 0 0
1 1 1

I.e. there are 2 inputs, the first has 4 examples in the next four lines, the second has another 4 examples in the next four lines, etc. Can you do that change?

Also, please make sure you add an end of line on the last line of all files (look into the "Files changed" tab of this PR to understand what I am taking about.

@kostis
Copy link
Owner

kostis commented Aug 26, 2025

Well done! Merging.

@kostis kostis merged commit 74d4df5 into kostis:master Aug 26, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants