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

# How to create a uniform distribution in R?

This recipe helps you create a uniform 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 uniform distribution..

Uniform distribution is a type of probability distribution in which all the numeric variables have an equal probability to occur. The are the most popular type of distribution in generating random numbers.

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 runif() function to carry out this task.

Syntax: runif(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
uniform_dist = runif(100, min = 1, max = 30)
#plotting a histogram of the generated numbers using hist() function
hist(uniform_dist, breaks = 3)
```

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

In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

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.

In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

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

In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

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

Use the Adult Income dataset to predict whether income exceeds 50K yr based on
census data.

Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.

In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

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