Archive for August, 2011

Back Propagation Algorithm

The generalized delta rule  also  known  as back  propagation  algorithm is explained here briefly for feed forward Neural Network (NN). The explanation here is intended to give an outline of  the process involved in back propagation algorithm.

See the figure carefully and try to match with the explanation given below.

 

The NN explained here contains three  layers.  These are input, hidden, and output Layers.  During the training phase, the training data  is fed into to the input layer. The data is propagated  to the hidden  layer  and then  to the output  layer.  This  is called the  forward  pass of  the  back  propagation algorithm.  In  forward  pass, each node in hidden layer gets input from all the nodes from input layer, which are multiplied with appropriate weights  and then summed. The output of  the hidden  node  is  the non-linear  transformation of  the this  resulting sum.  Similarly each node in output  layer gets input from all the nodes from hidden layer, which are multiplied with appropriate weights and  then summed. The output of  this node is  the non-linear  transformation of  the resulting sum.

The output values of  the output layer are compared with the target output  values. The  target  output  values are those  that we attempt to teach our  network.  The error between actual output values and  target output values  is calculated and  propagated back  toward  hidden  layer.  This is called  the backward  pass of  the back  propagation algorithm.  The error  is used  to update  the connection strengths  between nodes,  i.e. weight matrices between input-hidden layers and hidden-output  layers are updated.

During  the  testing  phase, no  learning takes place  i.e.,  weight  matrices are  not changed.  Each  test vector is fed  into the input  layer. The feed forward of  the testing data is similar to the feed forward of  the training data.

Advertisements

,

4 Comments

Windows7/8/8.1 installation from Pendrive

For installing windows7/8/8.1 from pendrive you need a pendrive(4GB or above) and windows 7/8/8.1 installation files.

Follow the instruction below for making Pendrive bootable for installation of windows7/8/8.1:

1. Plug-in your USB drive ( pendrive ).

Open cmd as administrator.

GO to start menu and then  All programs>Accessories, then right click on Command Prompt and select Run as administrator.

2. Then write diskpart and press enter. A message will show. Then type list disk.

if you have one hard disk then two disk will show: Make sure which is your pendrive by seeing the size of the device or any other properties.

i assume your pendrive is disk1.

Now type each bold line and press enter:

select disk 1

clean

create partition primary

select partition 1

active

format fs=ntfs quick

assign

exit

don’t close cmd.

Now insert your windows7/8/8.1 DVD into DVD drive or If you have ISO file in your hard drive extract it to a folder.

let DVD drive letter is D( or let we extract it to D drive) and pendrive letter is H(check your own letter).

Now type the following command>

D: cd boot and press enter.

finally type bootsect.exe /nt60 H: and press enter.

Now copy your windows 7/8/8.1 files from your DVD(or from extracted folder) to pendrive and restart your pc for cheking the pendrive.

Remember you have to change boot device priority from bios and set usb device boot first>from disable to  enable.

this is all.

thanks for reading this post.

, , , ,

Leave a comment

Some of my projects

Touchless writer:

English to Bengali Dictionary:

PC to PC file transfer using socket :

, ,

Leave a comment

Connecting C# windows form application with MSSQL using ADO.NET

When you work with database application it is always need to connect your application with database like MSSQL or ORACLE or any others.
Now i am going to show you how to connect your application with MSSQL express edition using ADO.NET.
At first create a winform project. Then go the View menu and click Server Explorer. Right click on the label named Data Connection and click on Add Connection.

A new window will open. Select Microsoft SQL Server and click continue.

Then another new window will open. Write your server name on the first red rectangle area. Server name will be yourPCname\sqlexpress. Here my pc name is bikashpc. You can get your server name by clicking on the Servers node in Server Explorer window. if there is only one server then there is no confusion.

Then give a name to your database on the second red rectangle area. Here i give my database name bksdata. And then click ok.

Your application is now connected with database. Lets go test it.
Lets create a form like this >>

The task is you will put your friend roll number in the text box and by clicking Show Name button you will get the name of that friend in the name text box. So lets create a table for storing  friends name and roll number.
To create a table go the the Server Explorer and  click on the + at left side of your newly created database. It will expand and many others node will be shown including Tables,Views and so many. Right click on the table and click Add New Table.

Then a new tab will open in which you have to put your column name and data type. Write and save table by right clicking like on the tab like this >>

Here i add two column name and roll and name my table student. Lets put some data manually in the table. To do that click the + node of the lest side of the table. You can see you table here. Right click on your table name and click Show Table Data.

Add some name and roll.

Sometimes you need to change your table definitions:changing column name,adding column, changing data type and so on. To do that again Right click on your table name and click Open Table Definition.

Then modify what you want.
Lets write some program now for showing data into the text box. Double click on the button Show Name. In the code file it will look like this>>

 private void button1_Click(object sender, EventArgs e)
{

}
Add namespace for sqlclient on the top of the code file writing the code below>>

using System.Data.SqlClient;

Now you have to connect your application by writing some code. In the button action write

private void button1_Click(object sender, EventArgs e)
{
string connectionString = @”Data Source=bikashpc\sqlexpress;Initial Catalog=bksdb;     

                                                            Integrated Security=True”;
SqlConnection sqlCon = new SqlConnection(connectionString);

}

Your connection is complete.
Question is how can you get your connection string. Lets find out your Connectionstring. Again right click in your created database and click on the  Properties >>

Properties window will open.

Copy your Data Source and paste it into the red colored portion into connectionString. So you can now go to fetch data form your database. To do that you have to open your your connection by writing
>>sqlCon.Open();
Remember each time you open your connection you have to close it by writing
>>sqlCon.Close();

So lets add some code to your button action.


private void button1_Click(object sender, EventArgs e)
{
string connectionString = @”Data Source=bikashpc\sqlexpress;Initial Catalog=bksdb;    

                                                       Integrated Security=True”;
SqlConnection sqlCon = new SqlConnection(connectionString);

sqlCon.Open();
string commandString = “select name from student where roll='” + textBox1.Text + “‘”;
SqlCommand sqlCmd = new SqlCommand(commandString, sqlCon);
SqlDataReader read = sqlCmd.ExecuteReader();

while (read.Read())
{
textBox2.Text = read[“name”].ToString(); // it will show your friend’s name
}
sqlCon.Close();
}

Colored portion is used to fetch data from you database and show it in the textbox. Run your program and write a roll number in the textbox and then click the Show Name button. Wow!!!! what you see your friend’s name is shown in the name textbox.

This is all to inform you. I think it will help you a lot.

Have fun with C#.

, , , , , , , , ,

Leave a comment

Running a .exe file from windows form application using C#

Running exe file from C# windows form application is very easy.
Let You want to start bks.exe file when you click on the Luanch exe button like below:

Double click on the button. It will appear like below in the code file:

private void button1_Click(object sender, EventArgs e)
{

}

let you have exe fiel name bks.exe in the C drive. then you have to write
System.Diagnostics.Process.Start(@”C:\bks.exe”); in the button actions.

Then the total code will be look like:

private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@”C:\bks.exe”);
}
Run your program and click the Lunch button. Wow!!! you have just created a program which can start another program from your pc.
Have fun with C#.

, ,

3 Comments

some useful commands for new debian users

To check your own pc ip address write:

/sbin/ifconfig

To remove a user and their home directory, use:

sudo deluser -remove-home <user-name>

To remove all of their files on the server:

sudo deluser -remove-all-files <user-name>

Leave a comment

GCD and LCM in CPP

Finding LCM of two numbers:

//CPP code for finding LCM of two numbers
#include<iostream.h>
#include<conio.h>

main()
{
clrscr();
int m, n;
cout<<“Enter first number:”;
cin>>m;
cout<<“Enter second number:”;
cin>>n;

int max;
int lcm=0;

if(m>n)
{
max=m;
}
else
{
max=n;
}

for(int i=max;i<=m*n;i++)
{
if(i%m==0 && i%n==0)
{
lcm=i;
break;
}

}
cout<<“LCM is:”<<lcm;
getch();
}

Finding GCD of two numbers:

//CPP code for finding GCD

#include<iostream.h>
#include<conio.h>

main()
{
clrscr();
int m, n;
cout<<“Enter first number:”;
cin>>m;
cout<<“Enter second number:”;
cin>>n;

int min;
int gcd;

if(m<n)
{
min=m;
}
else
{
min=n;
}

for(int i=1;i<=min;i++)
{
if(m%i==0 && n%i==0)
{
gcd=i;
}
}
cout<<“GCD is: “<<gcd;

cout<<endl;

cout<<“LCM is “<<m*n/gcd;

getch();
}

Leave a comment