SlideShare a Scribd company logo
1 of 8
Experiment no. – 9
Student Name: Aditya UID: 19BCS2604
Branch: CSE - 11 Section/Group: ‘C’
Semester:5th
Date of Performance:15 Nov 2021
Subject Name:Artificial intelligence Subject Code: CSP - 303
& Machine learning Lab
1. Aim/Overview of the practical: Import cereal dataset shared by Carnegie Mellon
University (CMU). The details of the dataset are on the following link:
http://lib.stat.cmu.edu/DASL/Datafiles/Cereals.html. The objective is to predict the rating
of the cereals variables such as calories, proteins, fat etc. Test and Train using Neural
Networks.
2. Task to be done: a) Viewing the dataset
b) plotting the neural Network
c) Calculating the result & accuracy
3. Algorithm:
a) Algorithm for Viewing the dataset
Step1: Start
Step2: installing package “MASS”
Step3: import MASS library and then print dataset
Step4: then calculating min , max and scaled dataset by using
function
max = apply(dataset, 2 , max)
min = apply(dataset, 2 , min)
scaled_dataset = as.data.frame(scale(dataset, center =
min,scale = max - min))
Step5: then printing the scaled_dataset
Step6: end
b) Algorithms for plotting the neural Network
Step1: Start
Step2: installing packages “catools”and import the library
Step3: then initialising “neuralnet” and import the library
Step4: then defining the allvars and printing the allvars
Step5: then defining predictorvars by using function
predictorvars=paste(predictorvars,collapse="+");
Step6: printing the predictorvars
Step7: then defining form by using function
form=as.formula(paste("medv~",predictorvars,collapse="+"))
Step8: printing the form
Step9: then defining nm by using function
nn=neuralnet(formula =form,data =training_set,hidden
=c(4,2),threshold=0.01)
Step10:plotting nm
Step11:end
c) Algorithms for Calculating the result & accuracy
Step1: Start
Step2: then defining results by using function
results<- data.frame(actual = test_set$medv, prediction =
nn.results$net.result);
Step3: printing the results
Step4: then calculating predicted by using function
predicted=(results$prediction * (max(dataset$medv) -
min(dataset$medv))) + min(dataset$medv)
Step5: then calculating acutal by using function
actual=(results$actual * (max(dataset$medv) -
min(dataset$medv))) + min(dataset$medv)
Step6: then calculating comparision and deviation co by using
function
comparison=data.frame(predicted,actual)
deviation=((actual-predicted)/actual);
Step7: printing the deviation
Step8: calculating accuracy of dataset by using function
comparison=data.frame(predicted,actual,deviation)
accuracy=1-abs(mean(deviation))
Step9: printing the accuracy
Step10:end
4. Programming Code:
a) Code for Viewing the dataset
install.packages("MASS")
library("MASS")
dataset=Boston;
print(dataset)
View(dataset)
max = apply(dataset, 2 , max)
min = apply(dataset, 2 , min)
scaled_dataset = as.data.frame(scale(dataset, center = min,scale = max - min))
print(scaled_dataset)
b) Code for plotting the neural Network
install.packages("caTools")
library(caTools)
set.seed(123)
sample = sample.split(scaled_dataset$medv, SplitRatio = 0.6)
training_set = subset(scaled_dataset, sample==TRUE)
test_set = subset(scaled_dataset, sample==FALSE)
install.packages("neuralnet")
library(neuralnet)
set.seed(2)
allvars=colnames(dataset);
print(allvars)
predictorvars=allvars[!allvars%in%"medv"];
print(predictorvars)
predictorvars=paste(predictorvars,collapse="+");
print(predictorvars)
form=as.formula(paste("medv~",predictorvars,collapse="+"))
print(form)
nn=neuralnet(formula =form,data =training_set,hidden =c(4,2),threshold=0.01)
plot(nn)
c) Code for Calculating the result & accuracy
nn.results=compute(nn,test_set[,1:13])
results<- data.frame(actual = test_set$medv, prediction = nn.results$net.result);
print(results)
predicted=(results$prediction * (max(dataset$medv) -min(dataset$medv))) +
min(dataset$medv)
actual=(results$actual * (max(dataset$medv) - min(dataset$medv))) +
min(dataset$medv)
comparison=data.frame(predicted,actual)
deviation=((actual-predicted)/actual);
print(deviation)
comparison=data.frame(predicted,actual,deviation)
accuracy=1-abs(mean(deviation))
print(accuracy)
5. Output: a) Output for Viewing the dataset
b) Output for plotting the neural Network
c) Output for Calculating the result & accuracy
6. Learning outcomes (What I have learnt):
1. I have learnt about the R studio.
2. I have learnt about the R programming language.
3. Got to know about Neural Networks.
4. I have learnt how to use library files used to create Neural Networks in R.
5. I have learnt about calculating the Accuracy for a Neural Network.
7. valuation Grid (To be created as per the SOP and Assessment guidelines by the faculty):
Sr. No. Parameters Marks Obtained Maximum Marks
1.
2.
3.

More Related Content

Similar to Artifical_intiligence_worksheet-exp-9.docx

Quick Machine learning projects steps in 5 mins
Quick Machine learning projects steps in 5 minsQuick Machine learning projects steps in 5 mins
Quick Machine learning projects steps in 5 minsNaveen Davis
 
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...Dataconomy Media
 
Training course lect2
Training course lect2Training course lect2
Training course lect2Noor Dhiya
 
20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdf20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdfMariaKhan905189
 
Machine_Learning_Trushita
Machine_Learning_TrushitaMachine_Learning_Trushita
Machine_Learning_TrushitaTrushita Redij
 
Face Recognition Based Intelligent Door Control System
Face Recognition Based Intelligent Door Control SystemFace Recognition Based Intelligent Door Control System
Face Recognition Based Intelligent Door Control Systemijtsrd
 
Implementation of Spam Classifier using Naïve Bayes Algorithm
Implementation of Spam Classifier using Naïve Bayes AlgorithmImplementation of Spam Classifier using Naïve Bayes Algorithm
Implementation of Spam Classifier using Naïve Bayes AlgorithmIRJET Journal
 
Machine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with RMachine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with RIRJET Journal
 
EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...
EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...
EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...csandit
 
Learning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleLearning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleYvonne K. Matos
 
Predicting rainfall using ensemble of ensembles
Predicting rainfall using ensemble of ensemblesPredicting rainfall using ensemble of ensembles
Predicting rainfall using ensemble of ensemblesVarad Meru
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...IJCSES Journal
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...ijcseit
 
AIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdf
AIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdfAIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdf
AIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdfssuserb4d806
 
Data-centric AI and the convergence of data and model engineering: opportunit...
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...Paolo Missier
 
Support Vector Machine–Based Prediction System for a Football Match Result
Support Vector Machine–Based Prediction System for a Football Match ResultSupport Vector Machine–Based Prediction System for a Football Match Result
Support Vector Machine–Based Prediction System for a Football Match Resultiosrjce
 

Similar to Artifical_intiligence_worksheet-exp-9.docx (20)

Quick Machine learning projects steps in 5 mins
Quick Machine learning projects steps in 5 minsQuick Machine learning projects steps in 5 mins
Quick Machine learning projects steps in 5 mins
 
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
 
Training course lect2
Training course lect2Training course lect2
Training course lect2
 
20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdf20MEMECH Part 3- Classification.pdf
20MEMECH Part 3- Classification.pdf
 
Benchmarking_ML_Tools
Benchmarking_ML_ToolsBenchmarking_ML_Tools
Benchmarking_ML_Tools
 
Machine_Learning_Trushita
Machine_Learning_TrushitaMachine_Learning_Trushita
Machine_Learning_Trushita
 
Face Recognition Based Intelligent Door Control System
Face Recognition Based Intelligent Door Control SystemFace Recognition Based Intelligent Door Control System
Face Recognition Based Intelligent Door Control System
 
Implementation of Spam Classifier using Naïve Bayes Algorithm
Implementation of Spam Classifier using Naïve Bayes AlgorithmImplementation of Spam Classifier using Naïve Bayes Algorithm
Implementation of Spam Classifier using Naïve Bayes Algorithm
 
DCSM report2
DCSM report2DCSM report2
DCSM report2
 
Machine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with RMachine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with R
 
EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...
EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...
EFFICIENT USE OF HYBRID ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM COMBINED WITH N...
 
Learning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleLearning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and Kaggle
 
Predicting rainfall using ensemble of ensembles
Predicting rainfall using ensemble of ensemblesPredicting rainfall using ensemble of ensembles
Predicting rainfall using ensemble of ensembles
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
 
Exercises
ExercisesExercises
Exercises
 
AIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdf
AIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdfAIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdf
AIML4 CNN lab 5-1 BreastCancer ML course student report 2022 spring (111-1).pdf
 
Data-centric AI and the convergence of data and model engineering: opportunit...
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
 
D017332126
D017332126D017332126
D017332126
 
Support Vector Machine–Based Prediction System for a Football Match Result
Support Vector Machine–Based Prediction System for a Football Match ResultSupport Vector Machine–Based Prediction System for a Football Match Result
Support Vector Machine–Based Prediction System for a Football Match Result
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 

Artifical_intiligence_worksheet-exp-9.docx

  • 1. Experiment no. – 9 Student Name: Aditya UID: 19BCS2604 Branch: CSE - 11 Section/Group: ‘C’ Semester:5th Date of Performance:15 Nov 2021 Subject Name:Artificial intelligence Subject Code: CSP - 303 & Machine learning Lab 1. Aim/Overview of the practical: Import cereal dataset shared by Carnegie Mellon University (CMU). The details of the dataset are on the following link: http://lib.stat.cmu.edu/DASL/Datafiles/Cereals.html. The objective is to predict the rating of the cereals variables such as calories, proteins, fat etc. Test and Train using Neural Networks. 2. Task to be done: a) Viewing the dataset b) plotting the neural Network c) Calculating the result & accuracy 3. Algorithm: a) Algorithm for Viewing the dataset Step1: Start Step2: installing package “MASS” Step3: import MASS library and then print dataset Step4: then calculating min , max and scaled dataset by using function max = apply(dataset, 2 , max) min = apply(dataset, 2 , min) scaled_dataset = as.data.frame(scale(dataset, center = min,scale = max - min)) Step5: then printing the scaled_dataset Step6: end
  • 2. b) Algorithms for plotting the neural Network Step1: Start Step2: installing packages “catools”and import the library Step3: then initialising “neuralnet” and import the library Step4: then defining the allvars and printing the allvars Step5: then defining predictorvars by using function predictorvars=paste(predictorvars,collapse="+"); Step6: printing the predictorvars Step7: then defining form by using function form=as.formula(paste("medv~",predictorvars,collapse="+")) Step8: printing the form Step9: then defining nm by using function nn=neuralnet(formula =form,data =training_set,hidden =c(4,2),threshold=0.01) Step10:plotting nm Step11:end c) Algorithms for Calculating the result & accuracy Step1: Start Step2: then defining results by using function results<- data.frame(actual = test_set$medv, prediction = nn.results$net.result); Step3: printing the results Step4: then calculating predicted by using function predicted=(results$prediction * (max(dataset$medv) - min(dataset$medv))) + min(dataset$medv) Step5: then calculating acutal by using function actual=(results$actual * (max(dataset$medv) - min(dataset$medv))) + min(dataset$medv) Step6: then calculating comparision and deviation co by using function comparison=data.frame(predicted,actual) deviation=((actual-predicted)/actual); Step7: printing the deviation
  • 3. Step8: calculating accuracy of dataset by using function comparison=data.frame(predicted,actual,deviation) accuracy=1-abs(mean(deviation)) Step9: printing the accuracy Step10:end 4. Programming Code: a) Code for Viewing the dataset install.packages("MASS") library("MASS") dataset=Boston; print(dataset) View(dataset) max = apply(dataset, 2 , max) min = apply(dataset, 2 , min) scaled_dataset = as.data.frame(scale(dataset, center = min,scale = max - min)) print(scaled_dataset) b) Code for plotting the neural Network install.packages("caTools") library(caTools) set.seed(123) sample = sample.split(scaled_dataset$medv, SplitRatio = 0.6) training_set = subset(scaled_dataset, sample==TRUE) test_set = subset(scaled_dataset, sample==FALSE) install.packages("neuralnet") library(neuralnet) set.seed(2) allvars=colnames(dataset); print(allvars) predictorvars=allvars[!allvars%in%"medv"];
  • 4. print(predictorvars) predictorvars=paste(predictorvars,collapse="+"); print(predictorvars) form=as.formula(paste("medv~",predictorvars,collapse="+")) print(form) nn=neuralnet(formula =form,data =training_set,hidden =c(4,2),threshold=0.01) plot(nn) c) Code for Calculating the result & accuracy nn.results=compute(nn,test_set[,1:13]) results<- data.frame(actual = test_set$medv, prediction = nn.results$net.result); print(results) predicted=(results$prediction * (max(dataset$medv) -min(dataset$medv))) + min(dataset$medv) actual=(results$actual * (max(dataset$medv) - min(dataset$medv))) + min(dataset$medv) comparison=data.frame(predicted,actual) deviation=((actual-predicted)/actual); print(deviation) comparison=data.frame(predicted,actual,deviation) accuracy=1-abs(mean(deviation)) print(accuracy)
  • 5. 5. Output: a) Output for Viewing the dataset
  • 6. b) Output for plotting the neural Network
  • 7. c) Output for Calculating the result & accuracy
  • 8. 6. Learning outcomes (What I have learnt): 1. I have learnt about the R studio. 2. I have learnt about the R programming language. 3. Got to know about Neural Networks. 4. I have learnt how to use library files used to create Neural Networks in R. 5. I have learnt about calculating the Accuracy for a Neural Network. 7. valuation Grid (To be created as per the SOP and Assessment guidelines by the faculty): Sr. No. Parameters Marks Obtained Maximum Marks 1. 2. 3.