Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
103 views
Machine Learning Algorithms (Python & R) PDF
Uploaded by
John Faria
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Machine Learning Algorithms (Python & R).pdf For Later
Download
Save
Save Machine Learning Algorithms (Python & R).pdf For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
103 views
Machine Learning Algorithms (Python & R) PDF
Uploaded by
John Faria
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Machine Learning Algorithms (Python & R).pdf For Later
Carousel Previous
Carousel Next
Save
Save Machine Learning Algorithms (Python & R).pdf For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 11
Search
Fullscreen
CHEATSHEET Machine Learning @ Algorithms @ ( Python and R Codes) Types Supervised Learning Unsupervised Learning Reinforcement Learning -Decision Tree -Random Forest -Apriori algorithm - k-means Markov Decision Process ~KNN Logistic Regression - Hierarchical Clustering ~ Q LearningEle = 2 A ra ry ‘4 > Cy [4 Python Code taport Library taport other necessary Libraries Like pandas, run fron sklearn Inport Linear_nodel Load Train and Test datasets Tdentity feature and response variable(s) and values must be numeric and numpy arrays x traininput_variables_values training datasets y-train-target variables values training datasets x test=Lnput variables values test datasets create Linear regression object Linear = Linear_wodel. LinearRegression() Train the model using the training sets and check score Linear-Fit(x train, y_tratn) Linear-score(x_train, y_train) equation coefficient and Intercept print(*Coefficlent: \a", Linear.coef_) print(*Iatercept: \n', Linear. Intercept_) Predict output predicted= Linear.predict(x test) ‘load Train and Test datasets stdentify feature and response varlable(s) and values must be muvee and nunpy arrays a tealn <- input _vartables_values_training datasets yiteain < tanget_vartables_values_tratning datasets test c input variables values test datasets cbind(x_train,y. train) ‘train the model using the training sets and check score Linear <= Im(y_tratn ~ ., stumnary(Qinear) predict output pradicted= predict(inear,x test) data = 0)Python Code ‘iport Library ‘Assured you have, X (predictor) and ¥ (target) ‘for training data set and x test(orecietor) oF test_sotaset (4 rotel FLt(K, ) wotel.score(k, 9) ‘tention coetfictent ané Intercept print(*coctticiant: \n', model.coof_) print(Entercept: \n", nedel intercept) sPredict Output pradictede model.predict(x test) rr i= s cae ro 2 uy oy ‘rm sklearn.Linear_wodel inport Logistictegression © cbind(x trsin,y_train) ‘rain the model using the training sets and check logistic <- gln(y-train = ., data = x,fanily='binoniat) surmary (logistic) predictedn prodict( logistic x test)act} = = 2 ete Python Code ‘more Library import other necessary Libraries Like pandas, nunpy. from sklearn Snport tree ‘ssuned you have, X (predictor) and ¥ (tareet) for training data set and x test (predictor) of Acoeate tree object wodel = tree.Decistontresclassifter(criterione'gint') ‘fon clasesfication, here you can change the algorithm a5 gint or entropy (information gain) by ‘fault St 45 aint rodel = tree.Qectstontredhagrestor() for rain the model using the training Sets and check model. fitix, y) wodel.score(k, 1) predicted nodel.predict(x test) brary(rpart) X& ebind(x train, train) erow tree 41 & rpare(y_train ~ ., data = xnethode"class") summary Fit) trredict output redict( Fie x test)s 2 = 5 A = 5 EF s = 5 A Ey Ei 3B = EA Python Code ‘ingore Library from skleaen snport sym ‘Asse you have, X (predictor) and Y (target) for ‘training data set and x test(predictor) of test dataset screste Su classification object rogel ~ syn.sve() fthere are various options associates vith St, this 15 sinple for classification, ‘train the nodel using the training sets and check rodel.Fit(k ¥) rodel.score(s, ¥) Predict output predieted- nogel.onedict(x test) ‘apart Library Lbrary(e1971) x < cbind(x train,y train) ‘aitting model Fit cosum(y_train ~ ., data =x) suamary Fit) ‘Arecict Output predicteds predict(Fit,x testPETC ty Python Code sapere Library ‘nssunes you have, X (predictor) and ¥ (target) for ‘training data set and x test(predictor) of test dataset jn object node = Gaussiam() ‘here 45 otter distribution for multinomial classes Like Bernoulls Naive Bayes ‘ain the model using the training sets and check scoeate SiN classifi rodel f18(K, y) predictede nodel.predict(x test) ampore Library brary e1e71) x © cbind(x train,y train) srieting nose it Cnatvesayes(y train ~ ., data =x) summary (#42) sPredict Output predicted= pradict(fit,x test)Python Code fron slearn.neiehbors snport KtelghborsClassifier ibrary(knn) XG ehind(x_tratn,y tain) FE Chan(y train ~ ., date = sunnary( fit) weredice output predictede prediet(fit,x test) ‘issuned you have, X (predictor) and ¥ (target) For raining data set and x tost(predicto) of test_cataset ereate Kueighbors cassi¢ier object model el groorsCiassifier(anedghtarse6) roael F880, 9) ‘sPredict tut predicted nadel.pradict(x test) A 3 k= c= 3 2 4 5 Fy Fs = 7 2 =Python Code suport Laseary ‘rom sklearncluster taport means assumed you have, X (attributes) for training cata ‘and x test(attriutes) of test_cataset create meigneors classifler object node eons = means(n_cius ‘Train te model using the training sets and check score ode £20(0) predictede noel. greater x test) nbrary(cluster) Fat < bneans(t, 3)EUs Python Code tngart Lieacy kssuned you have, X (predictor) and ¥ (target) for ‘trsining data set and x test (predictor) of test nodel= Randotorestclassifier() ‘rein the node using the tring sets and check score motel #5806, 9) recictede model. predict (x test) typort Uibeary Library (randonForest) x <= ebind(x train,y_tratn) Fitting model #18 < randonForest(spectes ~ ., xpntree=50) sunmary #20) eredict ovtput predietede predict (#it,x test)2 Es i 2 = Python Code Create PCA object peox deconpositionPCAa component) defoutt value of K =aln(n sarge, m Fetures) for Factor analysis foe decopasition Factenaaiysis() ‘Reduced the osnension of training dataset using PCL ‘train seduced = pea Fit_transforn(train) est_reduced » pea.transfor(test) sport brary brary(stats) pee & princonp(train, cor = TRUE) train reduced < predict(pca, train) test reduced < predict(pca,test)EI ks 2 Py r s Fy Ee Python Code taport Library ‘ron sklear.ensenble Snport GradientoostingClassifier ftssuned you have, X (predictor) and ¥ (target) for training data set ard x test(predictor) of test_dataset create Gradient Boosting Classifier object GradientBoostingClassifier(n_estinators-100, \ Learning ratert.0, max depthea, random stat train the noel using the training sets and check score mocel #100, 9) roredict Ovtout ede -precice(x test) amport Library brary caret) 2 cbind(x troinyy_train) sriccing model ixcontrol © tratnControl( wethed = “repeatedcv", + nunber = 4, repeats = 4) #5 tratngy = 5 date predietede predict(Fit,x_test, type pause) prob") L,2]
You might also like
Model Evaluation and Selection Cheatsheet 1708023215
PDF
No ratings yet
Model Evaluation and Selection Cheatsheet 1708023215
7 pages
ML Cheatsheet
PDF
No ratings yet
ML Cheatsheet
4 pages
Machine Learning Cheatsheet
PDF
No ratings yet
Machine Learning Cheatsheet
5 pages
ML Algorithms
PDF
100% (1)
ML Algorithms
1 page
Lab 1 - Machine Learning with Python - ML Engineering مهم
PDF
No ratings yet
Lab 1 - Machine Learning with Python - ML Engineering مهم
10 pages
Scikit-Learn: Scikit-Learn Is An Open Source Python Library That
PDF
100% (1)
Scikit-Learn: Scikit-Learn Is An Open Source Python Library That
1 page
ML MANUAL WITH OUTPUTS (2)
PDF
No ratings yet
ML MANUAL WITH OUTPUTS (2)
30 pages
sklearn
PDF
No ratings yet
sklearn
141 pages
Scikit-Learn Cheat Sheet
PDF
No ratings yet
Scikit-Learn Cheat Sheet
1 page
Scikit-Learn Cheat Sheet
PDF
No ratings yet
Scikit-Learn Cheat Sheet
1 page
1. Linear Regression (Code)
PDF
No ratings yet
1. Linear Regression (Code)
9 pages
decision tree
PDF
No ratings yet
decision tree
6 pages
Python Predictive Modeling
PDF
No ratings yet
Python Predictive Modeling
24 pages
Adobe Scan 30-Sept-2024
PDF
No ratings yet
Adobe Scan 30-Sept-2024
7 pages
Udacity Machine Learning Analysis Supervised Learning
PDF
100% (1)
Udacity Machine Learning Analysis Supervised Learning
504 pages
Perform Prediction Using Regression Algorithm: Ex No: 1 Date
PDF
No ratings yet
Perform Prediction Using Regression Algorithm: Ex No: 1 Date
13 pages
Scikit-Learn Cheat Sheet Python For Data Science: Preprocessing The Data Evaluate Your Model's Performance
PDF
100% (1)
Scikit-Learn Cheat Sheet Python For Data Science: Preprocessing The Data Evaluate Your Model's Performance
1 page
FREE AI Code Generator - Generate Code Online in Any Language
PDF
No ratings yet
FREE AI Code Generator - Generate Code Online in Any Language
12 pages
Scikit-Learn: Library For Machine Learning and Data Science With Python
PDF
No ratings yet
Scikit-Learn: Library For Machine Learning and Data Science With Python
11 pages
Scikit Learn Cheat Sheet Python
PDF
No ratings yet
Scikit Learn Cheat Sheet Python
1 page
Unit 2 ML
PDF
No ratings yet
Unit 2 ML
93 pages
Scikit Learn What Were Covering
PDF
No ratings yet
Scikit Learn What Were Covering
15 pages
ML Lab Programs For Exam
PDF
No ratings yet
ML Lab Programs For Exam
10 pages
Data Science Machine Leraning222
PDF
No ratings yet
Data Science Machine Leraning222
11 pages
MLT 1 - 7 Kanish
PDF
No ratings yet
MLT 1 - 7 Kanish
24 pages
Programs Lab Bca
PDF
No ratings yet
Programs Lab Bca
16 pages
ML
PDF
No ratings yet
ML
8 pages
ML
PDF
No ratings yet
ML
18 pages
ml lab programs 2
PDF
No ratings yet
ml lab programs 2
16 pages
Unit-2 Feature Selection
PDF
No ratings yet
Unit-2 Feature Selection
92 pages
Scikit Learn
PDF
No ratings yet
Scikit Learn
25 pages
Machine Learning Classification Bootcamp Cheatsheet
PDF
No ratings yet
Machine Learning Classification Bootcamp Cheatsheet
7 pages
Tutorial 6
PDF
No ratings yet
Tutorial 6
8 pages
ADS_phase 3
PDF
No ratings yet
ADS_phase 3
34 pages
Decision Tree
PDF
No ratings yet
Decision Tree
9 pages
ML With Python Practical
PDF
No ratings yet
ML With Python Practical
22 pages
MlLabManualdocx 2024 09 04 22 02 58
PDF
No ratings yet
MlLabManualdocx 2024 09 04 22 02 58
19 pages
LAB MANUAL For Machine Learning
PDF
No ratings yet
LAB MANUAL For Machine Learning
15 pages
Python For Data Science Cheat Sheet: Scikit-Learn Create Your Model Evaluate Your Model's Performance
PDF
100% (1)
Python For Data Science Cheat Sheet: Scikit-Learn Create Your Model Evaluate Your Model's Performance
1 page
ML Lab PT
PDF
No ratings yet
ML Lab PT
25 pages
Data Mining Assignment No. 1
PDF
No ratings yet
Data Mining Assignment No. 1
7 pages
AI ML - Cycle 2 Programs (1)
PDF
No ratings yet
AI ML - Cycle 2 Programs (1)
15 pages
Aiml Ex 4-7
PDF
No ratings yet
Aiml Ex 4-7
8 pages
Introduction To Scikit Learn
PDF
100% (1)
Introduction To Scikit Learn
108 pages
data preprocessing
PDF
No ratings yet
data preprocessing
9 pages
lab3
PDF
No ratings yet
lab3
6 pages
Learn Machine Learning in One Lesson Book
PDF
No ratings yet
Learn Machine Learning in One Lesson Book
8 pages
LAB-4 Report
PDF
No ratings yet
LAB-4 Report
21 pages
Classification & Prediction: - Shailesh Yadav Central University of Rajasthan
PDF
No ratings yet
Classification & Prediction: - Shailesh Yadav Central University of Rajasthan
28 pages
ML EXTERNAL XEROX
PDF
No ratings yet
ML EXTERNAL XEROX
1 page
ML Unit 2
PDF
No ratings yet
ML Unit 2
37 pages
Predictive Modeling Machine Learning
PDF
No ratings yet
Predictive Modeling Machine Learning
16 pages
ML LAB 146
PDF
No ratings yet
ML LAB 146
50 pages
Capítulo 23: Scanned by Camscanner
PDF
No ratings yet
Capítulo 23: Scanned by Camscanner
6 pages
Capítulo 26: Scanned by Camscanner
PDF
No ratings yet
Capítulo 26: Scanned by Camscanner
9 pages
Capítulo 24: Scanned by Camscanner
PDF
No ratings yet
Capítulo 24: Scanned by Camscanner
5 pages
Capítulo 28: Scanned by Camscanner
PDF
No ratings yet
Capítulo 28: Scanned by Camscanner
2 pages
Novo Documento 2019-06-17 16.54.40
PDF
No ratings yet
Novo Documento 2019-06-17 16.54.40
5 pages
Capítulo 22: Scanned by Camscanner
PDF
No ratings yet
Capítulo 22: Scanned by Camscanner
3 pages
Capítulo 21: Scanned by Camscanner
PDF
No ratings yet
Capítulo 21: Scanned by Camscanner
5 pages
Capítulo 29: Scanned by Camscanner
PDF
No ratings yet
Capítulo 29: Scanned by Camscanner
1 page
Novo Documento 2018-03-07 - 1
PDF
No ratings yet
Novo Documento 2018-03-07 - 1
1 page
Novo Documento 2019-06-17 16.54.40 - 1
PDF
No ratings yet
Novo Documento 2019-06-17 16.54.40 - 1
1 page
Orders Order - Items Products Users
PDF
No ratings yet
Orders Order - Items Products Users
2 pages