### learn ARDUINO

from basics to expert level of knowledge is being shared with you in this clip

-open source electronic prototyping platform

Views: 4108

Attachments

### Arduino_Tutorial-1.pdf

Knowledge Score: N/A

Similar Knowledge

learn everything about ARDUINO from basics to expert level of knowledge is being shared with you in this clip -open source electronic prototyping platform
a book from renowned professor NILLS J NILLSON(stanford university) to help you in learning machine learning.
Attached below are the notes for the course Computer Science and subject Machine learning. The topics included in the attachment are History of the Artificial Neural Networks, Artificial Neural Network, How do ANNs work?, etc. #PES University
Logistic Regression Don&rsquo;t get confused by its name! It is a classification not a regression algorithm.&nbsp;It is used to estimate discrete values&nbsp;( Binary values like 0/1, yes/no, true/false&nbsp;) based on given set of independent variable(s). In simple words, it&nbsp;predicts the probability of&nbsp;occurrence of an event by fitting data to a logit function.&nbsp;Hence, it is also known as logit regression. Since, it predicts the probability, its&nbsp;output values lies between 0 and 1 (as expected). Again, let us try and understand this through a simple example. Let&rsquo;s say your friend gives you a puzzle to solve. There are only 2 outcome scenarios &ndash; either you solve it or you don&rsquo;t. Now imagine, that you are being given wide&nbsp;range of puzzles / quizzes in an attempt to understand which subjects you are good at. The outcome to this study would be something like this &ndash; if you are given a trignometry based tenth grade problem, you are 70% likely to solve it. On the other hand, if it is grade fifth history question,&nbsp;the probability of getting an answer is only 30%. This is what Logistic Regression provides you. Coming to the math, the log odds of the outcome is modeled as a linear combination of the predictor variables. odds= p/ (1-p) = probability of event occurrence /&nbsp;probability of not event occurrence ln(odds) = ln(p/(1-p)) logit(p) = ln(p/(1-p)) = b0+b1X1+b2X2+b3X3....+bkXk Above, p is the probability of presence of the characteristic of interest. It chooses parameters that maximize the likelihood of observing the sample values rather than that&nbsp;minimize the sum of squared errors (like in ordinary regression). Now, you may ask, why take a log? For the sake of simplicity, let&rsquo;s just say that this is one of the best mathematical way to replicate a step function. I can go in more details, but that will beat the purpose of this article. Python Code #Import Library from sklearn.linear_model import LogisticRegression #Assumed you have, X (predictor) and Y (target) for training data set and x_test(predictor) of test_dataset # Create logistic regression object model = LogisticRegression() # Train the model using the training sets and check score model.fit(X, y) model.score(X, y) #Equation coefficient and Intercept print(&#39;Coefficient: \n&#39;, model.coef_) print(&#39;Intercept: \n&#39;, model.intercept_) #Predict Output predicted= model.predict(x_test) R&nbsp;Code x &lt;- cbind(x_train,y_train) # Train the model using the training sets and check score logistic &lt;- glm(y_train ~ ., data = x,family=&#39;binomial&#39;) summary(logistic) #Predict Output predicted= predict(logistic,x_test) Furthermore.. There are many different steps that could be tried in order to improve the model: including interaction terms removing features regularization techniques using a non-linear model
Linear Regression It is used to estimate&nbsp;real values (cost of houses, number of calls, total sales etc.) based on continuous variable(s). Here, we establish relationship between independent and dependent variables by fitting a best&nbsp;line. This best fit line is known as regression line and represented by a linear equation Y= a *X + b. The best way to understand linear regression is to relive this experience of childhood. Let us say, you ask a child in fifth grade to arrange people in his class by increasing order of weight, without asking them their weights! What do you think the child will do? He / she would likely look (visually analyze) at the height and build of people and arrange them using a combination of these visible parameters. This is linear regression in real life! The child has actually figured out that height and build would be correlated to the weight by a relationship, which looks like the equation above. In this equation: Y &ndash; Dependent Variable a &ndash; Slope X &ndash; Independent variable b &ndash; Intercept These coefficients a and b are derived based on minimizing the sum of squared difference of distance between data points and regression line. Look at the below example. Here we have identified the best fit line having linear equation y=0.2811x+13.9. Now using this equation, we can find the weight, knowing the height of a person. Linear Regression is of mainly two types: Simple Linear Regression and Multiple Linear Regression. Simple Linear Regression is characterized by one independent variable. And, Multiple Linear Regression(as the name suggests) is characterized by multiple (more than 1) independent variables.&nbsp;While finding best fit line, you can fit&nbsp;a polynomial or curvilinear regression. And these are known as polynomial or curvilinear regression. Python Code #Import Library #Import other necessary libraries like pandas, numpy... from sklearn import linear_model #Load Train and Test datasets #Identify feature and response variable(s) and values must be numeric and numpy arrays x_train=input_variables_values_training_datasets y_train=target_variables_values_training_datasets x_test=input_variables_values_test_datasets # Create linear regression object linear = linear_model.LinearRegression() # Train the model using the training sets and check score linear.fit(x_train, y_train) linear.score(x_train, y_train) #Equation coefficient and Intercept print(&#39;Coefficient: \n&#39;, linear.coef_) print(&#39;Intercept: \n&#39;, linear.intercept_) #Predict Output predicted= linear.predict(x_test) R Code #Load Train and Test datasets #Identify feature and response variable(s) and values must be numeric and numpy arrays x_train &lt;- input_variables_values_training_datasets y_train &lt;- target_variables_values_training_datasets x_test &lt;- input_variables_values_test_datasets x &lt;- cbind(x_train,y_train) # Train the model using the training sets and check score linear &lt;- lm(y_train ~ ., data = x) summary(linear) #Predict Output predicted= predict(linear,x_test)&nbsp;
Decision Tree This is one of my favorite algorithm and&nbsp;I use it quite frequently. It&nbsp;is a type of supervised learning algorithm that is mostly used for&nbsp;classification problems. Surprisingly, it works for both&nbsp;categorical and continuous dependent&nbsp;variables. In this algorithm, we split the population into two or more homogeneous sets. This is done based on most significant attributes/ independent variables to make as distinct groups as possible. For more details, you can read:&nbsp;Decision Tree Simplified. In the image above, you can see that population is classified into four different groups based on multiple&nbsp;attributes to identify &lsquo;if&nbsp;they will play or not&rsquo;. To&nbsp;split the population into different heterogeneous groups, it uses various techniques like Gini, Information Gain, Chi-square, entropy. The best way to understand how decision tree works, is to play Jezzball &ndash; a classic game from Microsoft (image below). Essentially, you have a room with moving walls and you need to create walls such that maximum area gets cleared off with out the balls. So, every time you split the room with a wall, you are trying to create 2 different populations with in the same room. Decision trees work in very similar fashion by dividing a population in as different groups as possible. Python Code #Import Library #Import other necessary libraries like pandas, numpy... from sklearn import tree #Assumed you have, X (predictor) and Y (target) for training data set and x_test(predictor) of test_dataset # Create tree object model = tree.DecisionTreeClassifier(criterion=&#39;gini&#39;) # for classification, here you can change the algorithm as gini or entropy (information gain) by default it is gini # model = tree.DecisionTreeRegressor() for regression # Train the model using the training sets and check score model.fit(X, y) model.score(X, y) #Predict Output predicted= model.predict(x_test) R&nbsp;Code library(rpart) x &lt;- cbind(x_train,y_train) # grow tree&nbsp; fit &lt;- rpart(y_train ~ ., data = x,method=&quot;class&quot;) summary(fit) #Predict Output predicted= predict(fit,x_test)  