Skip to content

Commit 0fe20dc

Browse files
committed
latest version 0.1.807
1 parent c261b13 commit 0fe20dc

5 files changed

+37
-28
lines changed

autoviz/AutoViz_Holo.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ def warn(*args, **kwargs):
1616
import logging
1717
logging.getLogger("param").setLevel(logging.ERROR)
1818
import warnings
19-
#warnings.simplefilter(action='ignore', category=BokehUserWarning)
20-
warnings.filterwarnings("ignore")
2119
from sklearn.exceptions import DataConversionWarning
20+
warnings.filterwarnings("ignore")
21+
### These Bokeh warnings are useless => leave them alone for now!
22+
### from bokeh.util.warnings import BokehUserWarning
23+
## warnings.simplefilter(action='ignore', category=BokehUserWarning)
2224
warnings.filterwarnings(action='ignore', category=DataConversionWarning)
2325
####################################################################################
2426
import matplotlib
@@ -53,7 +55,7 @@ def warn(*args, **kwargs):
5355
from .classify_method import classify_columns
5456
##########################################################################################
5557
def ensure_hvplot_imported():
56-
global hv, opts, pn, pnw, INLINE, classify_columns
58+
global hv, opts, pn, pnw, INLINE
5759
try:
5860
# Import main modules
5961
import hvplot.pandas
@@ -211,6 +213,7 @@ def AutoViz_Holo(filename, sep=',', depVar='', dfte=None, header=0, verbose=0,
211213
ls_objects.append(drawobj3)
212214
### kdeplot is the only time you send in ls_objects since it has to be returned with 2 objects ###
213215
try:
216+
#### This KDE draws only the distribution of the target variable!
214217
drawobj4 = draw_kdeplot_hv(dfin, cats, nums, chart_format, problem_type, dep, ls_objects, mk_dir, verbose)
215218
if not drawobj4:
216219
### if it is not blank, then treat it as ls_objects ###
@@ -322,6 +325,8 @@ def draw_kdeplot_hv(dfin, cats, nums, chart_format, problem_type, dep, ls_object
322325
width_size = 600
323326
height_size = 400
324327
hv_all = None
328+
transparent = 0.5
329+
color='lightblue'
325330
########################################################################################
326331
def return_dynamic_objects(dfout, dep, title='Distribution of Target variable'):
327332
width_size = 600
@@ -332,14 +337,14 @@ def return_dynamic_objects(dfout, dep, title='Distribution of Target variable'):
332337
height=height_size, width=width_size,xrotation=70)
333338
drawobj42 = pdf2.hvplot(kind='bar', color='lightgreen', title=title)
334339
return (drawobj41+drawobj42)
335-
340+
336341
if problem_type.endswith('Classification'):
337342
colors = cycle('brycgkbyrcmgkbyrcmgkbyrcmgkbyr')
338343
dmap = hv.DynamicMap(return_dynamic_objects(dfin, dep, title='Percent Distribution of Target variable'
339344
).opts(shared_axes=False).opts(title='Histogram and KDE of Target = %s' %dep)).opts(
340345
height=height_size, width=width_size)
341346
dmap.opts(framewise=True,axiswise=True) ## both must be True for your charts to have dynamically varying axes!
342-
hv_all = pn.panel.HoloViews(dmap)#, sizing_mode="stretch_both")
347+
hv_all = pn.pane.HoloViews(dmap)#, sizing_mode="stretch_both")
343348
#ls_objects.append(drawobj41)
344349
#ls_objects.append(drawobj42)
345350
else:
@@ -349,9 +354,10 @@ def return_dynamic_objects(dfout, dep, title='Distribution of Target variable'):
349354
### there is no target variable to draw ######
350355
return ls_objects
351356
else:
352-
dmap = hv.DynamicMap(return_dynamic_objects(dfin, dep, title=f'Histogram and KDE of Target = {dep}')).opts(width=width_size)
353-
dmap.opts(framewise=True,axiswise=True) ## both must be True for your charts to have dynamically varying axes!
354-
hv_all = pn.panel.HoloViews(dmap)
357+
dmap = hv.Distribution(dfin[dep]).opts(color=color,
358+
height=height_size, width=width_size, alpha=transparent,
359+
title='KDE (Distribution) Plot of Target Variable')
360+
hv_all = pn.pane.HoloViews(dmap)
355361
#ls_objects.append(drawobj41)
356362
#ls_objects.append(drawobj42)
357363
#### In this case we are using multiple objects in panel ###
@@ -879,6 +885,7 @@ def draw_violinplot_hv(dft, dep, nums,chart_format, modeltype='Regression',
879885
drawobjv_list = [] ## this keeps track of the actual values
880886
drawobj_list = [] ## this keeps track of the names
881887
counter = 0
888+
string_size = 10
882889
for i in range(0,df_p.shape[1],iter_limit):
883890
new_end = i+iter_limit
884891
#print('i = ',i,"new end = ", new_end)
@@ -890,9 +897,10 @@ def draw_violinplot_hv(dft, dep, nums,chart_format, modeltype='Regression',
890897
#print(title_string )
891898
conti = nums[i:new_end]
892899
######################### Add Standard Scaling here ##################################
900+
short_conti = [x[:string_size] for x in conti]
893901
from sklearn.preprocessing import StandardScaler
894902
SS = StandardScaler()
895-
data = pd.DataFrame(SS.fit_transform(dft[conti]),columns=conti)
903+
data = pd.DataFrame(SS.fit_transform(dft[conti]),columns=short_conti)
896904
var_name = 'drawobjv_list['+str(counter)+']'
897905
drawobj_list.append(var_name)
898906
drawobjv_list.append(var_name)

autoviz/AutoViz_Utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def draw_distplot(dft, cat_bools, conti, verbose,chart_format,problem_type,dep=N
749749
width_size = 15 #### this is to control the width of chart as well as number of categories to display
750750
height_size = 5
751751
gap = 0.4 #### This controls the space between rows ######
752-
pdb.set_trace()
752+
753753
if dep is None or dep=='' or problem_type == 'Regression':
754754
image_count = 0
755755
transparent = 0.7
@@ -1652,17 +1652,20 @@ def load_file_dataframe(dataname, sep=",", header=0, verbose=0, nrows=None,parse
16521652
return None
16531653
##########################################################################################
16541654
import copy
1655+
import pdb
16551656
def classify_print_vars(filename,sep, max_rows_analyzed, max_cols_analyzed,
16561657
depVar='',dfte=None, header=0,verbose=0):
16571658
corr_limit = 0.7 ### This limit represents correlation above this, vars will be removed
16581659

16591660
start_time=time.time()
1661+
16601662
if filename:
16611663
dataname = copy.deepcopy(filename)
16621664
parse_dates = True
16631665
else:
16641666
dataname = copy.deepcopy(dfte)
16651667
parse_dates = False
1668+
16661669
dfte = load_file_dataframe(dataname, sep=sep, header=header, verbose=verbose,
16671670
nrows=max_rows_analyzed, parse_dates=parse_dates)
16681671

requirements-py310.txt

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
xlrd
22
wordcloud
3-
numpy>=1.25.0 # Adjust as necessary
43
pyamg
54
pandas
65
nltk
76
emoji
87
textblob
9-
matplotlib>=3.7.4 # Adjust as necessary
8+
matplotlib<=3.7.4
109
seaborn>=0.12.2
1110
scikit-learn
1211
statsmodels
13-
holoviews>=1.16.0
14-
bokeh>=2.4.2 # Ensure compatibility
15-
hvplot>=0.7.3 # Ensure compatibility
16-
panel>=0.12.6
1712
xgboost>=0.82,<1.7
1813
fsspec>=0.8.3
1914
typing-extensions>=4.1.1
2015
pandas-dq>=1.29
16+
numpy>=1.25.0
17+
hvplot>=0.9.2
18+
panel>=1.4.0
19+
holoviews~=1.16.0

requirements-py311.txt

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
xlrd
22
wordcloud
3-
numpy>=1.25.0 # Adjust as necessary
43
pyamg
54
pandas
65
nltk
76
emoji
87
textblob
9-
matplotlib>=3.7.4 # Adjust as necessary
8+
matplotlib<=3.7.4
109
seaborn>=0.12.2
1110
scikit-learn
1211
statsmodels
13-
holoviews>=1.15.3 # For Python 3.11 support
14-
bokeh>=2.4.2 # Ensure compatibility
15-
hvplot>=0.7.3 # Ensure compatibility
16-
panel>=0.12.6
1712
xgboost>=0.82,<1.7
1813
fsspec>=0.8.3
1914
typing-extensions>=4.1.1
2015
pandas-dq>=1.29
16+
numpy>=1.25.0
17+
hvplot>=0.9.2
18+
panel>=1.4.0
19+
holoviews~=1.15.3

requirements.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
xlrd
22
wordcloud
3-
numpy<1.25.0
43
pyamg
54
pandas
65
nltk
@@ -10,11 +9,12 @@ matplotlib<=3.7.4
109
seaborn>=0.12.2
1110
scikit-learn
1211
statsmodels
13-
holoviews~=1.14.9
14-
bokeh~=2.4.2
15-
hvplot~=0.7.3
16-
panel>=0.12.6
1712
xgboost>=0.82,<1.7
1813
fsspec>=0.8.3
1914
typing-extensions>=4.1.1
20-
pandas-dq>=1.29
15+
pandas-dq>=1.29
16+
numpy<1.25.0
17+
hvplot~=0.7.3
18+
panel~=0.14.4
19+
holoviews~=1.14.9
20+
param==1.13.0

0 commit comments

Comments
 (0)