Docsity

Big Data Analytics Lesson 2, Dispense di Matlab

Anteprima parziale del testo

Scarica Big Data Analytics Lesson 2 e più Dispense in PDF di Matlab solo su Docsity!

BIG DATA

Predictive Analytics Methodology

Lecturer: Lucrezia Noli

Lesson 2

  • CRISP-DM stands for “Cross Industry Standard Process for Data Mining” and it’s a widely used methodology to create predictive analysis solutions
  • In 1996 the European Union finances the work to define the methodology, which is carried out by four companies: SPSS, NCR Corporation, Daimler-Benz e OHRA.
  • The first version is definied by 1999, in 2006 new works start to define a second standard CRISP-DM 2.0. - This second one was never finished - Nonetheless, CRISP-DM in its origianl version is widely used by companies entering data mining projects

CRISP - DM

Business understanding

What is the problem we want to solve?

  • This is pivotal because it will define all the subsequent steps of our

analysis

  • Do we have the data necessary to solve the problem?
    • Do we have them internally or we have to ask them to someone

else?

  • What are the requirements of the project?
    • How much will it cost? do we have the skill-set necessary to carry

out such analysis, or should we hire someone externally

  • What are the risks involved in the project?
    • What are the best and worst case scenarios?
  • Are benefits higher than costs?

Data understanding

  • How do our data look?
    • Statistical descriptive analysis (mean, sdev)
    • How many variables are we dealing with, of what type?
    • Is there correlation between variables?
    • Are there missing values?
  • Expecially in the case of Big Data…
    • What supports do we need to efficiently store and analyze all the data?
    • Do we have unstructured data as well? In this case we will need to turn them into structured before we can carry out any analysis

Splitting the data

  • For SUPERVISED models , we need to split the dataset in two parts:
    • Training set
    • Test set
  • Can you tell me WHY?

Modelling

  • Identify which type of problem we are solving (classification, regression, clustering, market basket analysis, …) - Depending on this, data will be prepared differently, and we’ll have a number of algorithms that can solve that kind of problem to choose from
  • Select the algorithm(s)
    • We cannot know which model is the best performing beforehand, we usually try more than one and compare them
  • Train the model on training data
    • In the training phase, the model learns from the data and understand what caused a certain output to occur
  • Optimize parameters
    • The true scope of training is to find those parameters which yield the best predictive result (i.e. the most accurate)

Deployment

  • Operationalize the model by including it in the client’s business

structure

  • For example it could be that our model’s predictions need to be

provided to the users of an app. In this case the model will have to

comunicate with the app and provide predictions when required

  • Or it might be included in a production pipeline, to decide whether

products are likely to have defects and shouldn’t be delivered

  • It could be used to create alerts, so that our prediction has to be

connected to some signaling device

  • …

r = (Q 3 - Q 1 ) Bottom limit = Q 1 - 1,5 r. Top limit= Q 3 +1,5 r

Boxplot

outlier outlier Top limit Bottom limit mean

Q

Q

One hot encoding (binarization)

Gender M F F M M F M F M M F F Female 0 1 1 0 0 1 0 1 0 0 1 1 Male 1 0 0 1 1 0 1 0 1 1 0 0 Notice:

  • We are adding N new columns, where N is the number of classes of the transformed variable
  • We will only need N- 1 columns to express the transformed variable

Target rate encoding

Notice:

  • We are not adding any additional columns
  • We are using the target variable to calculate the numerical value used to substitute the categories…
  • Where there is unbalancing between classes of the target variable(eg. Fraud/not fraud) ,it’s very difficult for the model to learn to predict the minority class
  • It is thus possible to create new instances of the minority class

• Oversampling with replacement

• SMOTE: Synthetic Minority Over-sampling TEchnique

  • See"SMOTE: Synthetic Minority Over-sampling Technique", Chawla et al., 2002

Create new instances

• Minority cases are just replicated

• It was proven that this doesn’t really help improve the predictive power

of our model, because we’re not really adding information

  • See Ling & Li, 1998; Japkowicz, 2000

Oversampling with replacement

Exercise on data preparation

  • What to note when reading a table
  • Base descriptive statistics
  • Missing data analysis
  • Outliers analysis
  • Constant variables

Descriptive statistics

  • Are there ID-like variables? → can’t include them in a predictive model
  • Mean and standard deviation → is the variable constant?
  • Outliers → are there out-of-range values?
  • Missing values → how many do we have? How to deal with them
  • Classes proportion → do we have the same proportion of observations

among different classes of a variable?