Data Science 👩‍💻 | Data Preprocessing with Orange Tool

#Python Script for Discreetizationiris = Orange.data.Table("iris.tab")disc = Orange.preprocess.Discretize()disc.method = Orange.preprocess.discretize.EqualFreq(n=3)d_iris = disc(iris)print("Original dataset:\n")for e in iris[:3]:print(e)print("Discretized dataset:")for e in d_iris[:3]:print(e)
  • binary variables are transformed into 0.0/1.0 or -1.0/1.0 indicator variables, depending upon the argument zero_based.
  • multinomial variables are treated according to the argument multinomial_treatment.
  • discrete attribute with only one possible value are removed.
#python script for Continuization
import Orangetitanic = Orange.data.Table("titanic")continuizer = Orange.preprocess.Continuize()titanic1 = continuizer(titanic)print("Before Continuization : ",titanic.domain)print("After Continuization : ",titanic1.domain)#Data of row 15 in the before and after continuizationprint("15th row data before : ",titanic[15])print("15th row data after : ",titanic1[15])
#python script for Normalizationfrom Orange.data import Tablefrom Orange.preprocess import Normalizedata = Table("iris")normalizer = Normalize(norm_type=Normalize.NormalizeBySpan)normalized_data = normalizer(data)print("Before Normalization : ",iris[2])print("After Normalization : ",normalized_data[2])
#python script for Randomizefrom Orange.data import Tablefrom Orange.preprocess import Randomizedata = Table("iris")randomizer = Randomize(Randomize.RandomizeClasses)randomized_data = randomizer(data)print("Before randomization : ",iris[2])print("After Randomization : ",randomized_data[2])

--

--

--

2x AWS Certified

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Efficient Digital Transformation — Particle Swarm Optimiser

https://www.peacefullmind.com/2022/03/what-is-vedas-vedas-are-huge-texts.html

Causal Inference in Data Science: Structure of M-Bias with Confounding Adjustment

Don’t Over-fit 2

Understanding the Differences Between Data Fabric and Data Virtualization

Part III: Alpha Vertex Launches Alta to Create Investment Signals From Our Speech, Chaos and…

How to identify the right independent variables for Machine Learning Supervised Algorithms?

A Deep Dive into Neuton

The Three Steps for Model Development in Neuton

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Janvi Ajudiya

Janvi Ajudiya

2x AWS Certified

More from Medium

The Five Number Summary and Its Importance in Preliminary Data Analysis

Top 10 insights from my analysis on GeeksforGeeks dataset

Recognizing Handwritten Digits

Cyclistic bike-share analysis: My Google Data Analytics capstone project