Simple deep neural network

165 views
Skip to first unread message

Azzeddine Remmal

unread,
Oct 10, 2022, 10:19:10 PM10/10/22
to The Ring Programming Language
Hello Mahmoud
In an attempt to understand what is going on in the background of neural networks I wrote this simple example
he is Consol app Execute with Debuger
ThanksSketch.png
SampNNetwork.ring
CalcMatrix.ring

Mahmoud Fayed

unread,
Oct 11, 2022, 8:55:04 AM10/11/22
to The Ring Programming Language
Hello

Looks like you are doing very interesting work, I will check it :D

It will be nice if you provided a library in the future that provide these common Machine Learning algorithms
(1) Linear Regression
(2) Decision Trees
(3) Neural Networks

Greetings,
Mahmoud

Bert Mariani

unread,
Oct 11, 2022, 9:15:46 AM10/11/22
to The Ring Programming Language
Hello Lemsant

Can you attach  "consolecolors.ring" 
Getting
Line 140 Error (R35) : Can't create/open the file!
In read() In function readdata() in file C:/MyStuff/NeuralNetwork/SampNNetwork.ring
called from line 136  in file C:/MyStuff/NeuralNetwork/SampNNetwork.ring

=================

SampleNNetwork.ring

     load "CalcMatrix.ring"

     load "stdlib.ring"

===================

CalcMatrix.ring

     load "stdlib.ring"

    load "consolecolors.ring"  <<<<<<  Can you attach this file

Ilir

unread,
Oct 11, 2022, 9:25:43 AM10/11/22
to The Ring Programming Language
Hello Bert,

consolecolors is a ring library under extensions/ringconsolecolors, check bin/load if consolecolors.ring "magically" disappeared from your computer.

Greetings,
Ilir 

Mahmoud Fayed

unread,
Oct 11, 2022, 2:18:39 PM10/11/22
to The Ring Programming Language
Hello

>> "Getting Line 140 Error (R35) : Can't create/open the file!"

Me too, I have the same error on my machine

It will be nice to create a GitHub project (including a package for RingPM)
So we can easily install/update the files

Greetings,
Mahmoud

Bert Mariani

unread,
Oct 11, 2022, 2:34:09 PM10/11/22
to The Ring Programming Language
Hello Lemsant

Sorry,
     c:\ring\extensions\ringconsolecolors -- Exits
     c:\ring\bin\load\consolecolors.ring -- Exits

Error seems to come from
Line 136:  ReadData( "network_weight2.txt" )    <<<<<  Can you attach it

Line 139:  func ReadData ( FileName )
Line 140:            aReadData = read( FileName )


Snap4.jpg

Snap3.jpg



Azzeddine Remmal

unread,
Oct 11, 2022, 2:51:56 PM10/11/22
to The Ring Programming Language
Hello Bert
My name is Azzedine
Looks like I forgot to correct the file name because of the many experiments 
in the save function NN.saveWeights()

ReadData( "NetworkWeight.txt" )


Mansour Ayouni

unread,
Oct 11, 2022, 3:37:49 PM10/11/22
to Azzeddine Remmal, The Ring Programming Language
Hello Azzeddine,

Thank you for your interest in doing machine learning in Ring.

This is a domain we need to work on, as a community, because any programming language adoption will depend on its support of it.

Best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ring-lang/a4c2949e-094b-4968-ab2b-93bae83d7281n%40googlegroups.com.

Azzeddine Remmal

unread,
Oct 11, 2022, 4:33:30 PM10/11/22
to The Ring Programming Language
Hello Mansour


Thank you for your interest in doing machine learning in Ring.
Thanks for your kind words

This is a domain we need to work on, as a community, because any programming language adoption will depend on its support of it.
Of course
Teamwork is required
I wanted to bring TensorFlow for the Ring and I want some help

Mansour Ayouni

unread,
Oct 11, 2022, 4:38:56 PM10/11/22
to Azzeddine Remmal, The Ring Programming Language
Hello Azzeddine,

Tensorflow is available in both a C and C++ library.
Porting them to Ring should be possible using the code generator used for porting RingQt.
But one should build this skill and have some experience with it.
I'm planning to dedicate some time to this after finishing the first release of SoftanzaLib.
Best regards,
Mansour

Message has been deleted
Message has been deleted
Message has been deleted

Azzeddine Remmal

unread,
Oct 11, 2022, 5:10:20 PM10/11/22
to The Ring Programming Language
Hello Mansour

Our Special  tasks never ends
Take a look at this file
I have attached the file c_api.h
And tell me, where did I go wrong?
tensorflow.cf
c_api.h

Mansour Ayouni

unread,
Oct 11, 2022, 5:13:45 PM10/11/22
to Azzeddine Remmal, The Ring Programming Language
Hello Azzeddine,

Sorry, I'm not skilled in C nor C++. Mahmoud, Ilir and maybe others would probably help...

Best.
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.

Azzeddine Remmal

unread,
Oct 12, 2022, 2:01:43 AM10/12/22
to The Ring Programming Language
hello 

An artist drew a painting and thought it was the most beautiful. He wanted to challenge everyone with it, so he put it in a public place and wrote the following phrase
Whoever sees a glitch, let him put a red flag over it

He came back in the evening and found it so full of signs here and here that the original painting was obliterated
He went to his teacher and decided to leave the drawing, so the teacher told him that he would only change the phrase and drew the same painting and put it in the same place, but he put colors and a feather and wrote under it the following phrase
Whoever saw a glitch, let him fix it
No one approached her and left her for days, and no one approached her, and here is the essence!
The teacher said to him: Many see the defect in everything, but reformers are rare
We see mistakes, we love criticism, and no one offers solutions

Mansour Ayouni

unread,
Oct 12, 2022, 2:08:02 AM10/12/22
to Azzeddine Remmal, The Ring Programming Language
Hello Azzeddine,

I don't understand your point about telling this story. Please explain how it relates to this discussion...

Best,
Mansour

Azzeddine Remmal

unread,
Oct 12, 2022, 2:21:04 AM10/12/22
to The Ring Programming Language
Good morning Mansour
I don't mean anything from it
  Just having fun waiting for help from the team

Mansour Ayouni

unread,
Oct 12, 2022, 2:25:38 AM10/12/22
to Azzeddine Remmal, The Ring Programming Language
Hello Azzeddine,

I appreciate your clarification. Have a great day.

Best regards,
Mansour

Ilir

unread,
Oct 12, 2022, 11:07:26 AM10/12/22
to The Ring Programming Language
Hello Azzeddine,

I just made a quick look in configuration file because I don't have a time now, but at some point in the future I hope I'll get.

I see problem in int64_t and uint64_t. Ring doesn't have full 64 bit range, uses double having range 2^52, then 2^53 represents multiply of two, 2^54 represents multiply of 4 and everything above represents a loss of precision.

So I think you need to use double instead of int64_t and uint64_t and see how this affects your library. Hopefully, better than worse.

Greetings,
Ilir

Azzeddine Remmal

unread,
Oct 12, 2022, 5:19:00 PM10/12/22
to The Ring Programming Language
Hello mahmoud ilir bert and mansour
Good evening
Thanks, Eller, for the reply
Mahmoud, is it preferable to use the API of Transflow for the language c or is c++ language better


Thanks, 

Mahmoud Fayed

unread,
Oct 12, 2022, 5:29:37 PM10/12/22
to The Ring Programming Language
Hello Azzeddine

>> "is it preferable to use the API of Transflow for the language c or is c++ language better"

It's your choice, Ring provide a C-API while the Ring code generator is used to support both of C & C++ libraries

Study how extensions are developed, Take your time

Then check the extensions that comes with the language
Spend some time to know how they are developed
You will find some useful ideas and tricks

And finally remember that, each one in the group already have many things to do
So in most cases, what we can provide is some tips, hints  & general guidelines

We can't spend too much time in the support, because this will slow the general progress in the development
So we provide (Good Documentation) - Just use it and spend the time in (Reading & Experiments)
All what you need to develop powerful Ring extensions already exist in the (Documentation + the open source extensions that comes with the language)

Keep up the GREAT WORK :D

Greetings,
Mahmoud

Azzeddine Remmal

unread,
Oct 12, 2022, 6:04:57 PM10/12/22
to The Ring Programming Language
Hello mahmoud


Thanks a lot for the tips
I'm learning programming the hard way and I'm scattered between Python, Ring and other languages
I find my comfort in the Ring
But I have to build everything I lack on my own
I'll try to dig into the links above
  My greetings

Mansour Ayouni

unread,
Oct 12, 2022, 6:15:23 PM10/12/22
to Azzeddine Remmal, The Ring Programming Language
Hello Mahmoud,

Thank you for this instructive answer.

This is a fundamental skill in Ring technology that I plan to master, since I have a selection of some C and C++ libraries that are necessary for my projects.

A question please: is the knowledge of C and C++ necessary in this task?

Best regards,
Mansour

Bert Mariani

unread,
Oct 13, 2022, 4:52:56 PM10/13/22
to The Ring Programming Language
Hello Mansour

There are so many languages derived from "C" that it is really worthwhile learning "C".
I would pick an Into to Programming in "C" type book.
It is a concise and precise language

The only language that is more useful to understanding a computer is Assembler.
Assembler is based on the Principles of Operation for that particular computer hardware,
Programmers using high level language are too far removed from a computer's execution of the instruction set        
Too many programmers have no idea what is going on the in the hardware.

Mansour Ayouni

unread,
Oct 13, 2022, 5:08:52 PM10/13/22
to Bert Mariani, The Ring Programming Language
Hello Bert,

Unfortunately, I seem to be one of them, and I'm really enthusiastic to delve into the low level garden, and learn how the C world works.

Yes, I'll grab an introductory book and start from there.

Best,
Mansour

Bert Mariani

unread,
Oct 13, 2022, 6:07:17 PM10/13/22
to The Ring Programming Language
Hi Mansour

The best one to learn from of a handful of C books that I have, is
Programming in C  by Stephen G. Kochan

I have a copy from 1985. It is now up to the 4th edition  2004

This book teaches C by example, with complete C programs used to illustrate each new concept along the way. Stephen Kochan provides step-by-step explanations for all C functions. You will learn both the language fundamentals and good programming practices. Exercises at the end of each chapter make the book ideally suited for classroom use or for self-instruction.


C.jpg


Mansour Ayouni

unread,
Oct 15, 2022, 2:51:30 PM10/15/22
to Bert Mariani, The Ring Programming Language
Reply all
Reply to author
Forward
0 new messages