0% found this document useful (0 votes)
16 views3 pages

Machine Learning Basics with Matplotlib

Machine learning enables computers to perform tasks and make decisions autonomously, categorized into supervised and unsupervised approaches. The machine learning process involves data collection, transformation, modeling, and visualization, with tools like Scikit-learn facilitating model building and evaluation. Key concepts include classification, regression, and the importance of training and testing datasets for accurate predictions.

Uploaded by

jentlewrites01
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Machine Learning Basics with Matplotlib

Machine learning enables computers to perform tasks and make decisions autonomously, categorized into supervised and unsupervised approaches. The machine learning process involves data collection, transformation, modeling, and visualization, with tools like Scikit-learn facilitating model building and evaluation. Key concepts include classification, regression, and the importance of training and testing datasets for accurate predictions.

Uploaded by

jentlewrites01
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Machine Learning

Machine learning is the ability of a computer or a machine to carry out tasks or make decisions without being
explicitly programmed.
You train a machine to predict and monitor things on its own.

Types of Approach
Classification under Supervised
Regressed

# Get the notes and all orders stuff


matplotbit, seaborn#

Grouped into Supervised and Unsupervised.

Supervised learning, there is a labeled data.


Regression answers the how much? path or how many?.

Machine learning process:


Data collection
Data transformation
Data Modeling
Feature engineering
Modelling and visualization

Data science process


Load and clean Data
Exploratory data analysis
Feature Engineering
Model building
Model Evaluation and Visualization.

Scikit-learn is a package that comes with so many algorithms that allow you to build machine models and
evaluate the capacity to....
Clustering is grouping

#Think of a project, do a research, something that resonates with you#

Scikit learn has a series of data and packages.


e.g
train_test_split helps to learn on one thing and get trained in something you haven't seen before. Splitting
your data into two, using one part of it t train the model and use the other to test the model. Training set, as
well as the test set.

SVC - Support Vector

Target Name
Description

Most machine learning works with numeric.


You can import pandas to work with the data and play around with it.

Be familiar with the structure of sklearn. (from sklearn.)


#Read on models on sklearn#

Import the model


Load/ Initialize the model
Train your model - (We dont want the machine to cram, we want it to learn) the process of training is
called fit.
from sklearn.model_selection import train_test_split
X_train, y_train, X_test, y_test = train_test_split(X, y, train_size=0.7, random_state=42)
random_state is used to maintain the values, its like a constant used to produce the same result.
Predict the values.
To make this easier, scikit helps using accuracy score, to help check the values.
from [Link] import accuracy_score
pred is a short for prediction
True positive means that the result is not influenced
False positive means the result shows that its being influenced.
#Assignment#
- Write about Type 1 error and Type 2 errors
- Read on machine learning evaluation metrics for classification metrics and regression models
- Project
- How to google like a pro
- Using data visualization, build a decision tree
#Assignment#

[Link]("A")["B"].mean().mean()
.count().reset_indxe().sort_values(by = 'A', ascending = false)

Common questions

Powered by AI

Importing scikit-learn facilitates machine learning model development and evaluation by providing access to a wide range of algorithms and utilities for data manipulation, model building, and evaluation. It includes functions for preprocessing data, splitting datasets, feature selection, and applying algorithms for both supervised and unsupervised learning tasks . Additionally, scikit-learn provides tools for assessing model performance using metrics like accuracy, precision, and recall, and for model validation through techniques such as cross-validation . This comprehensive library supports efficient and streamlined development of machine learning projects .

Feature engineering plays a critical role in building a machine learning model as it involves creating new variables that are not present in the training data from the existing data. This process transforms and selects the most relevant features for model building, which can significantly improve the performance and accuracy of the model . It involves data cleaning and preparation which directly affect the model's learning process by ensuring that the model is trained on data that best represents the problem domain, thus making it crucial for the generalizability and efficiency of the model .

Supervised learning differentiates itself from unsupervised learning by the presence of labeled data. In supervised learning, the algorithm is trained on a dataset that includes inputs paired with the correct outputs, allowing it to learn the mapping from inputs to outputs. This is particularly useful for tasks such as classification and regression where predictions for new data are needed . In contrast, unsupervised learning works with unlabeled data and aims to find hidden patterns or structures, such as in clustering tasks where the goal is to group similar data points together without prior labels .

The significance of accuracy_score in evaluating the performance of a machine learning model lies in its use as a metric to determine the proportion of correctly predicted instances out of the total instances evaluated. It provides a straightforward measure of model performance by comparing predicted values with actual values . Accuracy is computed as the number of correct predictions divided by the total number of predictions, giving a value between 0 and 1, which can be interpreted as a percentage of correct predictions . It is particularly effective in balanced datasets but might not be sufficient for imbalanced datasets where other metrics like precision, recall, or F1-score are also considered .

In the context of evaluating a machine learning model, 'True Positive' (TP) refers to the scenario where the model correctly predicts the positive class when the actual class is also positive. It indicates that the prediction was accurate, genuinely reflecting the true state of the instance without external influence . Conversely, 'False Positive' (FP) occurs when the model predicts the positive class, but the actual class is negative, indicating an incorrect prediction showing influence of confounding factors or noise . These terms are crucial for understanding a model's error rate and for computing more comprehensive metrics such as precision and recall .

Using random_state in the train_test_split function helps maintain model consistency by ensuring the same random split of data into training and test sets across different model training sessions . By specifying a constant value for random_state, the order of data shuffling remains the same, which means that the training and test subsets are consistent across executions. This allows for reproducibility in experiments and comparisons between different models or changes in model parameters while keeping the data distribution constant .

In supervised machine learning, the regression task fundamentally differs from the classification task in that it deals with predicting continuous numerical outcomes, while classification tasks focus on predicting discrete category labels. Regression models address 'how much' or 'how many' type of questions, producing a real-valued output like predicting house prices or temperature . Classification models, on the other hand, categorize inputs into predefined classes, such as determining whether an email is spam or not . This distinction influences the choice of algorithms and metrics used for model building and evaluation .

The process of fitting a model is described as training the model because it involves adjusting the model parameters to minimize error using the provided training data. Unlike memorization, which is simply learning the training data by heart, training involves understanding patterns and relationships within the data so that the model can extrapolate this learning to new data . This involves generalizing from the input features to underlying concepts, allowing the model to make accurate predictions on unseen data rather than just recalling the training instances .

Data visualization plays a crucial role in the model evaluation and building process within machine learning by allowing practitioners to understand the underlying patterns, distributions, and anomalies in the data through graphical representations. It helps in the exploratory data analysis phase to identify trends and outliers and during model evaluation to visualize the performance metrics, such as assessing prediction errors or the distribution of a model’s output . Visualization aids in communicating the results and insight derived from data in an accessible and interpretable manner, facilitating better decision-making .

The train_test_split function contributes to the evaluation of machine learning models by dividing the dataset into two subsets: the training set and the test set. The training set is used to train the model, allowing it to learn the relationships within the data, while the test set is used to evaluate the model's performance on unseen data . This separation helps in assessing how well the model will generalize to new, unseen data and prevents overfitting, where the model would perform well on training data but poorly on new data .

You might also like