Giter Club home page Giter Club logo

sparse_profile's Introduction

Sparse profile - EDA on sparse data

Module to perform EDA tasks for a classification problem with sparse data
Curently takes only numeric values

Sample usage

import pandas as pd
import numpy as np
from sparse_profile import sparse_profile

df = pd.DataFrame({
        'target' : [1, 1, 1, 1, 0, 0 ,0 ,0, 1, 0],
        'col_1' :  [1, 0, 0, 0, 0, 0, 0, 0, 0, 9],
        'col_2' :  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    })
sProfile = sparse_profile(df, 'target')
print(sProfile.top_gain)

Output maximum gain obtained from each column

col_2    0.422810
col_1    0.074882
dtype: float64
print(sProfile.report_sparsity)

Output percentage of zeros in column

col_1  0.8
col_2  0.1

Various sparse_profile reports can be accessed as attributes of the sparse_profile class object. List of all available attributes:

  • report_sparsity:      pandas dataframe, Percentage of zeros in each column
  • report_distinct:       pandas dataframe, Count of distinct non zero values in each column
  • report_overall:        pandas dataframe, Overall summary of each column (similar to pandas describe())
  • report_non_zero:    pandas dataframe, Summary of each column after removing zeros
  • gain_df:                   pandas dataframe, Relative information gain at decile cutoffs for each column wrt target column
  • auc_df:                    pandas dataframe, AUC of each column wrt target column
  • top_gain:                pandas dataframe, Columns sorted by maximum gain obtained from gain_df

sparse_profile's People

Contributors

domarp avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.