SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
Write a Matlab script for the function below, that runs the script 5 times and plots a bar graph
and error bar for the average accuracy. Here is the function:
function perceptron_classifier()
% load data data = load('bill_authentication.txt');
% split data into features and labels
X = data(:,1:4); y = data(:,5);
% normalize features
X = normalize(X);
% split data into training and testing sets
[X_train, y_train, X_test, y_test] = split_data(X, y, 0.8);
% train the perceptron classifier
mdl = fitcsvm(X_train, y_train, 'KernelFunction', 'linear', 'Standardize', true);
% predict on the test set
y_pred = predict(mdl, X_test);
% evaluate the model
accuracy = sum(y_pred == y_test)/length(y_test);
fprintf('Accuracy: %.2f%%n', accuracy*100);
end
function [X_train, y_train, X_test, y_test] = split_data(X, y, train_ratio)
% randomly shuffle data idx = randperm(size(X,1)); X = X(idx,:);
y = y(idx);
% split data into training and testing sets
split_idx = floor(size(X,1)*train_ratio);
X_train = X(1:split_idx,:);
y_train = y(1:split_idx);
X_test = X(split_idx+1:end,:);
y_test = y(split_idx+1:end);
end

Contenu connexe

Similaire à Write a Matlab script for the function below, that runs the script 5.pdf

Assignment 6.1.pdf
Assignment 6.1.pdfAssignment 6.1.pdf
Assignment 6.1.pdfdash41
 
Data mining with caret package
Data mining with caret packageData mining with caret package
Data mining with caret packageVivian S. Zhang
 
Competition 1 (blog 1)
Competition 1 (blog 1)Competition 1 (blog 1)
Competition 1 (blog 1)TarunPaparaju
 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Yao Yao
 
Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Max Kleiner
 
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Yao Yao
 
Ai_Project_report
Ai_Project_reportAi_Project_report
Ai_Project_reportRavi Gupta
 
Exam Prediction Machine Learning Algorithm
Exam Prediction Machine Learning Algorithm Exam Prediction Machine Learning Algorithm
Exam Prediction Machine Learning Algorithm Islam uddin
 
isabelle_webinar_jan..
isabelle_webinar_jan..isabelle_webinar_jan..
isabelle_webinar_jan..butest
 
The Basics of MATLAB
The Basics of MATLABThe Basics of MATLAB
The Basics of MATLABMuhammad Alli
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programsElsayed Hemayed
 
Testing in those hard to reach places
Testing in those hard to reach placesTesting in those hard to reach places
Testing in those hard to reach placesdn
 
Workshop - Introduction to Machine Learning with R
Workshop - Introduction to Machine Learning with RWorkshop - Introduction to Machine Learning with R
Workshop - Introduction to Machine Learning with RShirin Elsinghorst
 
Ml2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionMl2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionankit_ppt
 
Training course lect2
Training course lect2Training course lect2
Training course lect2Noor Dhiya
 

Similaire à Write a Matlab script for the function below, that runs the script 5.pdf (20)

Assignment 6.1.pdf
Assignment 6.1.pdfAssignment 6.1.pdf
Assignment 6.1.pdf
 
Data mining with caret package
Data mining with caret packageData mining with caret package
Data mining with caret package
 
Competition 1 (blog 1)
Competition 1 (blog 1)Competition 1 (blog 1)
Competition 1 (blog 1)
 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...
 
BPstudy sklearn 20180925
BPstudy sklearn 20180925BPstudy sklearn 20180925
BPstudy sklearn 20180925
 
Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62Machine Learning Guide maXbox Starter62
Machine Learning Guide maXbox Starter62
 
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
Mini-lab 1: Stochastic Gradient Descent classifier, Optimizing Logistic Regre...
 
Ai_Project_report
Ai_Project_reportAi_Project_report
Ai_Project_report
 
6
66
6
 
Exam Prediction Machine Learning Algorithm
Exam Prediction Machine Learning Algorithm Exam Prediction Machine Learning Algorithm
Exam Prediction Machine Learning Algorithm
 
isabelle_webinar_jan..
isabelle_webinar_jan..isabelle_webinar_jan..
isabelle_webinar_jan..
 
Naïve Bayes.pptx
Naïve Bayes.pptxNaïve Bayes.pptx
Naïve Bayes.pptx
 
The Basics of MATLAB
The Basics of MATLABThe Basics of MATLAB
The Basics of MATLAB
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programs
 
Xgboost
XgboostXgboost
Xgboost
 
Testing in those hard to reach places
Testing in those hard to reach placesTesting in those hard to reach places
Testing in those hard to reach places
 
Workshop - Introduction to Machine Learning with R
Workshop - Introduction to Machine Learning with RWorkshop - Introduction to Machine Learning with R
Workshop - Introduction to Machine Learning with R
 
Ml2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionMl2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regression
 
Training course lect2
Training course lect2Training course lect2
Training course lect2
 
CSL0777-L07.pptx
CSL0777-L07.pptxCSL0777-L07.pptx
CSL0777-L07.pptx
 

Plus de krishahuja1992

Write a small paraghraphFollow on to the Motion Envision an ecolo.pdf
Write a small paraghraphFollow on to the Motion Envision an ecolo.pdfWrite a small paraghraphFollow on to the Motion Envision an ecolo.pdf
Write a small paraghraphFollow on to the Motion Envision an ecolo.pdfkrishahuja1992
 
Write a program to create a binary tree andDisplay Write a program.pdf
Write a program to create a binary tree andDisplay Write a program.pdfWrite a program to create a binary tree andDisplay Write a program.pdf
Write a program to create a binary tree andDisplay Write a program.pdfkrishahuja1992
 
Write as much as you can please in the Mauritian Context. Will give .pdf
Write as much as you can please in the Mauritian Context. Will give .pdfWrite as much as you can please in the Mauritian Context. Will give .pdf
Write as much as you can please in the Mauritian Context. Will give .pdfkrishahuja1992
 
write a PseudocodeCreate a class called Sentence that contains the.pdf
write a PseudocodeCreate a class called Sentence that contains the.pdfwrite a PseudocodeCreate a class called Sentence that contains the.pdf
write a PseudocodeCreate a class called Sentence that contains the.pdfkrishahuja1992
 
Write a Python code to get a digital image and reduces its noise in .pdf
Write a Python code to get a digital image and reduces its noise in .pdfWrite a Python code to get a digital image and reduces its noise in .pdf
Write a Python code to get a digital image and reduces its noise in .pdfkrishahuja1992
 
Write a program in Java that displays a GUI fast food menu with chec.pdf
Write a program in Java that displays a GUI fast food menu with chec.pdfWrite a program in Java that displays a GUI fast food menu with chec.pdf
Write a program in Java that displays a GUI fast food menu with chec.pdfkrishahuja1992
 
Why my ocr is not performing for multi page pdf in javaimport java.pdf
Why my ocr is not performing for multi page pdf in javaimport java.pdfWhy my ocr is not performing for multi page pdf in javaimport java.pdf
Why my ocr is not performing for multi page pdf in javaimport java.pdfkrishahuja1992
 
Why was the bank seized by federal regulatorsWhich of the thr.pdf
Why was the bank seized by federal regulatorsWhich of the thr.pdfWhy was the bank seized by federal regulatorsWhich of the thr.pdf
Why was the bank seized by federal regulatorsWhich of the thr.pdfkrishahuja1992
 
Why is it important for real estate developers to work with various .pdf
Why is it important for real estate developers to work with various .pdfWhy is it important for real estate developers to work with various .pdf
Why is it important for real estate developers to work with various .pdfkrishahuja1992
 
Which statement is NOT trueFailing to reject the null hypothesis .pdf
Which statement is NOT trueFailing to reject the null hypothesis .pdfWhich statement is NOT trueFailing to reject the null hypothesis .pdf
Which statement is NOT trueFailing to reject the null hypothesis .pdfkrishahuja1992
 
will upvote if answer is good 5) Simplify the following Boolean func.pdf
will upvote if answer is good 5) Simplify the following Boolean func.pdfwill upvote if answer is good 5) Simplify the following Boolean func.pdf
will upvote if answer is good 5) Simplify the following Boolean func.pdfkrishahuja1992
 
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdf
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdfWhichofthe folowing si NOT aprinciple of basic financial managemen.pdf
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdfkrishahuja1992
 
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdf
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdfWilla, reci�n graduada de la universidad con poca experiencia relaci.pdf
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdfkrishahuja1992
 
Write a 12 page essay that explains why import and export documents.pdf
Write a 12 page essay that explains why import and export documents.pdfWrite a 12 page essay that explains why import and export documents.pdf
Write a 12 page essay that explains why import and export documents.pdfkrishahuja1992
 
Why the system says cannot find symbol of Calendar though I said imp.pdf
Why the system says cannot find symbol of Calendar though I said imp.pdfWhy the system says cannot find symbol of Calendar though I said imp.pdf
Why the system says cannot find symbol of Calendar though I said imp.pdfkrishahuja1992
 
Why do some populations growWhat factors help to determine the ra.pdf
Why do some populations growWhat factors help to determine the ra.pdfWhy do some populations growWhat factors help to determine the ra.pdf
Why do some populations growWhat factors help to determine the ra.pdfkrishahuja1992
 
Why are intravenous (IV) drug users at greater risk for skin abscess.pdf
Why are intravenous (IV) drug users at greater risk for skin abscess.pdfWhy are intravenous (IV) drug users at greater risk for skin abscess.pdf
Why are intravenous (IV) drug users at greater risk for skin abscess.pdfkrishahuja1992
 
Which statement about Hadoop is correcta) b) c).pdf
Which statement about Hadoop is correcta) b) c).pdfWhich statement about Hadoop is correcta) b) c).pdf
Which statement about Hadoop is correcta) b) c).pdfkrishahuja1992
 
With statistics, we have the data but we do not know the conditions..pdf
With statistics, we have the data but we do not know the conditions..pdfWith statistics, we have the data but we do not know the conditions..pdf
With statistics, we have the data but we do not know the conditions..pdfkrishahuja1992
 
You noted that organic foods are healthier and I found one study tha.pdf
You noted that organic foods are healthier and I found one study tha.pdfYou noted that organic foods are healthier and I found one study tha.pdf
You noted that organic foods are healthier and I found one study tha.pdfkrishahuja1992
 

Plus de krishahuja1992 (20)

Write a small paraghraphFollow on to the Motion Envision an ecolo.pdf
Write a small paraghraphFollow on to the Motion Envision an ecolo.pdfWrite a small paraghraphFollow on to the Motion Envision an ecolo.pdf
Write a small paraghraphFollow on to the Motion Envision an ecolo.pdf
 
Write a program to create a binary tree andDisplay Write a program.pdf
Write a program to create a binary tree andDisplay Write a program.pdfWrite a program to create a binary tree andDisplay Write a program.pdf
Write a program to create a binary tree andDisplay Write a program.pdf
 
Write as much as you can please in the Mauritian Context. Will give .pdf
Write as much as you can please in the Mauritian Context. Will give .pdfWrite as much as you can please in the Mauritian Context. Will give .pdf
Write as much as you can please in the Mauritian Context. Will give .pdf
 
write a PseudocodeCreate a class called Sentence that contains the.pdf
write a PseudocodeCreate a class called Sentence that contains the.pdfwrite a PseudocodeCreate a class called Sentence that contains the.pdf
write a PseudocodeCreate a class called Sentence that contains the.pdf
 
Write a Python code to get a digital image and reduces its noise in .pdf
Write a Python code to get a digital image and reduces its noise in .pdfWrite a Python code to get a digital image and reduces its noise in .pdf
Write a Python code to get a digital image and reduces its noise in .pdf
 
Write a program in Java that displays a GUI fast food menu with chec.pdf
Write a program in Java that displays a GUI fast food menu with chec.pdfWrite a program in Java that displays a GUI fast food menu with chec.pdf
Write a program in Java that displays a GUI fast food menu with chec.pdf
 
Why my ocr is not performing for multi page pdf in javaimport java.pdf
Why my ocr is not performing for multi page pdf in javaimport java.pdfWhy my ocr is not performing for multi page pdf in javaimport java.pdf
Why my ocr is not performing for multi page pdf in javaimport java.pdf
 
Why was the bank seized by federal regulatorsWhich of the thr.pdf
Why was the bank seized by federal regulatorsWhich of the thr.pdfWhy was the bank seized by federal regulatorsWhich of the thr.pdf
Why was the bank seized by federal regulatorsWhich of the thr.pdf
 
Why is it important for real estate developers to work with various .pdf
Why is it important for real estate developers to work with various .pdfWhy is it important for real estate developers to work with various .pdf
Why is it important for real estate developers to work with various .pdf
 
Which statement is NOT trueFailing to reject the null hypothesis .pdf
Which statement is NOT trueFailing to reject the null hypothesis .pdfWhich statement is NOT trueFailing to reject the null hypothesis .pdf
Which statement is NOT trueFailing to reject the null hypothesis .pdf
 
will upvote if answer is good 5) Simplify the following Boolean func.pdf
will upvote if answer is good 5) Simplify the following Boolean func.pdfwill upvote if answer is good 5) Simplify the following Boolean func.pdf
will upvote if answer is good 5) Simplify the following Boolean func.pdf
 
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdf
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdfWhichofthe folowing si NOT aprinciple of basic financial managemen.pdf
Whichofthe folowing si NOT aprinciple of basic financial managemen.pdf
 
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdf
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdfWilla, reci�n graduada de la universidad con poca experiencia relaci.pdf
Willa, reci�n graduada de la universidad con poca experiencia relaci.pdf
 
Write a 12 page essay that explains why import and export documents.pdf
Write a 12 page essay that explains why import and export documents.pdfWrite a 12 page essay that explains why import and export documents.pdf
Write a 12 page essay that explains why import and export documents.pdf
 
Why the system says cannot find symbol of Calendar though I said imp.pdf
Why the system says cannot find symbol of Calendar though I said imp.pdfWhy the system says cannot find symbol of Calendar though I said imp.pdf
Why the system says cannot find symbol of Calendar though I said imp.pdf
 
Why do some populations growWhat factors help to determine the ra.pdf
Why do some populations growWhat factors help to determine the ra.pdfWhy do some populations growWhat factors help to determine the ra.pdf
Why do some populations growWhat factors help to determine the ra.pdf
 
Why are intravenous (IV) drug users at greater risk for skin abscess.pdf
Why are intravenous (IV) drug users at greater risk for skin abscess.pdfWhy are intravenous (IV) drug users at greater risk for skin abscess.pdf
Why are intravenous (IV) drug users at greater risk for skin abscess.pdf
 
Which statement about Hadoop is correcta) b) c).pdf
Which statement about Hadoop is correcta) b) c).pdfWhich statement about Hadoop is correcta) b) c).pdf
Which statement about Hadoop is correcta) b) c).pdf
 
With statistics, we have the data but we do not know the conditions..pdf
With statistics, we have the data but we do not know the conditions..pdfWith statistics, we have the data but we do not know the conditions..pdf
With statistics, we have the data but we do not know the conditions..pdf
 
You noted that organic foods are healthier and I found one study tha.pdf
You noted that organic foods are healthier and I found one study tha.pdfYou noted that organic foods are healthier and I found one study tha.pdf
You noted that organic foods are healthier and I found one study tha.pdf
 

Dernier

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 

Dernier (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 

Write a Matlab script for the function below, that runs the script 5.pdf

  • 1. Write a Matlab script for the function below, that runs the script 5 times and plots a bar graph and error bar for the average accuracy. Here is the function: function perceptron_classifier() % load data data = load('bill_authentication.txt'); % split data into features and labels X = data(:,1:4); y = data(:,5); % normalize features X = normalize(X); % split data into training and testing sets [X_train, y_train, X_test, y_test] = split_data(X, y, 0.8); % train the perceptron classifier mdl = fitcsvm(X_train, y_train, 'KernelFunction', 'linear', 'Standardize', true); % predict on the test set y_pred = predict(mdl, X_test); % evaluate the model accuracy = sum(y_pred == y_test)/length(y_test); fprintf('Accuracy: %.2f%%n', accuracy*100); end function [X_train, y_train, X_test, y_test] = split_data(X, y, train_ratio) % randomly shuffle data idx = randperm(size(X,1)); X = X(idx,:); y = y(idx); % split data into training and testing sets split_idx = floor(size(X,1)*train_ratio); X_train = X(1:split_idx,:); y_train = y(1:split_idx); X_test = X(split_idx+1:end,:); y_test = y(split_idx+1:end); end