pablo14 / funpymodeling Goto Github PK
View Code? Open in Web Editor NEWA package to help data scientist in Exploratory Data Analysis and Data Preparation for ML models
License: MIT License
A package to help data scientist in Exploratory Data Analysis and Data Preparation for ML models
License: MIT License
cross_plot
receives a data frame (data
), a target variable target
and optional a list of variable names to generate the following plots:
An example in R:
cross_plot(data=heart_disease, input=c("age", "oldpeak"), target="has_heart_disease")
It receives a data frame, and two string variable names, and the target variable, and it plots:
As it is shown, it crates two plots (for age and oldpeak), showing the distribution of each variable given the target variable.
Notes:
target
should contain only two different values)Suggested by @aoelvp94 ๐
When you try to install this library in a Google Colab environment it throws an error:
Collecting funpymodeling
Downloading https://files.pythonhosted.org/packages/93/09/73d42d2983e18e28e00e4a33e38eeddd1531e3f83ed91a8224f1816be81f/funpymodeling-0.1.4.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpdq9ovsms Check the logs for full command output.
You can follow this structure: https://github.com/sergiocalde94/pydrift
@sergiocalde94 is a good professional, maybe can help us :)
In funModeling, freq
functions plots the frequency for all the categorical variables.
Below there is a code that do something similar:
import seaborn as sns
import matplotlib.pyplot as plt
sns.set()
tips = sns.load_dataset("tips")
d_plot=tips
fig, ax = plt.subplots(4, 2, figsize=(20, 20))
for variable, subplot in zip(cat_vars(d_plot), ax.flatten()):
sns.countplot(y=d_plot[variable], ax=subplot, order = d_plot[variable].value_counts().index)
for label in subplot.get_xticklabels():
label.set_rotation(90)
It shows:
This data is already calculated by the function freq_tbl
in this package.
If there are more than 100 different categories, the plot should group in the other
or more
category, to avoid crashing.
It should use the todf()
function (from funpymodeling) to convert different datatypes to dataframe so freq_plot
supports numpy 1D/2D, pandas series and 1D/2D lists
Modify corr_pair
function from funpymodeling in order to handle the correlation based on MIC statistic as it is shown below:
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from minepy import MINE
from funpymodeling.exploratory import cat_vars, num_vars
tips = sns.load_dataset('tips')
# Encapsulate from here:
data=tips[num_vars(tips)] # only pre-select numeric variables
data
df_res = pd.DataFrame()
for a,b in col_pairs:
mine = MINE(alpha=0.6, c=15, est="mic_approx")
mine.compute_score(data[a], data[b])
df_res=df_res.append({"v1":a, "v2":b, "mic":mine.mic()}, ignore_index=True)
corr_pair
should support the method='mic'
.
We can make something like this https://sergiocalde94.github.io/pydrift/ (@sergiocalde94 Sorry je, I think that your project is a good example to follow :) )
Implement CI in this project to check/run our future tests
add
Remove this file: https://github.com/pablo14/funpymodeling/blob/master/__init__.py
Take the code of previous script and paste that here: https://github.com/pablo14/funpymodeling/tree/master/funPyModeling
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.