MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to create a normal distribution in R?

# How to create a normal distribution in R?

This recipe helps you create a normal distribution in R

Random numbers are generated in quite a few cases in statistics to carry out sampling and simulation. Mostly, a data scientist is in a need of a set of random numbers which are mostly taken from two types of distribution:

- Uniform distribution
- Normal distribultion

These random numbers generated mimic the properties of uniform or normal distribution in a certain interval.

In this recipe, you will learn how to create a random normal distribution..

Normal distribution is a type of probability distribution which looks like a bell with co-inciding median, mode and mean. In this type of distribution, 68% observations are within 1 standard deviation from it's mean.

Note: Whenever we are generating random numbers, you are using an algorithm that requires a seed whose function is to initialise. These numbers are actually pseudorandom numbers which can be predicted if we know the seed and the generator. Setting a seed means iniltialising a pseudorandom generator. We set a seed when we need the same output of numbers everytime you want to generate random numbers. If we don't set a seed, the generated pseudorandom numbers are different on each execution.

We use rnorm() function to carry out this task.

Syntax: rnorm(n, min = , max = )

where:

- n = size of the distribution
- min, max = specifies the interval in which you would like the distribution to be

Additionally, use set.seed() function to set a seed. We specify any integer in the function as a seed.

```
# setting a seed
set.seed(20)
# using random numbers from normal distribution between 1 and 30
random_dist = rnorm(10000, mean = 0, sd = 1)
#plotting a histogram of the generated numbers using hist() function
hist(random_dist, breaks = 100)
```

Note:

- The distribution remains constant even after multiple execution.
- You can see that the mean, mode and median co-incides in the above plot indicating a normal distribution

Music Recommendation Project using Machine Learning - Use the KKBox dataset to predict the chances of a user listening to a song again after their very first noticeable listening event.

In this human activity recognition project, we use multiclass classification machine learning techniques to analyse fitness dataset from a smartphone tracker.

Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.

In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.

In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

There are different time series forecasting methods to forecast stock price, demand etc. In this machine learning project, you will learn to determine which forecasting method to be used when and how to apply with time series forecasting example.

In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.