Monday, 1 April 2019

Python Application Programming (15CS664) Module 3 notes PPT and notebook file

please click on specific links


Module 3:

  • T1, Chapter 8: Lists
  • T1, Chapter 9: Dictionaries
  • T1, Chapter 10: Tuples
  • T1, Chapter 11: Regular Expressions
    • notes 
    • ipynb

    Wednesday, 13 February 2019

    Python Application Programming (15CS664) Module 2 notes PPT and notebook file

    please click on specific links


    Module 2:
    • T1, Chapter 5: Iteration
      • notes
      • ipynb
    • T1, Chapter 6: Strings
    • T1, Chapter 7: Files

    Python Application Programming (15CS664) Module 1 notes PPT and notebook file

    please click on specific links

    Module 1:
    • T1, Chapter 1: Why should you learn to write programs
    • T1, Chapter 2: Variables, Expressions and statements
      • notes
      • PPT
      • ipynb
    • T1, Chapter 3: Conditional execution 
      • notes
      • PPT
      • ipynb
    • T1, Chapter 4: Functions 
      • notes
      • PPT
      • ipynb

    Friday, 27 July 2018

    Machine Learning Laboratory (15CSL76): Program 10: Locally Weighted Regression algorithm

    Lab Program 10:

    Implement the non-parametric Locally Weighted Regression algorithm in order to 
     fit data  points. Select appropriate data set for your experiment and draw graphs.



    Machine Learning Laboratory (15CSL76): Program 9: k-Nearest Neighbour algorithm

    Lab Program 9:

    Write a program to implement k-Nearest Neighbour algorithm to classify the iris 
     
    data set. Print both correct and wrong predictions. Java/Python ML library classes can 
     
    be used for this  problem.


    Algorithm:

    Machine Learning Laboratory (15CSL76): Program 8: EM Algorithm / k-Means algorithm

    Lab Program 8:


    Apply EM algorithm to cluster a set of data stored in a .CSV file. Use the same data 
     set for clustering using k-Means algorithm. Compare the results of these two 
     
    algorithms and comment on the quality of clustering. You can add Java/Python ML 
     
    library classes/API in the program.



    Machine Learning Laboratory (15CSL76): Program 7: Bayesian network

    Lab Program 7:


    Write a program to construct a Bayesian network considering medical data. Use this model to  demonstrate the diagnosis of heart patients using standard Heart Disease Data Set. You can use Java/Python ML library classes/API. 




    Machine Learning Laboratory (15CSL76): Program 6: naïve Bayesian Classifier

    Lab Program 6:

    Assuming a set of documents that need to be classified, use the naïve Bayesian 
    Classifier model to perform this task. Built-in Java classes/API can be used to write 
     
    the program. Calculate the accuracy, precision, and recall for your data set. 

    Machine Learning Laboratory (15CSL76): Program 5: naïve Bayesian classifier

    Lab Program 5:

    Write a program to implement the naïve Bayesian classifier for a sample training data set stored as a .CSV file. Compute the accuracy of the classifier, considering few test data sets.



    Algorithm:

    Machine Learning Laboratory (15CSL76): Program 4: Backpropagation Algorithm

    Lab Program 4:

    Build an Artificial Neural Network by implementing the Backpropagation algorithm and test the same using appropriate data sets.






    Algorithm:


    Machine Learning Laboratory (15CSL76): Program 3: Decision Tree based ID3 algorithm

    Lab Program 3:

    Write a program to demonstrate the working of the decision tree based ID3 algorithm. Use an appropriate data set for building the decision tree and apply this knowledge to classify a new  sample.


    Algorithm:

    Machine Learning Laboratory (15CSL76): Program 2: CANDIDATE-ELIMINATION Algorithm

    Lab Program 2:

    For a given set of training data examples stored in a .CSV file, implement  and 
     demonstrate  
    the Candidate-Elimination algorithm to output a description of the set 
     
    of all hypotheses consistent with the training examples.



    Algorithm:



    Click here








































    Original Program Credits: Prof. Thyagaraju Sir

    Machine Learning Laboratory (15CSL76): Program 1: FIND-S Algorithm

    Lab Program 1:

    Implement and demonstrate the FIND-S algorithm for finding the most specific hypothesis  based on a given set of training data samples. Read the training data from a .CSV file.


    Algorithm:

    Click here






















    Original Program Credits: Prof. Thyagaraju Sir

    MACHINE LEARNING LABORATORY (15CSL76)

    MACHINE LEARNING LABORATORY



    NOTE:
    1. The programs can be implemented in either JAVA or Python.
    2. For Problems 1 to 6 and 10, programs are to be developed without using the built-in 
      classes  or APIs of Java/Python.
    3. Data sets can be taken from standard repositories 
      (https://archive.ics.uci.edu/ml/datasets.html) or constructed by the students.

    1. Implement and demonstrate the FIND-S algorithm for finding the most specific hypothesis  based on a given set of training data samples. Read the training data from a .CSV file.
    2. For a given set of training data examples stored in a .CSV file, implement and 
      demonstrate the Candidate-Elimination algorithm to output a description of the set 
      of all hypotheses consistent with the training examples.
    3. Write a program to demonstrate the working of the decision tree based ID3 algorithm. Use an appropriate data set for building the decision tree and apply this knowledge to classify a new  sample.
    4. Build an Artificial Neural Network by implementing the Backpropagation algorithm and test the same using appropriate data sets.
    5. Write a program to implement the naïve Bayesian classifier for a sample training 
      data set stored as a .CSV file. Compute the accuracy of the classifier, considering few 
      test data sets.
    6. Assuming a set of documents that need to be classified, use the naïve Bayesian 
      Classifier model to perform this task. Built-in Java classes/API can be used to write 
      the program. Calculate the accuracy, precision, and recall for your data set. 
    7. Write a program to construct a Bayesian network considering medical data. Use this 
      model to demonstrate the diagnosis of heart patients using standard Heart Disease 
      Data Set. You can use Java/Python ML library classes/API. 
    8. Apply EM algorithm to cluster a set of data stored in a .CSV file. Use the same data 
      set for clustering using k-Means algorithm. Compare the results of these two 
      algorithms and comment on the quality of clustering. You can add Java/Python ML 
      library classes/API in the program.
    9. Write a program to implement k-Nearest Neighbour algorithm to classify the iris 
      data set. Print both correct and wrong predictions. Java/Python ML library classes can 
      be used for this  problem.
    10. Implement the non-parametric Locally Weighted Regression algorithm in order to 
      fit data  points. Select appropriate data set for your experiment and draw graphs.

    MACHINE LEARNING Syllabus (15CS73)

    MACHINE LEARNING Syllabus (15CS73)



    Subject Code: 15CS73                     Semester: 7              Scheme: CBCS

    Text Books:
    1. Tom M. Mitchell, Machine Learning, India Edition 2013, McGraw Hill Education
    Reference Books:
    1. Trevor Hastie, Robert Tibshirani, Jerome Friedman, h The Elements of Statistical Learning, 2nd edition, springer series in statistics.
    2. Ethem Alpaydın, Introduction to machine learning, second edition, MIT press.

    Module – 1: Text Book1, Sections: 1.1 – 1.3, 2.1-2.5, 2.7
    • Introduction: 
      • Well posed learning problems
      • Designing a Learning system
      • Perspective and Issues in Machine Learning.
    • Concept Learning: 
      • Concept learning task 
      • Concept learning as search 
      • Find-S algorithm 
      • Version space
      • Candidate Elimination algorithm 
      • Inductive Bias
    Module – 2: Text Book1, Sections: 3.1-3.7
    • Decision Tree Learning: 
      • Decision tree representation
      • Appropriate problems for decision tree learning
      • Basic decision tree learning algorithm
      • hypothesis space search in decision tree learning 
      • Inductive bias in decision tree learning
      • Issues in decision tree learning
    Module – 3: Text book 1, Sections: 4.1 – 4.6
    • Artificial Neural Networks: 
      • Introduction
      • Neural Network representation
      • Appropriate problems
      • Perceptrons
      • Backpropagation algorithm
    Module – 4: Text book 1, Sections: 6.1 – 6.6, 6.9, 6.11, 6.12
    • Bayesian Learning: 
      • Introduction
      • Bayes theorem 
      • Bayes theorem and concept learning
      • ML and LS error hypothesis
      • ML for predicting probabilities
      • MDL principle
      • Naive Bayes classifier
      • Bayesian belief networks
      • EM algorithm
    Module – 5: Text book 1, Sections: 5.1-5.6, 8.1-8.5, 13.1-13.3
    • Evaluating Hypothesis: 
      • Motivation
      • Estimating hypothesis accuracy
      • Basics of sampling theorem
      • General approach for deriving confidence intervals
      • Difference in error of two hypothesis
      • Comparing learning algorithms
    • Instance Based Learning: 
      • Introduction
      • k-nearest neighbor learning
      • locally weighted regression 
      • radial basis function cased-based reasoning
    • Reinforcement Learning: 
      • Introduction
      • Learning Task 
      • Q Learning

    Tuesday, 6 February 2018

    Python Application Programming: 15CS664 (VTU 6th sem)

    For notes please click on specific links

    For modules 1,2,3,5 refer to this text: click here
    For module 4 refer to this text: click here


    Module 1

    Module 4:
    • T2, Chapter 15: Classes and objects
    • T2, Chapter 16: Classes and functions
    • T2, Chapter 17: Classes and methods
    Module 5: PPT
    credits: Wikipedia, Tutorialpoint

    Friday, 21 April 2017

    Program to check whether string is palindrome or not without using library function

    Program to check whether string is palindrome or not without using library function


    #include<stdio.h>

     void main()
    {
                char s[20];
                int i=0, len, flag = 0;
                printf("\nEnter s1: ");
                gets(s);

                /*To find the length of the string*/
                while(s[i]!='\0')
                {
                            i++;
                }

                len = i;

                for(i=0; i<len/2; i++)
                {
                            if(s[i] != s[len-i-1])
                            {
                                        flag = 1;
                                        break;
                            }
                }

                if(flag == 0)
                            printf("\nString is palindrome.");
                else
                            printf("\nString is not palindrome.");
    }


    Output:
    Enter s1: abcba
    Strings is palindrome.

    Program to check whether string is palindrome or not

    Program to check whether string is palindrome or not


    #include<stdio.h>
    #include<string.h>

    void main()
    {
              char s1[20], s2[20];
              printf("\nEnter s1: ");
              gets(s1);

              /*Copy s1 contents to s2*/
              strcpy(s2, s1);

              /*Reverse s2*/
              strrev(s2);


              /*Compare s1 and s2*/
              if(strcmp(s1, s2) == 0)
                      printf("\nString is palindrome.");
              else
                     printf("\nString is not a palindrome");


    }

    Output:
    case 1:
    Enter s1: abcde
    String is not a palindrome


    case 2:
    Enter s1: abcba
    String is palindrome.

    Program to compare two strings without using library function strcmp

    Program to compare two strings without using library function strcmp

    #include<stdio.h>
    #include<string.h>

    void main()
    {
           int len1, len2, flag = 0, i;
          char s1[20], s2[20];
          printf("\nEnter s1: ");
          gets(s1);
          printf("\nEnter s2: ");
          gets(s2);

          len1 = strlen(s1);
          len2 = strlen(s2);

          if(len1 != len2)
          {
                 flag = 1;
          }
         else
         {
                for(i=0;i<len1;i++)
               { 
                     if(s1[i] != s2[i])
                    {
                           flag = 1;
                           break;
                     }
              }
        }

        if(flag == 0)
            printf("\nStrings are same.");
        else
            printf("\nStrings are different.");
    }

    Output:
    Case 1:

    Enter s1: abcde
    Enter s2: abcdef
    Strings are different.


    Case 2:
    Enter s1: abcde
    Enter s2: abfgh
    Strings are different.

    Case 3:
    Enter s1: abcde
    Enter s2: abcde
    Strings are same.


    Sunday, 16 April 2017

    Program for arithmetic calculator using switch

    Program to demo arithmetic calculator using switch


    #include<stdio.h>
    void main()
    {
                 int a, b;
                 float res;
                 char op;
                 printf("\nEnter a op b :");
                 scanf("%d %c %d", &a, &op, &b);
                 switch(op)
                {
                             case  '+' :       res = a+b;
                                                  break;
                             case  '-' :        res = a-b;
                                                  break;
                             case  '*' :        res = a * b;
                                                  break;
                              case  '/' :        if(!b)
                                                          printf("\n Divide by zero error");
                                                   else
                                                          res = (float)a/b;
                                                   break;
                              case  '%' :      res = a % b;
                                                   break;
                              default:        printf("\nGive valid operator+");
                                                  break;
                }
                printf("\n Result = %f", res);
    }

    Output:

    Enter a op b : 1   /    2
    Result = 0.500000