cover photo

COURSEWORK

Kushal's AI-ML-001 course work. Lv 1

KushalAUTHORACTIVE
This Report is flagged by a Coordinator and it probably requires some changes to be approved.

LEVEL-1 REPORT BY KUSHAL S R

10 / 6 / 2022


LEVEL-1 REPORT BY KUSHAL S R # TASK-1 # 1. LINEAR REGRESSION Regression analysis is used to model the relationship between a single dependent variable Y (aka response, target, or outcome) and one or more independent variables X (aka predictor or feature). The fitted (predicted) values typically denoted by Y-hat, and β-hat coefficients are chosen by the model as they minimize the squared distance (aka residuals) between the actual Y value and the best fit (Y-hat) minimizing the following expression i.e. having values with the least variance. Step-1: Import the libraries Step-2: load boston dataset model Step-3 : Setting dependent and independent variables Step-4: Fitting the model and splitting the dataset into training and testing sets Step-5: Predicting the values of y from the testing set using the model created Step-6: Performance metrics # 2. LOGISTIC REGRESSION Logistic regression is basically a supervised classification algorithm. In a classification problem, the target variable(or output), y, can take only discrete values for a given set of features(or inputs), X. Here the procedure is same as linear regression except we map the dependent variable to a category like the type of flower, in iris dataset we have 3 types of flowers so y can have 3 values namely ,2. Here we use decision boundaries to put the continuous values into categorical ones. Step-1: Import libraries and load the dataset Step-2: Mapping the values and defining the dependent and independent variables and fitting the model Step-3: Predicted values and performance(score) # TASK-2 Matplotlib is one of the most popular and oldest plotting libraries in Python which is used in Machine Learning. In Machine learning, it helps to understand the huge amount of data through different visualisations. Importing the required libraries and loading the dataset Bar graph Scatter plot # TASK-3 Performance metrics are a part of every machine learning pipeline. They tell you if you're making progress, and put a number on it. All machine learning models, whether it's linear regression, or a SOTA technique like BERT, need a metric to judge performance Regression metrics - Mean Absolute Error (MAE), - Mean Squared Error (MSE), - Root Mean Squared Error (RMSE), - R² (R-Squared). # Classification Metrics Classification is one of the most widely used problems in machine learning with various industrial applications, from face recognition, Youtube video categorization, content moderation, medical diagnosis, to text classification, hate speech detection on Twitter. Models such as support vector machine (SVM), logistic regression, decision trees, random forest, XGboost, convolutional neural network¹, recurrent neural network are some of the most popular classification models. 1- Confusion Matrix 2- Classification Accuracy 3- Precision 4- Recall 5- F1 Score 6- Sensitivity and Specificity 7- ROC Curve 8- AUC Area Under Curve # TASK-4 # Linear Regression from Scratch Data The first step for any machine learning problem is getting the data def load_data(filename): df = pd.read_csv(filename, sep=\ \", index_col=False) df.columns = [\"housesize\", \"rooms\", \"price\"] data = np.array(df, dtype=float) plot_data(data[ 2], data[:, -1]) normalize(data) return data[ 2], data[:, -1] Normalize the data Z = (x — μ) / μ : mean : standard deviation Plot the data Hypothesis hθ(x) = θ0 + θ1x1 + θ2x2 Cost Function # TASK-5 K-Nearest Neighbour is one of the simplest Machine Learning algorithms based on Supervised Learning technique. K-NN algorithm assumes the similarity between the new case/data and available cases and put the new case into the category that is most similar to the available categories. ## Implementing K-NearestNeighbour Algorithm for Iris dataset Importing the required libraries and loading the dataset Data Normalization and fitting the model Metrics "

UVCE,
K. R Circle,
Bengaluru 01