0% found this document useful (0 votes)
9 views6 pages

Overview of Python Libraries for ML

The Python standard library includes common packages like NumPy, Pandas, Matplotlib and Scikit-learn for scientific computing, data analysis and machine learning. It also includes libraries like TensorFlow, PyTorch and Scrapy for deep learning, reinforcement learning and web scraping. Common machine learning techniques include supervised learning, unsupervised learning and reinforcement learning.

Uploaded by

riddhi chavan
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)
9 views6 pages

Overview of Python Libraries for ML

The Python standard library includes common packages like NumPy, Pandas, Matplotlib and Scikit-learn for scientific computing, data analysis and machine learning. It also includes libraries like TensorFlow, PyTorch and Scrapy for deep learning, reinforcement learning and web scraping. Common machine learning techniques include supervised learning, unsupervised learning and reinforcement learning.

Uploaded by

riddhi chavan
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

Q1.

What are Python standard library

Ans:

1. TensorFlow: This library was developed by Google in collaboration with the


Brain Team. It is an open-source library used for high-level computations. It is
also used in machine learning and deep learning algorithms. It contains a large
number of tensor operations. Researchers also use this Python library to solve
complex computations in Mathematics and Physics.

2. Matplotlib: This library is responsible for plotting numerical data. And that’s why
it is used in data analysis. It is also an open-source library and plots high-defined
figures like pie charts, histograms, scatterplots, graphs, etc.

3. Pandas: Pandas are an important library for data scientists. It is an open-source


machine learning library that provides flexible high-level data structures and a
variety of analysis tools. It eases data analysis, data manipulation, and cleaning of
data. Pandas support operations like Sorting, Re-indexing, Iteration,
Concatenation, Conversion of data, Visualizations, Aggregations, etc.

4. Numpy: The name “Numpy” stands for “Numerical Python”. It is the commonly
used library. It is a popular machine learning library that supports large matrices
and multi-dimensional data. It consists of in-built mathematical functions for easy
computations. Even libraries like TensorFlow use Numpy internally to perform
several operations on tensors. Array Interface is one of the key features of this
library.

5. SciPy: The name “SciPy” stands for “Scientific Python”. It is an open-source


library used for high-level scientific computations. This library is built over an
extension of Numpy. It works with Numpy to handle complex computations.
While Numpy allows sorting and indexing of array data, the numerical data code
is stored in SciPy. It is also widely used by application developers and engineers.

6. Scrapy: It is an open-source library that is used for extracting data from websites.
It provides very fast web crawling and high-level screen scraping. It can also be
used for data mining and automated testing of data.

7. Scikit-learn: It is a famous Python library to work with complex data. Scikit-learn


is an open-source library that supports machine learning. It supports variously
supervised and unsupervised algorithms like linear regression, classification,
clustering, etc. This library works in association with Numpy and SciPy.

8. PyGame: This library provides an easy interface to the Standard Directmedia


Library (SDL) platform-independent graphics, audio, and input libraries. It is used
for developing video games using computer graphics and audio libraries along with
Python programming language.

9. PyTorch: PyTorch is the largest machine learning library that optimizes tensor
computations. It has rich APIs to perform tensor computations with strong GPU
acceleration. It also helps to solve application issues related to neural networks.

10. PyBrain: The name “PyBrain” stands for Python Based Reinforcement Learning,
Artificial Intelligence, and Neural Networks library. It is an open-source library
built for beginners in the field of Machine Learning. It provides fast and easy-to-
use algorithms for machine learning tasks. It is so flexible and easily
understandable and that’s why is really helpful for developers that are new in
research fields.

Q2. What is machine learning?


Ans:

Machine learning (ML) is a type of artificial intelligence (AI) that allows software
applications to become more accurate at predicting outcomes without being
explicitly programmed to do so.
Machine learning algorithms use historical data as input to predict new output
values.

Q2. What is AI?


Ans:

Artificial intelligence is the simulation of human intelligence processes by machines,


especially computer systems. Specific applications of AI include expert systems,
natural language processing, speech recognition and machine vision.

Q3. What Are the Different Types of Machine Learning?

Ans: There are three types of machine learning:


Supervised Learning

In supervised machine learning, a model makes predictions or decisions based on past or


labeled data. Labeled data refers to sets of data that are given tags or labels, and thus made
more meaningful.

Unsupervised Learning

In unsupervised learning, we don't have labeled data. A model can identify patterns,
anomalies, and relationships in the input data.

Reinforcement Learning

Using reinforcement learning, the model can learn based on the rewards it received for its
previous action.

Consider an environment where an agent is working. The agent is given a target to achieve.
Every time the agent takes some action toward the target, it is given positive feedback. And, if
the action taken is going away from the goal, the agent is given negative feedback.

Q4. How Do You Handle Missing or Corrupted Data in a Dataset?

One of the easiest ways to handle missing or corrupted data is to drop those rows or columns
or replace them entirely with some other value.

There are two useful methods in Pandas:

 IsNull() and dropna() will help to find the columns/rows with missing data and
drop them

 Fillna() will replace the wrong values with a placeholder value

Q5. What is overfitting?

Overfitting occurs when your model learns too much from training data and isn’t able to
generalize the underlying information. When this happens, the model is able to describe training
data very accurately but loses precision on every dataset it has not been trained on. This is

completely bad because we want our model to be reasonably good on data that it has never seen

before.

Methods to avoid Over-fitting:

 Using K-fold cross-validation

 Using Regularization techniques such as Lasso and Ridge

 Training model with sufficient data

 Adopting ensembling techniques

Q6. What is Underfitting?


Ans:
When a model has not learned the patterns in the training data well and is unable to generalize
well on the new data, it is known as underfitting. An underfit model has poor performance on
the training data and will result in unreliable predictions. Underfitting occurs due to high bias
and low variance.

Ways to Tackle Underfitting

 Increase the number of features in the dataset

 Increase model complexity

 Reduce noise in the data

 Increase the duration of training the data


10. What Are the Differences Between Machine Learning and Deep
Learning?

Machine Learning Deep Learning

 Enables machines to take decisions


 Enables machines to take decisions on
with the help of artificial neural
their own, based on past data
networks
 It needs only a small amount of data for
 It needs a large amount of training
training
data
 Works well on the low-end system, so
 Needs high-end machines because
you don't need large machines
it requires a lot of computing
 Most features need to be identified in power
advance and manually coded
 The machine learns the features
 The problem is divided into two parts from the data it is provided
and solved individually and then
 The problem is solved in an end-to-
combined
end manner

16. What is a Neural Network?

It is a simplified model of the human brain. Much like the brain, it has neurons that activate
when encountering something similar.

The different neurons are connected via connections that help information flow from one
neuron to another.

17. List vs tuples


List Tuple

It is mutable It is immutable

The implication of iterations is time- Implications of iterations are much


consuming in the list. faster in tuples.

Operations like insertion and deletion are


Elements can be accessed better.
better performed.

Consumes more memory. Consumes less memory.

Many built-in methods are available. Does not have many built-in methods.

Unexpected errors and changes can easily


occur in lists. Unexpected errors and changes rarely
occur in tuples.

Common questions

Powered by AI

TensorFlow and PyTorch are powerful in machine learning due to their capabilities to handle extensive computations, optimize tensor operations, and support deep learning algorithms. TensorFlow, developed by Google, is preferred for deploying models at scale, due to its powerful high-level operations and comprehensive ecosystem . PyTorch, on the other hand, is favored in research environments because it provides a more intuitive coding experience with its dynamic computation graph, enhancing the flexibility for identifying non-linear relationships . Their significance lies in supporting both academic research and large-scale production environments .

Neural networks are simplified models of the human brain that simulate how biological neurons operate. They consist of interconnected nodes—much like neurons in the brain—that activate in response to specific inputs, with connections helping information flow between neurons . This architecture allows neural networks to process complex datasets, learn patterns, and make predictions by mimicking the cognitive processes of the human brain .

Pandas is an open-source machine learning library that provides flexible high-level data structures, making it ideal for data manipulation and analysis. It supports operations like sorting, re-indexing, iteration, data conversion, and visualizations, thus easing data analysis tasks . Numpy, on the other hand, is primarily used for numerical computations on large matrices and multi-dimensional data. It features a strong array interface and supports mathematical functions that simplify complex computations . While Pandas offers more tools for handling and analyzing structured data, NumPy is optimized for numerical array operations and serves as a foundational library for other libraries, like SciPy, which relies on NumPy arrays for high-level scientific computations .

Preventing overfitting is crucial because it enables a model to generalize well to new data rather than just memorizing training data. Overfitting can be reduced using strategies such as K-fold cross-validation and regularization techniques like Lasso and Ridge. It is also beneficial to train the model with a sufficient amount of data and adopt ensembling techniques, which combine multiple models' predictions to improve robustness . These methods ensure that the model can handle unseen data with better predictive accuracy .

Scikit-learn is beneficial for machine learning because it supports a range of both supervised and unsupervised algorithms, such as linear regression, classification, and clustering. Its ability to integrate with libraries like NumPy and SciPy allows it to handle a variety of complex data types efficiently . Its open-source nature and comprehensible API make it user-friendly for both new and experienced researchers working in data science fields .

Reinforcement learning differs from supervised and unsupervised learning in that it relies on a system of rewards and penalties rather than labeled or unlabeled data. In reinforcement learning, an agent learns by interacting with its environment, receiving feedback in the form of rewards (positive feedback) for achieving targets and penalties (negative feedback) when moving away from them . In contrast, supervised learning uses labeled data to predict outcomes, and unsupervised learning uses non-labeled data to identify patterns and relationships .

PyTorch is known for its dynamic computation graph, making it more intuitive for developers who need to alter networks during runtime, which is essential in research and non-linear model development . TensorFlow, though developed by Google, is typically used for deploying models in production due to its robust and high-level computations . A developer might choose PyTorch for its simplicity and ease of debugging in research, while TensorFlow would be preferable for scalability and deployment in a production setting .

Handling missing data can be effectively managed using Pandas in Python. The isNull() and dropna() methods help identify and remove rows or columns containing missing values. Alternatively, missing data can be imputed using the fillna() method, which replaces missing or corrupted data with a placeholder value . These methods ensure the integrity and completeness of datasets, essential for accurate data analysis and modeling .

Machine learning requires a smaller amount of training data and typically works well on low-end systems, making it less resource-intensive. It relies on manual feature extraction, meaning that features have to be identified and coded in advance . In contrast, deep learning needs a substantial amount of data for training and requires high-end computational power, often with the help of GPUs due to its use of artificial neural networks that automatically learn features from data .

Developers can utilize the Scrapy library for data mining and web scraping by taking advantage of its fast web crawling capabilities and high-level screen scraping functions . Scrapy automates data extraction from websites, which can be crucial for gathering datasets for analysis. It is useful in extracting large amounts of data efficiently, supporting data mining efforts and automated testing of web data .

You might also like