Top 10 Aquarium Shark Videos

No title available
Three Goblin Art
taylor price
Misplaced Lens Cap
Show & Tell
One Nice Bug Per Day
I'd rather be in outer space 🛸
No title available

blake kathryn
hello vonnie
Claire Keane

Love Begins
h
wallacepolsom
No title available
Aqua Utopia|海の底で記憶を紡ぐ

roma★
ojovivo
trying on a metaphor
Monterey Bay Aquarium

seen from Netherlands
seen from Indonesia

seen from Türkiye

seen from Poland
seen from United States

seen from France

seen from Canada

seen from El Salvador

seen from Malaysia
seen from United States
seen from Türkiye
seen from France
seen from China

seen from Greece

seen from Malaysia

seen from India
seen from United States
seen from Japan
seen from United States

seen from Türkiye
@aspimind
Top 10 Aquarium Shark Videos
A Jenkins job to push repo contents to an S3 bucket after a merge
Jenkins, one of the most popular open-source CI/CD tools provides you an easy, powerful interface to configure your project workflow. With few clicks and configurations, you are able to create a Jenkins job that could fetch code from Github on various events (PR, Merge, Commit), compile those (build), push or deploy them to any destination entity (S3, Server).
Let's create a simple scenario with a Jenkins job. For that, click on the “New item” in Jenkins to create a new job and then give an appropriate name for the job.
Then select the “Freestyle project” and then click “Ok”.
Then configure your job as follows:
Under general settings, tick the “GitHub project” to indicate that this is a GitHub hosted project and then enter the git project URL without the tree/master or tree/branch part.
Then under Source Code Management Section tick “Git” to tell Jenkins that the version control system of this project is as git. Then give the URL of the remote repository which when you use to git clone.
Here for Branches to build, give the branches that you need to build. Note: if your intention is to do a PR analysis within this job, then give ${ghprbActualCommit} as the branch.
Then under the build triggers section, tick the “GitHub hook trigger for GITScm polling”.
Under the Build section, if you have programs that need to be built (compiled) chose to execute shell category and write the relevant shell commands to build those programs. Note that if your project contains only scripts like shell scripts or SQL scripts you can omit this build section as those are not needed to be compiled or built.
Install S3 Plugin in Jenkins
Go to Dashboard -> Manage Jenkins -> Manage Plugins and select the Available tab. Find “S3 publisher” and install it. After that Go to “Manage Jenkins” -> select “Configure System”, there look for “Amazon S3 Profiles” and click the “Add” button to add an S3 profile.
As shown above, you can either use the IAM Role attached to your Jenkins server (for this create an IAM role who has write/read access to the relevant S3 bucket and attach it to ec2 instance where Jenkins is set up) or use an access key / secret key pair.
Go back to your job configurations -> “Post Build Actions” and add a new post-build action of type “Publish Artifacts to S3 Bucket”.
Sudoers file in Unix
With sudoers users can be granted to run commands as the root user without needing the root password — hence they only need to enter their password, not the root password. So if not done correctly, those misconfigured users or groups at sudoers may be god-like.
When you issue a “sudo” or “su” command, Linux checks a special file called “sudoers” file (Or LDAP) and sees if you are allowed to be granted the root privileges. If your name is not on the list, then no rights. If you don’t have sudo privileges then you may have to manually add your username to the sudoers file. You can find the sudoers file in “/etc/sudoers”.
policy syntax of a sudoers file:
User/Group_name Machine_name = (Effective_user) command
Example 1: tim ALL=(root) ALL
Here the “tim” is the name of the account or the group. And first ALL is for specifying all the machines (the sudoers file can be shared between multiple systems). And (root) is for specifying that “tim” can log in as root user (after issuing tim’s password). Last, ALL is for specifying that after tim logged in as root user, he can issue any of the commands.
Example 2: tim ALL = (root) NOPASSWD: command_a
Here tim can log in as the root user and issue the command “command_a” without needing to type the password. So now when tim run the command: “sudo command_a”, he will not be prompted for the password.
User Aliases And Command Aliases
In sudoers scripts, we can create a User Alias for a set of users. If not we would have to write many policies for each user, where all of them need to have the same scenario. Ex:
User_Alias USR_ALIAS1 = user_1, user_2, user_3, usenr_n USR_ALIAS1 ALL=(root) command_a
In the above example, we have created a user alias called USR_ALIAS1 (which is for all the users user_1, user_2, user_3, usenr_n) and then a policy for all of those users (by just placing the created Alias) to say that they can log in as root and execute the command “command_a”.
Similar to User Aliases, we can create Command Aliases for a set of commands. As before, If we did not have this feature, we would have to write many policies for each command, where all of them need to have the same scenario. Ex:
User_Alias USR_ALIAS1 = user_1, user_2, user_3, usenr_n Cmnd_Alias CMND_ALIAS1= /usr/bin/command_a, /usr/bin/command_b USR_ALIAS1 ALL=(root) NOPASSWD: CMND_ALIAS1
Single Responsibility Principle - S of SOLID
Single Responsibility principle states that any software entity (class, method) should have only one responsible assigned to it. If you are in any doubt on whether should you change a class or a method code, the only thing you need to do is ask the following two questions and if the answer is yes, then you need to change the class code/method code.
Does the class or method do more than one procedure? If so, it is advisable to separate it into two distinct classes/methods, so that each will handle a single responsibility.
Does that logic solely represent or belong only to the relevant class? If not, you should abstract out those methods (logic) and put or implement them in interfaces.
Here in the highlighted section, the method addPagesAndPrint() violates the S of SOLID principles - which is Single Responsibility. As you can see it does two tasks, it updates the number of pages in the book and prints the book's current details. These two tasks should be separated and should be in two different methods as below:
With that separation, we come to the next question which is checking whether are we still violating S of SOLID?. According to the second question, does these addPages() and printBookInfo() methods bound to a Book?, Is it sensible and beneficial to abstract out these two methods and put in a higher-level entity (like in an interface) of the application.
If your application has classes like Articles, Posts, and sort of entities that they also need the ability to add pages, then the method addPages() shouldn’t be within this class. Because then it’s violating S of SOLID. That should be placed in an interface so that all Book, Article and Post classes able to implement.
It is obvious that a printBookInfo() shouldn’t be within this class. Because there have to be many Classes that require the ability to print details of its object.
Mulesoft — an ESB Solution
Enterprise Service Bus (ESB) is a pattern/middleware which allows systems (applications) implemented in incompatible technologies to communicate with each other. Hence an ESB can be thought of as a pluggable backbone where one can plug incompatible applications, and expect them to communicate with each other without any hassle.
Point to Point Integration (P2P)
Point to point integration is integrating systems or applications with each other directly. This is a legacy integration pattern which has many disadvantages and obstacles as listed below:
Single Points Of Failure
No Course Of Action For Emergencies
Exponential Increase in Complexity
Loss of Agility
Enterprise Service Bus Pattern (ESB)
ESB pattern is a more flexible approach for application integration. This integration is achieved by encapsulating and exposing each application functionality as a set of discrete reusable capabilities. Hence applications do not integrate directly with each other instead, they integrate through an ESB infrastructure, as illustrated below:
Anypoint Studio
MuleSoft’s Eclipse-based development environment for designing and testing Mule ESB applications is known as Anypoint Studio. With Anypoint Studio one can develop their message flows between application to application with a graphical drag-and-drop editor (or edit the XML file if preferred). The designer can select all of the different components offered by Mulesoft in their message flows and configure them easily.
Out-of-the-box Components
Anypoint studio has hundreds of built-in components which are needed for integration development:
Message Sources/Endpoints — HTTP, FTP, TCP, UDP, File, Database
Message Processors — Components (REST, SOAP, Java, Python, javascript…), Filters, Routers (aggregators, splitters, round-robin…), Scopes (Flows, sub-flows, for-each, a-synchronous…), Transformers (convert XML, JSON, File, Byte Array, Object, String…)
Connectors — Anypoint studio comes with numerous connectors to third-party applications such as Amazon, Facebook, Google products, Sharepoint, MongoDB, Salesforce...
Dataweave Language
DataWeave is an expression language for accessing and then transform the data that travels through a Mule app.
In a mule message flow, the data being transferred from a component to the next component is called a Message. Hence mostly DW (Dataweave) is used to access and transform data in this Message. For example, after a source component in your flow gets a Message from one system, you can use DW to modify and output selected fields in that Message to a new data format, then use the next component in your flow to pass on that data to another system.
Mulesoft Message Structure
As stated earlier data transferred between components in a mule flow is called Messages. So one component will change/filter the input Message that it receives and export them to the next component so that it’s input Message will be that changed data.
Example 1: Listen to a Post Request from an HTTP Listener, Change the payload structure and save in a MySQL DB.
HTTP Listener Component
Here you should configure the HTTP Listener on what port is this Listener will be listening on and on what path should the caller call to invoke this Mule flow. For example, Listener Configuration would look like below:
So according to the above configuration of HTTP Listener, it would be listening via port 8081 and on path /insert-path .
And above code snippet shows the generated XML code for the configured HTTP Listener. So for every component that we configure in Mulesoft can be edited, created in XML too.
Logger Components
Loggers are used for logging the output message (mostly the payload) from the previous component. This is very helpful when you want to know and debug the output from a component.
Transform Message Component
This is one of the important components in Mulesoft. For all of the message transformations, this component is used mainly. And for doing the transformations, the Dataweave language is used.
DB Insert Component
This component is used to make a connection to the DB and insert the relevant data passed through the mule flow.
Example 2: Listen to a Post Request from an HTTP Listener, Invoke a Java method by passing the received payload, do the necessary changes to the payload from the java method, send the output from java method to another API Endpoint.
Layers & Forward Pass — ANN සිංහලෙන්
Artificial Neural Networks පිළිබද අධ්යයනය සදහා විවිධ articles කියවීමේදී මා විසින් කටුවට සිංහලෙන් තැනින් තැන සටහන් කරගත් notes කීපයක් එකතු කර, තරමක් දුරට පිළිවෙලට සකස් කර මෙලෙස සිංහල articles කීපයක් ලෙස ඉදිරිපත් කරමි. මේ එහි දෙවැනි article එක වේ. මෙහිදී neural networks වල Layers පිළිබදව සහ එහි input දත්ත network එක තුලින් ගලා ගොස් train වීම සිද්ද වන්නේ කෙසේද කියා සාකච්චා කරමි.
What’s Really Happening when Learning Neural network එකක් සාදා, එහි learn වීම යනු එම neural network එකේ ඇති weights (synapses) වල අගයන් හරියට tune කිරීම වේ. උදාහරනයක් ලෙස සරල linear neuronයක් සලකමු.
මෙම තනි neuron එකකින් සැදී තිබෙන Neural network එකේ output එක y වේ. එහි අගය පහත පරිදි ගත හැක.
සාමාන්යයෙන් training කරන phase එකේදී කරන්නේ මෙම ලැබෙන output එක සැබෑවටම ලැබිය යුතු අගය හා සංසන්දනය කර error එක ගණනය කිරීමයි. ඉන් පසු එම error එක අඩු වන පරිදි wi අගයන් tune කිරීමයි learning කරනවා කියන්නේ. එම නිසා හරියට Network එක learn කිරවීමට x1 සිට xn දක්වා inputs වලට inputs දිය හැකි input sets විශාල ප්රමාණයක් තිබිය යුතුයි (එක input set එකක් යනු x1 සිට xn inputs වලට එක් අවස්ථාවකදී දෙන inputs ටික වේ. එලස inputs sets විශාල ප්රමනයක් තිබිය යුතුය.)
Layers Neural Network එකක් යනු නියුරෝන layers කීපයක එකතුවකි. සහ විශේෂම දෙය වන්නේ සෑම නියුරෝනයක්ම ඊලග layer එකේ ඇති සියලු නියුරෝන සමග සම්බන්ද වී පැවතීමයි. මොලයේ ඇති නියුරෝන මෙසේ නැතත්, අපි සාදන neural network එකේ අදාල weights වල අගයන් අනුව එම සම්බන්ද කම් වල ශක්තිමත් භාවය ඉබේ විසදෙනු ඇත network එක train කර අවසාන වන විට. එනම් සමහර weights 0 වනවා යනු එම නියුරෝන දෙක සම්බන්ද වී නැතැයි යන්න ගම්ය වේ.
තවත් වැදගත් දෙයක් වන්නේ neural network එකක layers ප්රමානය ගණනය කරන ආකාරය වේ. Neural network එකක layers විදියට අපි ගණනයට ගන්නේ inputs තිබෙන layers පමණක් වේ. එනම් input layer එක සතුව inputs නොමැති නිසා, එය ගණනයට නොගනී. එම නිසා ඉහත දක්වා ඇති network එක layers 2ක (2 layers) network එකක් වේ.
ඉහත Neural network එකේ input නියුරෝන 3ක්, hidden layer එක සතුව නියුරෝන 2ක් සහ output නියුරෝන 1ක් ඇත. නියුරෝනයකින් outputs කීපයක් තිබෙනවා ලෙස පෙනුනත් එම සෑම output එකක් තුලින් යන්නේ එකම අගය copy වීය.
More layers — more complex නියුරල් network එකක layers ගණන වැඩි කරන විට එහි සංකීර්ණතාවයද වැඩි වේ. එසේම එවිට එම network එකට දත්ත වල තිබෙන සංකීර්ණ රටා සොයා ගත හැක. නමුත් මෙසේ network එකේ සංකීර්ණත්වය තරමට වැඩ වැඩි වුනහොත් එවිට, එම network එක දත්ත වල පවතින noises පවා learn කරීමට පටන් ගනී ( — ඒ ගැන පසුව බලමු). දැන් layers වැඩි කරන විට network එක සංකීර්ණ වන්නේ කෙසේදැයි බලමු. පහත ආකාරයේ එක නියුරෝනයක් පමණක් පවතින network එකක් සලකන්න.
එම නියුරෝනයනේ ගොඩනගන සමීකරණය වන්නේ y = f (w1x1 + w2x2) යන්නයි. එනම් එය linear equation එකක් වේ. Linear equation යනු independent variables වල (මෙහි x1 හා x2) බලය 1ට වඩා වැඩි නොවන ඒවායි. එම නිසා නියුරෝන layer එකක් පමණක් පවතින network එකකින් classify කරනවානම්, එවිට කල හැක්කේ linearly separable data පමණි. එවැනි network එකකින් linear regression ආකාරයට prediction කරනවානම් දැනගත යුතුයි linear equation එකක් තිබෙන්නේ කියා.
ඉහත ආකාරයට තවත් නියුරෝනයක් පළමු නියුරෝනයට සවි කල විට ලැබෙන Y2 ශ්රිතය යනු Y1 ශ්රිතය තවත් වරක් activation function එකකට දමා ලබා ගන්නා එකකි. එවිට Y2 සහ x1, x2 අතර සම්බන්දය linear එකක් නොවන බව තෙරුම් ගන්න. මෙනිසා තවත් layers ඉදිරපත් කරන විට, network එක මගින් generate කරන equation එක high order polynomial ශ්රිතයක් වීමට පටන් ගන්න බව වැටහේ. එනම් එම ගොඩනගන සමිකරණයේ සංකීර්ණත්වය වැඩි වන බවය.
ඉහත විස්තරය අනූව, neural network එකක layers ගැන සිතිය යුත්තේ ශ්රිතයක් තුල තවත් ශ්රිතයක් පරිද්දෙනි බව වැටහ ගන්න. එනම් පළමු layerය තම ඇතුළතින්ම තිබෙන ශ්රිතය ලෙස සහ අවසාන layerය පිටතින්ම පවතින ශ්රිතය ලෙස.
Feed Forward Neural Networks යම් neural network එකක් input එකක් output layer එක දක්වා යවන ක්රියාවලිය forward pass නම් වේ. මෙලස හැසිරෙන neural networks වලට Feedforward networks යැයි කියනු ලැබේ.
උදාහරණ 1: ඉහත දැක්වූ ANN එක sigmoid NN එකක් යැයි සිතමු. එලසම එය සදහා පහත පරිදි dataset එකක් ඇතියි සිතමු.
මේ data set එක සතුව එක data point එකක් පමණයි ඇත්තේ බව තේරුම් ගන්න. Data set එකක ඇත්තේ input neurons වලට දැමිය යුතු අගයන් හා එවිට ලැබිය යුතු සබැ output එකේ අගය වේ. අපගේ Neural network එක සතුව input neuron 3ක් ඇත. එම තුන සදහා දැමිය හැකි value set එකක් පමණයි ඉහත data set එකේ තිබෙන්නේ. සාමන්යයෙන් Neural network එකක් train කරවීම සදහා මෙලස data points විශාල ප්රමානයක් තිබෙන data set එකක් අවශ්යයි. නමුත් ඉහත data point එක neural network එකට feed කර බලමු සැබෑවටම network එකක් ඇතුලේ සිදු වන ක්රියවලිය තේරුම් ගැනීමට.
ප්රථම පියවර: ප්රථමයෙන්ම අපි කරන්නේ hidden layers එකෙහි weights සදහා random weights කීපයක් assign කිරීම සහ එම නියුරෝන දෙක සදහා random bias අගයන් දෙකක් assign කිරීම වේ. ලැබුණු random weights සහ bias අගයන් පහත පරිදි වේ යයි සිතමු.
(මෙහි matrix එකේ පළමු row එකේ අගයන් අදාළ වන්නේ hidden layer එකේ පළමු නියුරෝනයේ weights වලට බව තේරුම් ගන්න)
ඉන්පසුව එලසම output layer එකට අදාළ weights වලටද random weights 2ක් සහ එම output නියුරෝනයට bias value එකක් assign කල යුතුය. ලැබුණු random weights සහ bias අගයන් පහත පරිදි වේ යයි සිතමු:
මෙවිට neural network එකේ තත්වය මෙලස වේ:
දෙවන පියවර: දැන් කරන්නට තියෙන්නේ අපගේ data point එක මෙයට feed කිරීම වේ.
තෙවන පියවර: Hidden layer එකේ ඇති නියුරෝන වල outputs ගණනය කිරීම.
The output of the first (උඩින් ඇති) hidden unit is:
සාමාන්ය යෙන් කරන්නේ යම් layer එකක ඇති සියලුම නියුරෝන වලින් එන output එක එක වර ගණනය කිරීම වේ. එනම් ඉහත පරිදි hidden ලයෙර් එකේ එක් එක් නියුරෝන වල output වෙනම සෙවීම නෙමේ. එසේ එක වර යම් layer එකකින් එන outputs සෙවීම සදහා අපි භාවිතා කරන්නේ matrix multiplication එක වේ. එනම් weights ටික matrix එකක් ලෙස ලියාගෙන සහ inputs ටිකද matrix එකක් ලෙස ලියා ගෙන, එම matrix දෙක ගුණ කිරීම වේ. Hidden layer එකට අදාළ weight matrix එක සහ input matrix එක පහත පරිදි වේ.
Note: wight matrix එකක පළමු column එකේ තියෙන අගයන් අදාළ වන්නේ එම layer එකේ පළමු නියුරෝනයට අදාළ weights වේ. දෙවැනි column එක දෙවැනි නියුරෝනයට අදාළ වේ. එසේ column-wise සිතන්න. මොකද Neural Network වැනි විශයන්වලදී බොහෝ දේවල් represent කරන්නේ column vectors විදියට වේ.
දැන් ඉහතදී කිව්වා weight matrix එක සහ input matrix එක ගුණ කල යුතුයි කියල. නමුත් ඉහත තියෙන විදියට තියාගෙන නිකන්ම ගුණ කල නොහැක. මොකද අදාළ weight අගයන් අදාළ input සමගයි හරියට ගුණ විය යුත්තේ. එම නිසා අපි Weight matrix එක Transpose එක ගෙන එයයි input matrix එක සමග ගුණ කරන්නේ. නැතත් ඉහත තියන විදියට නිකන්ම ගුණ කල නොහැක matrix දෙක. මොකද weight matrix එකේ තියන column ගාන input matrix එකේ තියෙන row ගානට සමාන වෙන්නේ නෑ. So Matrix ආශ්රයෙන් සුළු කරන විට, සමීකරණය වන්නේ පහත පරිදියි.
සිව්වන පියවර: Output නියුරෝනයේ output එක ගණනය කිරීම
පස් වන පියවර: Error එක ගණනය කර එය අඩු කිරීම සදහා පියවර ගැනීම. ඉහතදී අවසාන නියුරෝනයනේ ලැබුනේ අපට අවශ්ය 0.12 යන අගය නෙමේ. එම නිසා දැන් අප කල යුත්තේ කොතරම් දුරට error එකක් තිබෙනවද කියා බලා, error එක අවම වන පරිදි weight අගයන් සැකසීමයි. Error එක ගණනය කිරීම සදහා mean squared error (MSE) සමීකරණය භාවිතා කල හැක.
Backpropagation — ANN සිංහලෙන්
Artificial Neural Networks පිළිබද අධ්යයනය සදහා විවිධ articles කියවීමේදී මා විසින් කටුවට සිංහලෙන් තැනින් තැන සටහන් කරගත් notes කීපයක් එකතු කර, තරමක් දුරට පිළිවෙලට සකස් කර මෙලෙස සිංහල articles කීපයක් ලෙස ඉදිරිපත් කරමි. මේ එහි තුන්වැනි article එක වේ. මෙහිදී neural networks වල මූලිකම learning algorithm එක වන backpropagation algorithm එක පිළිබදව සාකච්චා කරමි.
Multilayer perceptron එකක basic learning algorithm එක වන්නේ backpropagation algorithm එක වේ. Multilayer perceptron ලෙස අපි හදුන්වන්නේ multilayer feed-forward ANN එකකට බව මතකයට ගන්න. අපි මේ වන විට දන්නවා network එකක් train කිරීම යනු එහි weights වලට සුදුසු අගයන් ලබා ගැනීම බව. තවද weights update කිරීම එක බැගින් ගෙන update කර බලා සිදු කරන ක්රියාවක් නොවන බවත් එක වර කල යුතු ක්රියාවලියක් බවත් දැන් ඔබ දන්නවා. Error එක අවම වන පරිදි weights හරි අතට update කරන්නේ කෙසේද යන්න error-backpropagation algorithm එක මගින් පැහැදිලි කරයි.
පහත ඇති Neural Network එක සලකන්න
ඉහත network එකේ පළමු phase එක එනම් weights වලට යම් random අගයන් ටිකක් assign කර, ඉන්පසුව පළමු data point එක x1 හා x2 මගින් input කර forward pass එක සිදු කර output නියුරෝනය මගින් Y4 යන output එක ලැබී ඇතැයි සිතමු. එලසම හරි නම් එම inputs වලට ලැබිය යුතු output එක (desired output එක) d යැයි සිතමු.
එම නිසා error signal එක වන්නේ (e4)
භාවිතා කරන error function එක ලෙස SSE (Sum Of Squared Errors) භාවිතා කරමු. එවිට එය පහත පරිදි ලිවිය හැක.
Note: මෙහි Σe²යනු සියලු output නියුරෝන වලින් ලැබුණු error වල එකතුව යන්නයි. එනම් ඉහත උදාහරණයේ එක් output නියුරෝනයක් පමණක් තිබුනද සමහර විට output නියුරෝන කීපයක් තිබීමට ඉඩ ඇත. එවිට Total error එක ගන්නා ආකාරයයි SSE වැනි function වලින් කියන්නේ.
දැන් අපට අවශ්ය මෙම error එක අඩු වන පරිදි weights සෙවීම වේ. අපි දන්නවා weights සියල්ලම update කරලයි ඊලගට යලි train කිරීම ආරම්භ කල යුත්තේ කියා. එසේ සියලුම weights update කිරීම අපි output පැත්තේ සිට input දෙසට කරගෙන යමු. එහි අදහස වන්නේ, මෙපමණ error එකක් ජනිත වීමට output neurons සමග සම්බන්ද නියුරෝන කොතරම් දයක්ත්වයක් දැක්වූවාද, සහ එම layer එකේ අදාළ නියුරෝන වලින් එපමණ දායකත්වයක් දක්වුවානම්, ඊට කලින් ඒ හා සම්බන්ද නියුරෝන වලින් කොතරම් ප්රමාණයක් error එකට දැක්වූවාද යන්න සොයා ගෙන input neurons දෙසට ගමන් කිරීම වේ.
ප්රථමයෙන් අපි output නියුරෝනය හා සම්බන්ද නියුරෝන වලින් error එකට දැක්වූ දායකත්වය සොයමු. එනම් ඉහත network එකට අනුව නම් n1, n2, n3 neuron වලින් Total error එකට ලැබුණු දායකත්වය (Local error gradient එක) සොයමු. තවත් වැදගත් දෙයක් වන්නේ n1, n2, n3 වලින් output නියුරෝනය හා සම්බන්ද වන ඒවා වල weights වන w41, w42, w43 වෙනස් dimensions නිරුපනය කිරීමයි. එම නිසා එම තුනම variables (විචල්ය) වේ. දැනට අපි w41 වල local gradient එක සොයමු. මේ සදහා අපි කල යුත්තේ E සහ w41 අතර ශ්රිතයක් ගොඩනගා E ව w41 ගෙන් අවකලනය කරීමයි. එලස සම්බන්දයක් ඇති සමිකරන්යක් දැනටමත් ඇත. එය නම් ඉහත දක්වා ඇති E වල සමිකරනයයි. එහි e4 තුල සියලු w41, w42, w43 විචල්යන් ගැබ්ව පවතී. මෙම කාරණය නිසාම (සියලු විචල්ය සමීකරණය තුල ගැබ්ව පවතින නිසා) E, w41 ගෙන් අවකලනය (differenciate) කල නොහැක. E සමිකරන්ය තුල විචල්ය 1කට වඩා පවතින නිසා අපි කල යුත්තේ භාගික අවකලනය (partial derivatives) වේ. එම නිසා පහත පරිද අපිට w41 ගෙන් E partially differentiate කල හැක.
note: ඉහතදී මෙන්ම පහත ඇති steps වලදීද chain rule එක බොහෝ සෙයින් භාවිතා කර ඇත. එනම් ශ්රිතයක් තුල ශ්රිතයක් ඇති අවස්ත්වල, එවැනි දේවල් අවකලනය කිරීමට chain rule එක භාවිතා කල යුතුයි. එනම් f(x) = g (k(x) ) => f’(x) = g`( k(x) ) . k`(x).
e4 යනු (d — y4) නිසා,
d යනු w41ට සාපේක්ෂව නියතයක් නිසා එහි අවකලනය 0ක් වේ.
එසේම y4 යනු (v4)නිසා ( n4 නියුරෝනයට ලැබෙන inputs වල එකතුව sigmoid function එක දැමු පසු ලැබෙන අගය නිසා),
මෙහිදී අපිට පේනවා sigmoid function එක w41 ගෙන් අවකලනය කිරීමට ඇති බව. එම sigmoid function එක තුල w41 අන්තර් ගත වී ඇති නිසා, function එක w41 ගෙන් අවකලනය කල හැක. Backpropagation කිරීමේදී මෙලස activation function එකහි අවකලනය ගැනීමට සිදු වන නිසා තමා පහසුවෙන් අවකලනය කල හැකි සහ, ආකලනය කර ලැබෙන ශ්රිතයහි අගය පහසුවෙන් ගත හැකි activation fucntion එකක් තෝරා ගන්න ලෙස බොහෝ තැන්වල සදහන් වී ඇත්තේ. Sigmoid function එක අවකලනය කල විට ලැබෙන ශ්රිතයහි අගය පහසුවෙන් සෙවිය හැක. ඒ කෙසේද කියා පසුව Gradient Descent Algorithm කොටසේදී පැහැදිලි කරන්නම්.
ඉහත අපි ලබා ගෙන ඇත්තේ w41 වල error gradient එක වේ. එහිදී හොදින් අද්යනය කරන්න අවසානයට ප්රකශනය ගුණ වී ඇත්තේ y1 ගෙන් බව. එනම් y1 යනු w41 ගෙන් ගුණ වී n4 වලට පැමිණෙන පදයයි.
ඉහත ආකාරයටම අපිට w42 වල error gradient එක සෙවිය හැක. එවිට එය පහත පරිදි වේ.
එලසම w43 වල:
තවද,
සදහා ඉහත ප්රකාෂනයම chain rule එකම පහසු ක්රමයකට ගණනය කර ලබා ගත හැකියි. එනම් අපි දන්නවා E යන්න අවකලනය කල හැකි ලගම පදය වන්නේ y බව. එසේම y අවකලනය කල හැක්කේ v (summation function) ගෙන් බව. ඉන්පසුව අපි දන්නවා vව අවශ්ය w අගයෙන් (local gradient එක සෙවිය යුතු) අවකලනය කල හැක. එනම් පහත පරිදියි.
එම නිසා මෙම ක්රමයට කරන එක ලේසියි. මොකද step 3ක වැඩක් පමණක් නිසා. ඉහත පරිදිම මෙම ක්රමය අනුවද w42 , w43 වලට අදාල local gradients ( එම w අගයන් ගෙන් error එකහි අනුක්රමණය) සෙවිය හැක.
මේ අනුව අපිට පේනවා w41, w42, w43 වල සෑම error gradient එකකම ඉහත කොටස තිබෙන බව. w41, w42, w43 යනු n4 වලට අදාළ weigths වේ. එම නිසා ඉහත සංරචකය එම නියුරෝනයේ delta value එක නම් වේ.
So n4 වල delta value එක පහත පරිදි අංකනය කල හැක:
Note- The delta value of an output neuron in a multilayer perceptron, is the minus error times, the first derivative of activation function fed the weighted sum.
එම නිසා දැන් n4 නියුරෝනයට අදාළ weights වල error gradients පහත පරිදි නිරුපනය කල හැක.
Output නියුරෝනයේ bias term එකේ weight gradient එක ගණනය කරීම මෙහිදී විශේෂ දෙයක් කරන්නට නෑ. ඉහත සමීකරණ විදියටමයි එයත් ගණනය කරන්නේ. එනම් පහත පරිදියි.
මෙහි විශේෂත්වය වන්නේ yb වල අගය 1 වීමයි. මොකද කලින් ඒවාවල yi යනු නියුරෝනයකින් ලැබෙන output එක වේ. Bias term එකක value එක 1 වේ. එම නිසා,
Hidden layer නියුරෝන වල delta values
Hidden layer නියුරෝන වල delta අගයන් ගණනයද ඉහත පරිදි chain rule භාවිත කර ලබා ගත හැක. එම hidden layer නියුරෝන වල delta values සදහා පොදු සමීකරණයක් පහත පරිදි ලිවිය හැක.
එනම් i යනු hidden layer නියුරෝනයක් යැයි සිතන්න. මෙයට අදාළ delta value එක වනුයේ එහි v value එක (sum of inputs and bias term if any) භාවිතා කරන activation function එකේ ප්රථම derivative එකට ආදේශ කර ලැබෙන අගයත්, i නියුරෝනය ඊට ඉදිරියේ (output side එකට වන්නට) ඇති layer එක සමග සම්බන්ද වී ඇති නියුරෝන වල weights වලින් ඒවාහි delta අගයන් ගුණ කර ලේබන අගයන්ගේ ඒකතුවත් සමග ගුණතිය වේ.
ඉහත දක්වා ඇති neural network එකේ n1 hidden නියුරෝනයේ delta අගය මේ අනුව පහත පරිදි වේ.
n1 නියුරෝනය සම්බන්ද වන්නේ එක් output නියුරෝනයක් සමග පමණක් නිසා, sigmoid`(vi) අගය ගුණ වන්නේ එම output නියුරෝනයේ delta අගය හා n1 සහ output නියුරෝනයේ weight එක සමගින් පමණි. අපි මොහතකට සිතමු output නියුරෝන දෙකක් n4 සහ n5 ලෙස තිබෙනවා කියා. මෙවිට n1 වල delta අගය පහත පරදී වේ.
So output layer neuron වල delta value එක:
Hidden layer neuron වල delta value එක:
Neurons and Activation Functions — in Sinhala
Artificial Neural Networks පිළිබද අධ්යයනය සදහා විවිධ articles කියවීමේදී මා විසින් කටුවට සිංහලෙන් තැනින් තැන සටහන් කරගත් notes කීපයක් එකතු කර, තරමක් දුරට පිළිවෙලට සකස් කර මෙලෙස සිංහල articles කීපයක් ලෙස ඉදිරිපත් කරමි. මේ එහි පළමු article එක වේ. මෙහිදී ANN පිළිබද මූලික කරනු සාකච්ඡා කිරීමට උත්සාහ කරමි.
Artificial Neural Networks ගැන අධ්යයනය කරීමේදී එය සදහා මුලික වුන සැබෑ ජීව විද්යාත්මක නියුරෝන සහ ඒවා ක්රියා කරන ආකාරය පිළිබද මුලික අවබෝධයක් තිබීම කෘතීම නියුරෝන අවබෝධ කරගැනීම සදහා විශාල උදව්වක් වේ. පහතින් දැක්වෙන්නේ සැබෑ නියුරෝනයක ඇති ප්රධාන සංරචක වේ.
නියුරෝන මොලය සතුව නියුරෝන ආසන්න වශයෙන් 10¹⁰ පමණ ඇති සැලකේ. මේ සෑම නියුරෝනයක් සතුවම dendrite නමින් හැදින්වෙන inputs විශාල ප්රමාණයක් සහ axon ලෙස හැදින්වෙන එක් output එකක් පවතී. එක් නියුරෝනයක axon කොටස සහ තවත් එකක dendrites කොටස සැබෑවටම ස්පර්ශ නොවේ. Axon එකක් සහ dendrites කොටසක් අතර පවතින හිඩැස synapse නම් වේ. මෙම synapse කොටස තොරතුරු හුවමාරුවේදී electrical charges රදවා තබාගෙන ඊලග නියුරෝනයේ dendrites එකට බාර දේ. නියුරෝනයක input එක වන්නේ එයට අදාළ 10³ ත් 10⁴ අතර පවතින dendrites වලින් පැමිණෙන ධාරා(currents) වේ.
Resting Potential and Action Potential නියුරෝනයක් තොරතුරු සම්ප්රේෂණය නොකරන විට එය සිටින්නේ resting potential නම් අවදියේය. තොරතුරු axion එක දිගේ යාමට පටන් ගත් විට එය action potential අවදියට පත් වේ. තවත් වැදගත් කරුණක් වන්නේ නියුරනයක් වටේට ඉතා තුනී membrane (පටලයක්) පවතී. මෙම පටලය හරහා Na+, K+, Cl- වැනි අයන හුවමාරු කරගනියි. Resting potential අවදියේදී මෙම membrane එකෙන් ඇතුලත කොටස, පිටතට සාපේක්ෂව -70mV voltage එකක සිටියි. Dendrites හරහා ධාරා පැමිණෙන විට සහ එය ප්රමාණවත් නම්, නියුරෝනය උත්තේජනය (stimuli) වීමට පටන් ගනියි. මෙසේ වීමෙන් නියුරෝනය -55mV පමණ මට්ටමට පැමිණියහොත් නියුරෝනය action potential එකක් axon එක දිගේ යවයි. ධාරාවල එකතුව ප්රමාණවත් නොවී විභව වෙනස -55mV දක්වා අඩු කිරීමට නොහැකි වූයේනම් axion එක දිගේ ධාරාවක් නොමැත. Axon එකද අවසානයේ අතු කීපයකට බෙදී action potential එක ලෙස පැමිණෙන ධාරාව බෙදා අසල්වැසි නියුරෝන වලට සපයයි. ඉන් පසු නැවත rest අවස්ථාවට පැමිණේ.
Synaptic efficacy ( ගුණත්වය, සඵලත්වය) සෑම synapse එකක්ම එක වගේ නොවේ. සමහර ඒවා දුර්වල අතර සමහර ඒවා හොදින් ක්රියා කරයි. එම නිසා නියුරෝන දෙකක් අතර පවතින synapse එකෙහි තත්වය අනූව කලින් එකෙන් පැමිණෙන action potential එකෙන් කොපමණක් ඊළගට සම්ප්රේෂණය වෙනවද යන්න තීරණය වේ.
Linear Neurons Linear system එකක් යනු inputs සහ outputs අතර සම්බන්දය linear equation (y=mx + c ආකාරයේ) එකක් මගින් පැහැදිලි කල හැකි පද්ධතියකි. ස්වභාව ධරිමයේ පවතින බොහෝ පද්ධති රේඛිය ඒවා නොවන මුත් රේඛීය පද්ධති පිළිබධ අවබෝධය ඒවා තේරුම් ගැනුමට උපකාරී වේ. ඉහත නියුරෝන පිළිබද කල විස්තරය අනුව එය රේඛීය පද්ධතියක් නොවන මුත් රේඛීය මොඩලයක් නිර්මාණය කර එය අධ්යයනය කිරීම වටී.
linear නියුරෝනයක මොඩලයක් පහත පරිදි ඉදිරිපත් කල හැක:
මෙහි සෑම xi input එකක් සදහාම ඊට අදාළ වූ wi weight එක මගින් ගුණ වී නියුරෝනයේ nucleus එක වෙත පැමිණේ. එහිදී සියලු input, weight ගුණිතයන් එකතු වී output එක වන y ලබා දේ. එම නිසා input හා weights වල ශ්රිතයක් ලෙස output එක පහත සමීකරණයෙන් ලබාගත හැක.
Linear නියුරෝන මොඩලයකදී xi යනු වෙනත් නියුරෝනයක සිට පැමිණෙන action potential එකක් ලෙස සිතුව හැක. Weight wi යනු synapse එකක efficacy (ගුණාත්මක බව) ලෙස සිතුව හැක. Wi හි අගය වැඩි වන තරමට xi වලින් output එක සදහා ලැබෙන දායකත්ව වැඩි බව හොදින් අවබෝධ කර ගත යුතු වේ.
නියුරෝනයකින් output එකක් යනවද නැද්ද කියන එක තීරණය වන්නේ 𝚺xiwi වල අගය එම නියුරෝනයහි threshold එක ඉක්මවනවාද නැද්ද යන මතයි. එයද සැලකිල්ලට ගෙන පහත පරිදි ප්රකාශනයක් linear මොඩලයක් සදහා ඉදිරිපත් කල හැක. එහි θ යනු threshold එක වේ.
Neural Networks වලදී Bias යනු කුමක්ද? Bias යන්න තේරුම් ගැනීම සදහා පහසු ක්රමයක් වන්නේ: එය රේඛිය ශ්රිතයක නියතයට සමාන කමක් දක්වයි. එනම් y = mx + c වල c හෝ f(x) = ax + b වල b වැනි දෙයකි.
එමගින් රේඛාවකට දී ඇති data සමග නිවැරදිව fit වීම සදහා උඩට පහලට යාමට හැකියාව ලබා දෙනවා. මෙම b නියතය නැතුව රේඛාවක් (මොඩලය) අනිවාර්යයෙන් මූල ලක්ෂය (0,0) හරහා ගමන් කරයි. මෙය එම මොඩලයට හරිහැටි train වීමට බාධාවකි. එම නිසා අවශ්යනම් ඉහලට පහලට ගොස් train වීම සදහා එලෙස bias variable එකක් දැමීම යෝග්ය වේ.
Activation Functions යම් කිසි node එකක output එක පැහැදිලි කරන function එකක් activation function එකක් වේ. නියුරල් networks සම්බන්දයේදී, activation function එක යනු, නියුරෝනයක action potential එක fire වෙනවාද නැද්ද ලෙස කියන function එක වේ. උදාහරණයක් ලෙස Sigmoid යනු එවැනි ප්රසිද්ධ activation function එකකි. එය ස්වභාවික (මොලයේ සිදු වන) ක්රියාවලිය අනුකරණය කරන එකක් වේ.
Sigmoid function
ANN වලදී sigmoid function එක භාවිතා කරන්නේ activation function එකක් ලෙසයි. එනම් අපි දන්නවා ස්වභාවික නියුරෝනයක් හරහා ධාරාවක් (තොරතුරක්) යනවාද නැද්ද යන්න තීරණය වන්නේ එහි threshold voltage එක ඉක්මවුවොත් පමණයි කියා. Artificial නියුරෝනයක් තුලද අපි මෙම ක්රියාව model කල යුතුයි. ඒ සදහා අපිට විවිධ activation functions භාවිතා කල හැක. ස්වභාවිකව සිදු වන ක්රියාවලියට සමානකමක් දක්වන හා බහුලවම භාවිතා කරන activation function එකක් ලෙස sigmoid function එක හැදින්විය හැක.
Mathematics වල e යනු නියත සංඛ්යාවකි. එහි අගය ආසන්න වශයෙන් 2.71828ක් වේ.
ඕනෑම සංඛ්යාවක 0 වෙනි බලයහි අගය 1 වේ. (උදා: 1000⁰ = 1 වේ).
ඕනෑම සංඛ්යාවක් එහි අනන්ත (∞) වන බලයට නැංවූ විට එහි අගය අනන්තයක් (∞) වේ.
එසේම e^-∞ යනු 1/e^∞ වේ. එනම් 0 වේ.
මේ කරුණු සැලකිල්ලට ගෙන ඉහත S(x) = 1/(1 + e-x) වැනි ශ්රිත ලේසියෙන් x හි අගය +∞ හා -∞ වන විට අගයන් බැලීමෙන් ප්රස්ථාර ගත කල හැක. එමගින් එම ශ්රිතය ගැන අවබෝධයක් ගත හැක.
sigmoid function එක s හැඩයක් ගනී. මෙම වක්රයට සීමිත (නියත) upper හා lower limit දෙකක් පවතී. ඒවා නම් x හි අගය −∞ට ලගා වෙද්දී sigmoid fucntion එක 0ට සිමා වේ. x හි අගය +∞ ට ලගා වන විට function එකහි අගය 1ට සිමා වේ. xහි අගය 0 වන විට sigmoid ශ්රිතයේ අගය 0.5ක් වේ. එම නිසා output එක 0.5ට වඩා වැඩියි නම්, output එක 1 ලෙස (හෝ yes ලෙස) classify කල හැක. එලසම output එක 0.5ට වඩා අඩුයි නම්, output එක 0 ලෙස (හෝ No ලෙස) classify කල හැක. උදාහරණයක් ලෙස output එක 0.65 නම්, අපිට සම්භාවිතාව ආශ්රයෙන් කිව හැකියි “සීයට 65ක chance එකක් තියෙනවා ඔබගේ ප්රියතම foot-ball කණ්ඩායම අද දිනීම සදහා”ලෙස. මේ අයුරින් අවශ්යනම් sigmoid ශ්රිතයක output එක සම්භාවිතාව ආශ්රයෙන්ද ඉදිරිපත් කල හැක.
Artificial Neural එකක සිදුවන ක්රියාවලිය සැකෙවින් ( — TLDR) මොලයේ ඇති සැබෑ නියුරෝන අනුකරනය කරමින් model කරන ලද Artificial Neural එකක සිදු වන ක්රියාවලිය steps දෙකක් ආශ්රයෙන් පැහැදිලි කල හැක. පළමු step එකේදී වෙන්නේ 𝚺xiwi අගය ගණනය කිරීම වේ. ඉන් පසු දෙවැනි step එක ලෙස එම 𝚺xiwi අගය activation function එකකට ඇතුලත් කර output එක ලබා ගැනීම සිදු වේ.
activation function එක ලෙස sigmoid ශ්රිතය යොදා ගත් විට, 𝚺xiwi අගය sigmoid ශ්රිතයේ x ලෙස ආදේශ කරයි. ඉන් පසුව ඒ අනුව ශ්රිතයෙන් ලැබෙන output එක අනුව අපිට තීරණය කල හැකියි එය 1ද (yesද) 0ද (Noද) කියා. එසේ නැතිනම් සම්භාවිතාව අනුව result එකක් ඉදිරපත් කල හැක.
