You are on page 1of 9

Software Requirements Specifications Document

Python | random.sample() function


sample() is an inbuilt function of random module in Python that returns a particular
length list of items chosen from the sequence i.e. list, tuple, string or set. Used for
random sampling without replacement.
Syntax : random.sample(sequence, k)
Parameters:
sequence: Can be a list, tuple, string, or set.
k: An Integer value, it specify the length of a sample.

Returns: k length new list of elements chosen from the sequence.


Code #1: Simple implementation of sample() function.
filter_none
edit
play_arrow
brightness_4
# Python3 program to demonstrate
# the use of sample() function .

# import random
from random import sample

# Prints list of random items of given length


list1 = [1, 2, 3, 4, 5]

print(sample(list1,3))

How to Start Learning Machine Learning?


Arthur Samuel coined the term “Machine Learning” in 1959 and defined it as a “Field of
study that gives computers the capability to learn without being explicitly
programmed”.
And that was the beginning of Machine Learning! In modern times, Machine Learning is
one of the most popular (if not the most!) career choices. According to Indeed, Machine
Learning Engineer Is The Best Job of 2019 with a 344% growth and an average base
salary of $146,085 per year.

/conversion/tmp/scratch/449059223.doc Page 1 of 9 11/26/19 f


Software Requirements Specifications Document

But there is still a lot of doubt about what exactly is Machine Learning and how to start
learning it? So this article deals with the Basics of Machine Learning and also the path
you can follow to eventually become a full-fledged Machine Learning Engineer. Now let’s
get started!!!

What is Machine Learning?

/conversion/tmp/scratch/449059223.doc Page 2 of 9 11/26/19 f


Software Requirements Specifications Document

Machine Learning involves the use of Artificial Intelligence to enable machines to learn a
task from experience without programming them specifically about that task. (In short,
Machines learn automatically without human hand holding!!!) This process starts with
feeding them good quality data and then training the machines by building various
machine learning models using the data and different algorithms. The choice of
algorithms depends on what type of data do we have and what kind of task we are trying
to automate.

How to start learning ML?

This is a rough roadmap you can follow on your way to becoming an insanely talented
Machine Learning Engineer. Of course, you can always modify the steps according to
your needs to reach your desired end-goal!

Step 1 – Understand the Prerequisites

In case you are a genius, you could start ML directly but normally, there are some
prerequisites that you need to know which include Linear Algebra, Multivariate Calculus,
Statistics, and Python. And if you don’t know these, never fear! You don’t need a Ph.D.
degree in these topics to get started but you do need a basic understanding.

(a) Learn Linear Algebra and Multivariate Calculus

Both Linear Algebra and Multivariate Calculus are important in Machine Learning.
However, the extent to which you need them depends on your role as a data scientist. If
you are more focused on application heavy machine learning, then you will not be that
heavily focused on maths as there are many common libraries available. But if you want
to focus on R&D in Machine Learning, then mastery of Linear Algebra and Multivariate
Calculus is very important as you will have to implement many ML algorithms from
scratch.

(b) Learn Statistics

Data plays a huge role in Machine Learning. In fact, around 80% of your time as an ML
expert will be spent collecting and cleaning data. And statistics is a field that handles the
collection, analysis, and presentation of data. So it is no surprise that you need to learn
it!!!
Some of the key concepts in statistics that are important are Statistical Significance,

/conversion/tmp/scratch/449059223.doc Page 3 of 9 11/26/19 f


Software Requirements Specifications Document

Probability Distributions, Hypothesis Testing, Regression, etc. Also, Bayesian Thinking is


also a very important part of ML which deals with various concepts like Conditional
Probability, Priors, and Posteriors, Maximum Likelihood, etc.

(c) Learn Python

Some people prefer to skip Linear Algebra, Multivariate Calculus and Statistics and learn
them as they go along with trial and error. But the one thing that you absolutely cannot
skip is Python! While there are other languages you can use for Machine Learning like R,
Scala, etc. Python is currently the most popular language for ML. In fact, there are many
Python libraries that are specifically useful for Artificial Intelligence and Machine
Learning such as Keras, TensorFlow, Scikit-learn, etc.
So if you want to learn ML, it’s best if you learn Python! You can do that using various
online resources and courses such as Fork Python available Free on GeeksforGeeks.

Step 2 – Learn Various ML Concepts

Now that you are done with the prerequisites, you can move on to actually learning ML
(Which is the fun part!!!) It’s best to start with the basics and then move on to the more
complicated stuff. Some of the basic concepts in ML are:

(a) Terminologies of Machine Learning

 Model – A model is a specific representation learned from data by applying some


machine learning algorithm. A model is also called a hypothesis.
 Feature – A feature is an individual measurable property of the data. A set of
numeric features can be conveniently described by a feature vector. Feature
vectors are fed as input to the model. For example, in order to predict a fruit, there
may be features like color, smell, taste, etc.
 Target (Label) – A target variable or label is the value to be predicted by our
model. For the fruit example discussed in the feature section, the label with each
set of input would be the name of the fruit like apple, orange, banana, etc.
 Training – The idea is to give a set of inputs(features) and it’s expected
outputs(labels), so after training, we will have a model (hypothesis) that will then
map new data to one of the categories trained on.
 Prediction – Once our model is ready, it can be fed a set of inputs to which it will
provide a predicted output(label).

(b) Types of Machine Learning

/conversion/tmp/scratch/449059223.doc Page 4 of 9 11/26/19 f


Software Requirements Specifications Document

 Supervised Learning – This involves learning from a training dataset with labeled
data using classification and regression models. This learning process continues
until the required level of performance is achieved.
 Unsupervised Learning – This involves using unlabelled data and then finding the
underlying structure in the data in order to learn more and more about the data
itself using factor and cluster analysis models.
 Semi-supervised Learning – This involves using unlabelled data like
Unsupervised Learning with a small amount of labeled data. Using labeled data
vastly increases the learning accuracy and is also more cost-effective than
Supervised Learning.
 Reinforcement Learning – This involves learning optimal actions through trial
and error. So the next action is decided by learning behaviors that are based on the
current state and that will maximize the reward in the future.

(c) How to Practise Machine Learning?

 The most time-consuming part in ML is actually data collection, integration,


cleaning, and preprocessing. So make sure to practice with this because you need
high-quality data but large amounts of data are often dirty. So this is where most of
your time will go!!!
 Learn various models and practice on real datasets. This will help you in creating
your intuition around which types of models are appropriate in different situations.
 Along with these steps, it is equally important to understand how to interpret the
results obtained by using different models. This is easier to do if you understand
various tuning parameters and regularization methods applied on different models.

(d) Resources for Learning Machine Learning:

There are various online and offline resources (both free and paid!) that can be used to
learn Machine Learning. Some of these are provided here:
 For a broad introduction to Machine Learning, Stanford’s Machine Learning
Course by Andrew Ng is quite popular. It focuses on machine learning, data mining,
and statistical pattern recognition with explanation videos are very helpful in
clearing up the theory and core concepts behind ML.
 If you want a self-study guide to Machine Learning, then Machine Learning Crash
Course from Google is good for you as it will provide you an introduction to
machine learning with video lectures, real-world case studies, and hands-on
practice exercises.
 In case you prefer an offline course, the Geeksforgeeks Machine Learning
Foundation course will be ideal for you. This course will teach you about various

/conversion/tmp/scratch/449059223.doc Page 5 of 9 11/26/19 f


Software Requirements Specifications Document

concepts of Machine Learning and also practical experience in implementing them


in a classroom environment.

Step 3 – Take part in Competitions

After you have understood the basics of Machine Learning, you can move on to the
crazy part!!! Competitions! These will basically make you even more proficient in ML by
combining your mostly theoretical knowledge with practical implementation. Some of
the basic competitions that you can start with on Kaggle that will help you build
confidence are given here:
 Titanic: Machine Learning from Disaster: The Titanic: Machine Learning from
Disaster challenge is a very popular beginner project for ML as it has multiple
tutorials available. So it is a great introduction to ML concepts like data exploration,
feature engineering, and model tuning.
 Digit Recognizer: The Digit Recognizer is a project after you have some
knowledge of Python and ML basics. It is a great introduction into the exciting
world neural networks using a classic dataset which includes pre-extracted
features.
After you have completed these competitions and other such simple challenges …
Congratulations!!! You are well on your way to becoming a full-fledged Machine Learning
Engineer and you can continue enhancing your skills by working on more and more
challenges and eventually creating more and more creative and difficult Machine
Learning projects.

Recommended Posts:
 Learning Model Building in Scikit-learn : A Python Machine Learning Library

 Artificial intelligence vs Machine Learning vs Deep Learning

 ML | What is Machine Learning ?

 Machine Learning in C++

 How Does Google Use Machine Learning?

 How Does NASA Use Machine Learning?

 Clustering in Machine Learning

 30 minutes to machine learning

/conversion/tmp/scratch/449059223.doc Page 6 of 9 11/26/19 f


Software Requirements Specifications Document

 Regularization in Machine Learning

 Stacking in Machine Learning

 Demystifying Machine Learning

 Machine Learning - Applications

 Firebase Machine Learning kit

 An introduction to Machine Learning

 Getting started with Machine Learning

/conversion/tmp/scratch/449059223.doc Page 7 of 9 11/26/19 f


Software Requirements Specifications Document

harkiran78
Check out this Author's contributed articles.

/conversion/tmp/scratch/449059223.doc Page 8 of 9 11/26/19 f


Software Requirements Specifications Document

If you like GeeksforGeeks and would like to contribute, you can also write an article
using contribute.geeksforgeeks.org or mail your article to
contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main
page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve
Article" button below.

/conversion/tmp/scratch/449059223.doc Page 9 of 9 11/26/19 f

You might also like