SlideShare a Scribd company logo
1 of 12
Guided By :Dr Furqan Aziz
Presented By: Islam Ud Islam
Algorithm used : Logistic Regression
Date : May-11-2018
Machine Learning
 clear; close all; clc
 data = load('Data.txt');
 X = data(:, [1, 2]); y = data(:, 3);
 %% ==================== Part 1: Plotting
 fprintf(['Plotting data with + indicating (y = 1) examples
and o ' ...
 'indicating (y = 0) examples.n']);
 plotData(X, y);
 hold on;
 xlabel('Exam 1 score')
 ylabel('Exam 2 score')
 legend('Admitted', 'Not admitted')
 hold off;
 Part 2: Compute Cost and Gradient ============
 % In this part, we will implement the cost and gradient
 [m, n] = size(X);
 % Add intercept term to x and X_test
 X = [ones(m, 1) X];
 % Initialize fitting parameters
 initial_theta = zeros(n + 1, 1);
 % Compute and display initial cost and gradient
 [cost, grad] = costFunction(initial_theta, X, y);
 fprintf('Cost at initial theta (zeros): %fn', cost);
 fprintf('Gradient at initial theta (zeros): n');
 fprintf(' %f n', grad);
 %% ============== Part 4: Predict and Accuracies
==============
 prob = sigmoid([1 45 85] * theta);
 fprintf(['For a student with scores 45 and 85, we
predict an admission ' ...
 'probability of %fnn'], prob);
 t
 p = predict(theta, X);
 function g = sigmoid(z)
 %SIGMOID Compute sigmoid functoon
 % J = SIGMOID(z) computes the sigmoid
of z.
 g = 1 ./ (1 + exp(-z));
 end
 function p = predict(theta, X)
 m = size(X, 1); % Number of training
examples

 p = round(sigmoid(X * theta));

 end
 34.62365962451697,78.0246928153624,0
 I take 100 different sample of data
 function plotData(X, y)
 figure; hold on;
 pos = find(y==1);
 neg = find(y == 0);

 % Plot Examples
 plot(X(pos, 1), X(pos, 2), 'k+',
'LineWidth', 2, 'MarkerSize', 7);
 plot(X(neg, 1), X(neg, 2), 'ko',
'MarkerFaceColor', 'y', 'MarkerSize', 7);
 hold off;
 end
 J = -(1 / m) * sum( (y .* log(h)) + ((1
- y) .* log(1 - h)) );
 for i = 1 : size(theta, 1)
 grad(i) = (1 / m) * sum( (h - y) .* X(:, i) );
 end
 Main Function
Conclusion
Thanks

More Related Content

What's hot

ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1
?? ?
 
Project2
Project2Project2
Project2
?? ?
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 

What's hot (20)

APLICACIÓN DE LAS DERIVADAS EN CONTABILIDAD Y AUDITORÍA
APLICACIÓN DE LAS DERIVADAS EN CONTABILIDAD Y AUDITORÍAAPLICACIÓN DE LAS DERIVADAS EN CONTABILIDAD Y AUDITORÍA
APLICACIÓN DE LAS DERIVADAS EN CONTABILIDAD Y AUDITORÍA
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
Gauss seidal Matlab Code
Gauss seidal Matlab CodeGauss seidal Matlab Code
Gauss seidal Matlab Code
 
What is TensorFlow and why do we use it
What is TensorFlow and why do we use itWhat is TensorFlow and why do we use it
What is TensorFlow and why do we use it
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
Project2
Project2Project2
Project2
 
Arrays
ArraysArrays
Arrays
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
 
Baby Steps to Machine Learning at DevFest Lagos 2019
Baby Steps to Machine Learning at DevFest Lagos 2019Baby Steps to Machine Learning at DevFest Lagos 2019
Baby Steps to Machine Learning at DevFest Lagos 2019
 
Applications of calculus in commerce and economics ii
Applications of calculus in commerce and economics ii Applications of calculus in commerce and economics ii
Applications of calculus in commerce and economics ii
 
Applications of calculus in commerce and economics
Applications of calculus in commerce and economicsApplications of calculus in commerce and economics
Applications of calculus in commerce and economics
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in c
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Computer Graphics Lab
Computer Graphics LabComputer Graphics Lab
Computer Graphics Lab
 

Similar to Exam Prediction Machine Learning Algorithm

YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx
 YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx
YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx
gertrudebellgrove
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
 
Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]
Palak Sanghani
 
PMHMathematicaSample
PMHMathematicaSamplePMHMathematicaSample
PMHMathematicaSample
Peter Hammel
 
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
aartechindia
 

Similar to Exam Prediction Machine Learning Algorithm (20)

Linear Regression (Machine Learning)
Linear Regression (Machine Learning)Linear Regression (Machine Learning)
Linear Regression (Machine Learning)
 
[2019] 하이퍼파라미터 튜닝으로 모델 성능 개선하기
[2019] 하이퍼파라미터 튜닝으로 모델 성능 개선하기[2019] 하이퍼파라미터 튜닝으로 모델 성능 개선하기
[2019] 하이퍼파라미터 튜닝으로 모델 성능 개선하기
 
Recursion in C
Recursion in CRecursion in C
Recursion in C
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programs
 
Matlab Nn Intro
Matlab Nn IntroMatlab Nn Intro
Matlab Nn Intro
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
BCSL 058 solved assignment
BCSL 058 solved assignmentBCSL 058 solved assignment
BCSL 058 solved assignment
 
YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx
 YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx
YOU SHOULD NOT MODIFY ANYTHING IN THIS FILE .docx
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Connection between inverse problems and uncertainty quantification problems
Connection between inverse problems and uncertainty quantification problemsConnection between inverse problems and uncertainty quantification problems
Connection between inverse problems and uncertainty quantification problems
 
Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]
 
Tensor train to solve stochastic PDEs
Tensor train to solve stochastic PDEsTensor train to solve stochastic PDEs
Tensor train to solve stochastic PDEs
 
ML .pptx
ML .pptxML .pptx
ML .pptx
 
PMHMathematicaSample
PMHMathematicaSamplePMHMathematicaSample
PMHMathematicaSample
 
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdfIncorporate the SOR method in the multigridTest-m and apply the multig.pdf
Incorporate the SOR method in the multigridTest-m and apply the multig.pdf
 
support vector regression
support vector regressionsupport vector regression
support vector regression
 
curve fitting or regression analysis-1.pptx
curve fitting or regression analysis-1.pptxcurve fitting or regression analysis-1.pptx
curve fitting or regression analysis-1.pptx
 
array.ppt
array.pptarray.ppt
array.ppt
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
Ch 07 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片
Ch 07 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片Ch 07 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片
Ch 07 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片
 

Recently uploaded

Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Silpa
 
Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
Silpa
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
ANSARKHAN96
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
Silpa
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
Scintica Instrumentation
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
Silpa
 

Recently uploaded (20)

Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.
 
FAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical ScienceFAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical Science
 
Grade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsGrade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its Functions
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditions
 
Chemistry 5th semester paper 1st Notes.pdf
Chemistry 5th semester paper 1st Notes.pdfChemistry 5th semester paper 1st Notes.pdf
Chemistry 5th semester paper 1st Notes.pdf
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptx
 
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLGwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
 
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
 
Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
 
Site Acceptance Test .
Site Acceptance Test                    .Site Acceptance Test                    .
Site Acceptance Test .
 
Role of AI in seed science Predictive modelling and Beyond.pptx
Role of AI in seed science  Predictive modelling and  Beyond.pptxRole of AI in seed science  Predictive modelling and  Beyond.pptx
Role of AI in seed science Predictive modelling and Beyond.pptx
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
 
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate ProfessorThyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
 
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptxPSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
 

Exam Prediction Machine Learning Algorithm

  • 1. Guided By :Dr Furqan Aziz Presented By: Islam Ud Islam Algorithm used : Logistic Regression Date : May-11-2018 Machine Learning
  • 2.  clear; close all; clc  data = load('Data.txt');  X = data(:, [1, 2]); y = data(:, 3);
  • 3.  %% ==================== Part 1: Plotting  fprintf(['Plotting data with + indicating (y = 1) examples and o ' ...  'indicating (y = 0) examples.n']);  plotData(X, y);  hold on;  xlabel('Exam 1 score')  ylabel('Exam 2 score')  legend('Admitted', 'Not admitted')  hold off;
  • 4.  Part 2: Compute Cost and Gradient ============  % In this part, we will implement the cost and gradient  [m, n] = size(X);  % Add intercept term to x and X_test  X = [ones(m, 1) X];  % Initialize fitting parameters  initial_theta = zeros(n + 1, 1);  % Compute and display initial cost and gradient  [cost, grad] = costFunction(initial_theta, X, y);  fprintf('Cost at initial theta (zeros): %fn', cost);  fprintf('Gradient at initial theta (zeros): n');  fprintf(' %f n', grad);
  • 5.  %% ============== Part 4: Predict and Accuracies ==============  prob = sigmoid([1 45 85] * theta);  fprintf(['For a student with scores 45 and 85, we predict an admission ' ...  'probability of %fnn'], prob);  t  p = predict(theta, X);
  • 6.  function g = sigmoid(z)  %SIGMOID Compute sigmoid functoon  % J = SIGMOID(z) computes the sigmoid of z.  g = 1 ./ (1 + exp(-z));  end
  • 7.  function p = predict(theta, X)  m = size(X, 1); % Number of training examples   p = round(sigmoid(X * theta));   end
  • 8.  34.62365962451697,78.0246928153624,0  I take 100 different sample of data
  • 9.  function plotData(X, y)  figure; hold on;  pos = find(y==1);  neg = find(y == 0);   % Plot Examples  plot(X(pos, 1), X(pos, 2), 'k+', 'LineWidth', 2, 'MarkerSize', 7);  plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', 'MarkerSize', 7);  hold off;  end
  • 10.  J = -(1 / m) * sum( (y .* log(h)) + ((1 - y) .* log(1 - h)) );  for i = 1 : size(theta, 1)  grad(i) = (1 / m) * sum( (h - y) .* X(:, i) );  end  Main Function
  • 11.