Skip to main content

Feature Engineering

#libraries need to install  

import pandas as pd



# to read excel/csv


df=pd.read_csv("......csv")


# null values sum

df.isnull().sum()


df[df['colname']

Comments

Popular posts from this blog

Feature Importance

 Feature Importance for regression from sklearn . datasets import make _ regression # define dataset X , y = make_regression ( n_samples = 1000 , n_features = 10 , n_informative = 5 , random_state = 1 ) # summarize the dataset print ( X . shape , y . shape ) #linear regression feature importance from sklearn . datasets import make_regression from sklearn . linear_model import LinearRegression from matplotlib import pyplot # define dataset X , y = make_regression ( n_samples = 1000 , n_features = 10 , n_informative = 5 , random_state = 1 ) # define the model model = LinearRegression ( ) # fit the model model . fit ( X , y ) # get importance importance = model . coef _ # summarize feature importance for i , v in enumerate ( importance ) : print ( 'Feature: %0d, Score: %.5f' % ( i , v ) ) # plot feature importance pyplot . bar ( [ x for x in range ( len ( importance ) ) ] , importance ) pyplot . show ( ) feature importance for classification # test cl...

Process of Data Science

 

3 Types of Data in Machine Learning

  Numerical This represents some sort of quantitative measurement. Example: height of people, stock price, page load time etc. It can be further broken up into 2 parts: Discrete data:  This is integer based, often counts of some event. Example: “How many songs do a user like?” or “How many times a coin flipped to “head” ?” Continuous data:  It has an infinite number of possible values. Example: “How much time did it take for a user to buy?” Categorical This represents qualitative data with no apparent inherent mathematical meaning. Example: Yes or No, Sex, Race, Marital Status etc. These can take be assigned numbers like Yes(0) and No(1), but numbers have no mathematical meaning. Ordinal It has features of both numerical and categorical data. But the numbers placed in categories have mathematical meaning. Example: movies rating on 1–5, etc. These values have a mathematical meaning. Therefore, we tend to overlook this step and jump straight into the water.