Skip to content

Commit

Permalink
latest version 0.1.807
Browse files Browse the repository at this point in the history
  • Loading branch information
AutoViML committed Apr 1, 2024
1 parent c261b13 commit 0fe20dc
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 28 deletions.
26 changes: 17 additions & 9 deletions autoviz/AutoViz_Holo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ def warn(*args, **kwargs):
import logging
logging.getLogger("param").setLevel(logging.ERROR)
import warnings
#warnings.simplefilter(action='ignore', category=BokehUserWarning)
warnings.filterwarnings("ignore")
from sklearn.exceptions import DataConversionWarning
warnings.filterwarnings("ignore")
### These Bokeh warnings are useless => leave them alone for now!
### from bokeh.util.warnings import BokehUserWarning
## warnings.simplefilter(action='ignore', category=BokehUserWarning)
warnings.filterwarnings(action='ignore', category=DataConversionWarning)
####################################################################################
import matplotlib
Expand Down Expand Up @@ -53,7 +55,7 @@ def warn(*args, **kwargs):
from .classify_method import classify_columns
##########################################################################################
def ensure_hvplot_imported():
global hv, opts, pn, pnw, INLINE, classify_columns
global hv, opts, pn, pnw, INLINE
try:
# Import main modules
import hvplot.pandas
Expand Down Expand Up @@ -211,6 +213,7 @@ def AutoViz_Holo(filename, sep=',', depVar='', dfte=None, header=0, verbose=0,
ls_objects.append(drawobj3)
### kdeplot is the only time you send in ls_objects since it has to be returned with 2 objects ###
try:
#### This KDE draws only the distribution of the target variable!
drawobj4 = draw_kdeplot_hv(dfin, cats, nums, chart_format, problem_type, dep, ls_objects, mk_dir, verbose)
if not drawobj4:
### if it is not blank, then treat it as ls_objects ###
Expand Down Expand Up @@ -322,6 +325,8 @@ def draw_kdeplot_hv(dfin, cats, nums, chart_format, problem_type, dep, ls_object
width_size = 600
height_size = 400
hv_all = None
transparent = 0.5
color='lightblue'
########################################################################################
def return_dynamic_objects(dfout, dep, title='Distribution of Target variable'):
width_size = 600
Expand All @@ -332,14 +337,14 @@ def return_dynamic_objects(dfout, dep, title='Distribution of Target variable'):
height=height_size, width=width_size,xrotation=70)
drawobj42 = pdf2.hvplot(kind='bar', color='lightgreen', title=title)
return (drawobj41+drawobj42)

if problem_type.endswith('Classification'):
colors = cycle('brycgkbyrcmgkbyrcmgkbyrcmgkbyr')
dmap = hv.DynamicMap(return_dynamic_objects(dfin, dep, title='Percent Distribution of Target variable'
).opts(shared_axes=False).opts(title='Histogram and KDE of Target = %s' %dep)).opts(
height=height_size, width=width_size)
dmap.opts(framewise=True,axiswise=True) ## both must be True for your charts to have dynamically varying axes!
hv_all = pn.panel.HoloViews(dmap)#, sizing_mode="stretch_both")
hv_all = pn.pane.HoloViews(dmap)#, sizing_mode="stretch_both")
#ls_objects.append(drawobj41)
#ls_objects.append(drawobj42)
else:
Expand All @@ -349,9 +354,10 @@ def return_dynamic_objects(dfout, dep, title='Distribution of Target variable'):
### there is no target variable to draw ######
return ls_objects
else:
dmap = hv.DynamicMap(return_dynamic_objects(dfin, dep, title=f'Histogram and KDE of Target = {dep}')).opts(width=width_size)
dmap.opts(framewise=True,axiswise=True) ## both must be True for your charts to have dynamically varying axes!
hv_all = pn.panel.HoloViews(dmap)
dmap = hv.Distribution(dfin[dep]).opts(color=color,
height=height_size, width=width_size, alpha=transparent,
title='KDE (Distribution) Plot of Target Variable')
hv_all = pn.pane.HoloViews(dmap)
#ls_objects.append(drawobj41)
#ls_objects.append(drawobj42)
#### In this case we are using multiple objects in panel ###
Expand Down Expand Up @@ -879,6 +885,7 @@ def draw_violinplot_hv(dft, dep, nums,chart_format, modeltype='Regression',
drawobjv_list = [] ## this keeps track of the actual values
drawobj_list = [] ## this keeps track of the names
counter = 0
string_size = 10
for i in range(0,df_p.shape[1],iter_limit):
new_end = i+iter_limit
#print('i = ',i,"new end = ", new_end)
Expand All @@ -890,9 +897,10 @@ def draw_violinplot_hv(dft, dep, nums,chart_format, modeltype='Regression',
#print(title_string )
conti = nums[i:new_end]
######################### Add Standard Scaling here ##################################
short_conti = [x[:string_size] for x in conti]
from sklearn.preprocessing import StandardScaler
SS = StandardScaler()
data = pd.DataFrame(SS.fit_transform(dft[conti]),columns=conti)
data = pd.DataFrame(SS.fit_transform(dft[conti]),columns=short_conti)
var_name = 'drawobjv_list['+str(counter)+']'
drawobj_list.append(var_name)
drawobjv_list.append(var_name)
Expand Down
5 changes: 4 additions & 1 deletion autoviz/AutoViz_Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def draw_distplot(dft, cat_bools, conti, verbose,chart_format,problem_type,dep=N
width_size = 15 #### this is to control the width of chart as well as number of categories to display
height_size = 5
gap = 0.4 #### This controls the space between rows ######
pdb.set_trace()

if dep is None or dep=='' or problem_type == 'Regression':
image_count = 0
transparent = 0.7
Expand Down Expand Up @@ -1652,17 +1652,20 @@ def load_file_dataframe(dataname, sep=",", header=0, verbose=0, nrows=None,parse
return None
##########################################################################################
import copy
import pdb
def classify_print_vars(filename,sep, max_rows_analyzed, max_cols_analyzed,
depVar='',dfte=None, header=0,verbose=0):
corr_limit = 0.7 ### This limit represents correlation above this, vars will be removed

start_time=time.time()

if filename:
dataname = copy.deepcopy(filename)
parse_dates = True
else:
dataname = copy.deepcopy(dfte)
parse_dates = False

dfte = load_file_dataframe(dataname, sep=sep, header=header, verbose=verbose,
nrows=max_rows_analyzed, parse_dates=parse_dates)

Expand Down
11 changes: 5 additions & 6 deletions requirements-py310.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
xlrd
wordcloud
numpy>=1.25.0 # Adjust as necessary
pyamg
pandas
nltk
emoji
textblob
matplotlib>=3.7.4 # Adjust as necessary
matplotlib<=3.7.4
seaborn>=0.12.2
scikit-learn
statsmodels
holoviews>=1.16.0
bokeh>=2.4.2 # Ensure compatibility
hvplot>=0.7.3 # Ensure compatibility
panel>=0.12.6
xgboost>=0.82,<1.7
fsspec>=0.8.3
typing-extensions>=4.1.1
pandas-dq>=1.29
numpy>=1.25.0
hvplot>=0.9.2
panel>=1.4.0
holoviews~=1.16.0
11 changes: 5 additions & 6 deletions requirements-py311.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
xlrd
wordcloud
numpy>=1.25.0 # Adjust as necessary
pyamg
pandas
nltk
emoji
textblob
matplotlib>=3.7.4 # Adjust as necessary
matplotlib<=3.7.4
seaborn>=0.12.2
scikit-learn
statsmodels
holoviews>=1.15.3 # For Python 3.11 support
bokeh>=2.4.2 # Ensure compatibility
hvplot>=0.7.3 # Ensure compatibility
panel>=0.12.6
xgboost>=0.82,<1.7
fsspec>=0.8.3
typing-extensions>=4.1.1
pandas-dq>=1.29
numpy>=1.25.0
hvplot>=0.9.2
panel>=1.4.0
holoviews~=1.15.3
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
xlrd
wordcloud
numpy<1.25.0
pyamg
pandas
nltk
Expand All @@ -10,11 +9,12 @@ matplotlib<=3.7.4
seaborn>=0.12.2
scikit-learn
statsmodels
holoviews~=1.14.9
bokeh~=2.4.2
hvplot~=0.7.3
panel>=0.12.6
xgboost>=0.82,<1.7
fsspec>=0.8.3
typing-extensions>=4.1.1
pandas-dq>=1.29
pandas-dq>=1.29
numpy<1.25.0
hvplot~=0.7.3
panel~=0.14.4
holoviews~=1.14.9
param==1.13.0

0 comments on commit 0fe20dc

Please sign in to comment.