Saturday, October 13, 2018

Short Overview About Library Use In Neural Network

Context

Python is frequently used for high-performance scientific applications. It is widely used in academia and scientific projects because it is easy to write and performs well.
Due to its high performance nature, scientific computing in Python often utilizes external libraries, typically written in faster languages (like C, or FORTRAN for matrix operations). The main libraries used are NumPy, SciPyand Matplotlib. A comprehensive introduction to the scientific Python ecosystem can be found in the Python Scientific Lecture Notes

Tools

IPython

IPython is an enhanced version of Python interpreter, which provides features of great interest to scientists. The inline modeallows graphics and plots to be displayed in the terminal (Qt based version). Moreover, the notebook mode supports literate programming and reproducible science generating a web-based Python notebook. This notebook allows you to store chunks of Python code along side the results and additional comments (HTML, LaTeX, Markdown). The notebook can then be shared and exported in various file formats.

Libraries

NumPy

NumPy is a low level library written in C (and FORTRAN) for high level mathematical functions. NumPy cleverly overcomes the problem of running slower algorithms on Python by using multidimensional arrays and functions that operate on arrays. Any algorithm can then be expressed as a function on arrays, allowing the algorithms to be run quickly.
NumPy is part of the SciPy project, and is released as a separate library so people who only need the basic requirements can use it without installing the rest of SciPy.
NumPy is compatible with Python versions 2.4 through to 2.7.2 and 3.1+.

Numba

Numba is a NumPy aware Python compiler (just-in-time (JIT) specializing compiler) which compiles annotated Python (and NumPy) code to LLVM (Low Level Virtual Machine) through special decorators. Briefly, Numba uses a system that compiles Python code with LLVM to code which can be natively executed at runtime.

SciPy

SciPy is a library that uses NumPy for more mathematical functions. SciPy uses NumPy arrays as the basic data structure, and comes with modules for various commonly used tasks in scientific programming, including linear algebra, integration (calculus), ordinary differential equation solving and signal processing.

Matplotlib

Matplotlib is a flexible plotting library for creating interactive 2D and 3D plots that can also be saved as manuscript-quality figures. The API in many ways reflects that of MATLAB, easing transition of MATLAB users to Python. Many examples, along with the source code to re-create them, are available in the matplotlib gallery.

Pandas

Pandas is data manipulation library based on Numpy which provides many useful functions for accessing, indexing, merging and grouping data easily. The main data structure (DataFrame) is close to what could be found in the R statistical package; that is, heterogeneous data tables with name indexing, time series operations and auto-alignment of data.

Rpy2

Rpy2 is a Python binding for the R statistical package allowing the execution of R functions from Python and passing data back and forth between the two environments. Rpy2 is the object oriented implementation of the Rpybindings.

PsychoPy

PsychoPy is a library for cognitive scientists allowing the creation of cognitive psychology and neuroscience experiments. The library handles presentation of stimuli, scripting of experimental design and data collection.

Resources

Installation of scientific Python packages can be troublesome, as many of these packages are implemented as Python C extensions which need to be compiled. This section lists various so-called scientific Python distributions which provide precompiled and easy-to-install collections of scientific Python packages.

Unofficial Windows Binaries for Python Extension Packages

Many people who do scientific computing are on Windows, yet many of the scientific computing packages are notoriously difficult to build and install on this platform. Christoph Gohlkehowever, has compiled a list of Windows binaries for many useful Python packages. The list of packages has grown from a mainly scientific Python resource to a more general list. If you’re on Windows, you may want to check it out.

Anaconda

Continuum Analytics offers the Anaconda Python Distribution which includes all the common scientific Python packages as well as many packages related to data analytics and big data. Anaconda itself is free, and Continuum sells a number of proprietary add-ons. Free licenses for the add-ons are available for academics and researchers.

Canopy

Canopy is another scientific Python distribution, produced by Enthought. A limited ‘Canopy Express’ variant is available for free, but Enthought charges for the full distribution. Free licenses are available for academics

Converting A Number To String Format In C Language


Algorithm

1. It is taking input from keyboard .
2. According to size of number , passing to function
3. From their , it is calling recursive to other functions



#include<stdio.h>
void onedigit(int num);
void twodigit(int num);
void threedigit(int num);
void fourdigit(int num);
void fivedigit(int num);
int main()
{
    int number;
    int copy;
    int increment=0;
    printf("Enter a number \n");
    scanf("%d",&number);
    copy=number;
    while(copy!=0)
    {
        increment++;
        copy/=10;
    }

    if(increment<0||increment>999999)
    {
        printf("Please enter positive or less than six digit number");
    }

    else
    {

    if(increment==0)
    printf("zero enter");
    else if(increment==1)
     onedigit(number);
    else if(increment==2)
     twodigit(number);
    else if(increment==3)
    threedigit(number);
    else if(increment==4)
    fourdigit(number);
    else if(increment==5)
    fivedigit(number);
}
}


void onedigit(int number)
{
    switch(number)
    {
        case 1:
            printf("One");break;
            case 2:
                printf("Two");break;
                case 3:
                    printf("Three");break;
                    case 4:
                        printf("Four");break;
                        case 5:
                            printf("Five");break;
                            case 6:
                                printf("Six");break;
                                case 7:
                                    printf("Seven");break;
                                    case 8:
                                        printf("Eight");break;
                                        case 9:
                                            printf("Nine");break;
    }
}

void twodigit(int num)
{

    if(num>10 && num<20)
    {
        switch (num)
            {
                case 11:
                    printf("Eleven");break;
                    case 12:
                        printf("Twelve");break;
                        case 13:
                            printf("Thirteen");break;
                            case 14:
                                printf("Fourteen");break;
                                case 15:
                                    printf("Fifteen");break;
                                    case 16:
                                        printf("Sixteen");break;
                                        case 17:
                                            printf("Seventeen");break;
                                            case 18:
                                                printf("Eighteen");break;
                                                case 19:
                                                    printf("Ninteen");break;

            }
    }
    else
    {

        if(num>=90)
        {
            printf("Ninty ");
        }
        else if(num>=80)
        {
            printf("Eighty ");
        }
            else if(num>=70)
        {
            printf("Seventy ");
        }
            else if(num>=60)
        {
            printf("Sixty ");
        }
            else if(num>=50)
        {
            printf("Fifty ");
        }
            else if(num>=40)
        {
            printf("Fourty ");
        }
            else if(num>=30)
        {
            printf("Thirty ");
        }
            else if(num>=20)
        {
            printf("Twenty ");
        }
            else if (num>=10)
        {
            printf("Ten ");
        }
        onedigit(num%10);
    }
    }


    void threedigit(int num)
    {
        if(num>=900)
        {
            printf("Nine Hundred ");
        }
        else if(num>=800)
        {
            printf("Eight Hundred ");
        }
            else if(num>=700)
        {
            printf("Seven Hundred ");
        }
            else if(num>=600)
        {
            printf("Six Hundred ");
        }
            else if(num>=500)
        {
            printf("Five Hundred ");
        }
            else if(num>=400)
        {
            printf("Four Hundred ");
        }
            else if(num>=300)
        {
            printf("Three Hundred ");
        }
            else if(num>=200)
        {
            printf("Two Hundred ");
        }
            else if (num>=100)
        {
            printf("One Hundred ");
        }
        twodigit(num%100);
    }





void fourdigit(int num)
{

    if(num>=9000)
        {

            printf("Nine Thousand ");
        }
        else if(num>=8000)
        {
            printf("Eight Thousand ");
        }
            else if(num>=7000)
        {
            printf("Seven Thousand ");
        }
            else if(num>=6000)
        {
            printf("Six Thousand ");
        }
            else if(num>=5000)
        {
            printf("Five Thousand ");
        }
            else if(num>=4000)
        {
            printf("Four Thousand ");
        }
            else if(num>=3000)
        {
            printf("Three Thousand ");
        }
            else if(num>=2000)
        {
            printf("Two Thousand ");
        }
            else if (num>=1000)
        {
            printf("One Thousand ");
        }
        threedigit(num%1000);
    }


    void fivedigit(int num)
    {
        int flag=0;
        int copy;

        copy=num;

            if(num>=90000)
        {
            if(num==90000)
            printf("Ninty Thousand ");
            else
            printf("Ninty ");
        }
        else if(num>=80000)
        {
            if(num==80000)
            printf("Eighty Thousand ");
            else
            printf("Eighty ");
        }
            else if(num>=70000)
        {
            if(num==70000)
            printf("Seventy Thousand");
            else
            printf("Seventy ");
        }
            else if(num>=60000)
        {
            if(num==60000)
            printf(" Sixty Thousand");
            else
            printf("Sixty ");
        }
            else if(num>=50000)
        {

            if(num==50000)
            printf(" Fifty Thousand");
            else
            printf("Fifty ");
        }
            else if(num>=40000)
        {

            if(num==40000)
            printf(" Fourty Thousand ");
            else
            printf("Fourty ");
        }
            else if(num>=30000)
        {
            if(num==30000)
            printf("Thirty Thousand");
            else
            printf("Thirty ");
        }
            else if(num>=20000)
        {

            if(num==20000)
            printf(" Twenty Thousand");
            else
            printf("Twenty ");
        }
            else if (num>=10000)
        {

            if(num==10000)
            printf(" Ten Thousand");
            else
            {
                copy=num/1000;
                twodigit(copy);
                printf(" Thousand ");
                flag=1;
                threedigit(num%1000);
            }

        }
    if(flag==0)
        fourdigit(num%10000);
    }

Write A Program in C to Insert , Search , Delete , Traverse Double Linked List

C code to insert , search , delete , traverse in Double Linked List .



#include<stdio.h>
#include<stdlib.h>

struct node
{
  int num;
  struct node *pre,*next;
};
struct node *head=NULL;

void create();
void delete(int);
int search(int);
void traverse();

//this function is for checking whether a list is empty or not
int checklist();

void main()
{
  int choice,item;
  while(1)
  {
  printf("1:Create 2:Delete 3:Search 4:Traverse 5:Exit \n");
  scanf("%d",&choice);
  switch (choice) {
    case /* value */1:  create();break;
    case 2:

    if(checklist()!=0)
    {
      printf("Enter item to be search \n");
      scanf("%d",&item);
      if(search(item)==1)
      delete(item);
    }
    break;

    case 3:

    if(checklist()!=0)
    {
      printf("Enter item to be search \n");
      scanf("%d",&item);
      search(item);
    }
    break;
    case 4: if(checklist()!=0)traverse();break;
    default: exit(4);
  }
}
}

void create()
{
struct node *temp,*trav;

//creating a temporary structure
temp=(struct node*)malloc(sizeof(struct node));

//checking wheter memory is allocated or not
if(temp==NULL)
{
  printf("Memory Allocation Failed \n");
}
else
{
  temp->pre=temp->next=NULL;
  printf("Enter the item to be entered \n");
  scanf("%d",&temp->num);

  if(head==NULL)
  {
    head=temp;
  }
  else
  {
    trav=head;
    while(trav->next!=NULL)
    {
      trav=trav->next;
    }
    trav->next=temp;
    temp->pre=trav;
  }
}

}

int search(int item)
{
struct node *trav;
int flag=0;
trav=head;


while(trav!=NULL)
{
  if(item==trav->num)
  {
    printf("Item is in list \n");
    flag=1;
    break;
  }
  trav=trav->next;
}

if(flag==0)
printf("Item is not in list \n");

printf("\n");
return flag;
}


void delete(int item)
{

//we are using three pointer --> pretrav trav postrav

struct node *trav,*pretrav,*postrav;

//pointing to head
trav=head;

//in deletion we have three cases
// delete first element
//delete mid element
//delete last element

// checking there is only one element , if yes then delete it and made head null
if(head->next==NULL && head->num==item)
{
  head=NULL;
  free(trav);
}

// checking if we need to delete firrst element and list having other elements too
else if(head->num==item&&head->next!=NULL)
{
//then simply moving head to next pointer
head=head->next;
head->pre=NULL;
}
//now below cases handle delete from mid and last
else
{
//now we are using two pointer
  pretrav=trav;
  while(trav!=NULL)
{
  //pretrav pointing to previous element  and trav will point to be deleted elemnt
  pretrav=trav;
  trav=trav->next;


  if(trav->num==item)
  {
    break;
  }
}

//if we need to delete element is last ones

 if(trav->next==NULL)
{
  //we just point previous pretrav next pointer to null and free trav pointer
  pretrav->next=NULL;
  free(trav);
}
else
{
//here we are changing the pointers
postrav=trav->next;
pretrav->next=postrav;
postrav->pre=pretrav;

free(trav);
}
}

  printf("Item deleted =%d\n",item);
  printf("\n");
}


void traverse()
{

struct node *trav;

//pointing to head
trav=head;

//traversing till last element
while(trav!=NULL)
{
  printf("%d ",trav->num);
  trav=trav->next;
}
printf("\n");
}

//below function is telling whether a list is empty or not
int checklist()
{
  if(head==NULL)
  {
  printf("List is empty \n");
  return 0;
  }
  else
  return 1;
}

DST Lab All Questions With Solutions , MTECH 2018


1. C program to convert Integer to String Format 

http://hemchandralive.blogspot.com/2018/10/converting-number-to-string-format-in-c.html

2. Checking whether a enter thing  is Palindrome Or Not Using Stack And  Queue (LinkedList)

https://hemchandralive.blogspot.com/2018/11/checking-of-palindrome-enter-using.html

3. Tower Of Hanoi 

 

C program to insert , delete ,  search , traverse operation in Double Linked List

https://hemchandralive.blogspot.com/2018/10/write-program-in-c-to-insert-search.html

Sunday, October 7, 2018

Neural Networks

What is Neural Network ?Have you wanna a machine who can think like you ?
I am afraid to keep near by such type of machine . So now we will understand the whole neural network concept from Shallow to Deep (Bappi Raju Sir Quote) .



Behavior Recognition System Based on Convolutional Neural Network

Our this article is on this  research paper .  Credit : Bo YU What we will do ? We build a set of human behavior recognition syste...