Adarsha Regmi

categorical data

Data types for categorical data.

Some useful methods in R that helps while working with the similar type of data

a) factor

multiple values are considered as categories and neglicted duplicate values


 survey_vector <- c(“M”, “F”, “F”, “M”, “M”)factor_survey_vector <- factor(survey_vector)

b) levels

placing label for the categories

levels(factor_survey_vector) <-c("Female","Male")factor_survey_vector

c) summary

similar to the way there exist summary method in pandas in python here we’ve summary method


that’s all for now. Keep learning.




Similar to numpy where exist multi-dimensional array, the pytorch tensorflow are build up of tensors.


ever heard of it. Let’s begin.

  • They are same as numpy arrays except that they have flexibility to run in GPU.

Types of

  1. FloatTensor: 32-bit float
  2. DoubleTensor: 64-bit float
  3. HalfTensor: 16-bit float
  4. IntTensor: 32-bit int
  5. LongTensor: 64-bit int
tensor vs nd array

some basic functions

  • torch.add()
  • torch.sub()
  • <matrix multiplication>
  • torch.div()
  • torch.t()
  • a.reshape()

# converting the numpy array to tensor

  • tensor = torch.from_numpy(a)

In next section lets discuss more about the common pytorch Modules… part 3 .