MyBA in Python
Project description
BA_PY
some helpful python scripts. (Basic for All in Python) Mainly contains sci-plot, stats, web-crawler and deeplearing-torch.
contain
mbapy python package
__version__
some version info
base
- TimeCosts: a Wrapper to test cost time
- rand_choose_times: a func
- put_err: a func to print err info
- MyArgs: a class to process **kwargs
- get_wanted_args: a func to create MyArgs from defalut_args and kwargs
file
- detect_byte_coding: decode bytes depending it's encoding
- save_json: func to save obj as json
- read_json: func to read a json file
- save_excel: func to save list[list[str]] as xlsx
- read_excel: func to read xlsx
plot
pandas.dataFrame utils for plot and some simple plot based on plt
- pro_bar_data: func to calcu bar data as mean value and SE value
- pro_bar_data_R: wrapper to calcu bar data by a usr-define func to process value
- sort_df_factors: func
- plot_bar: func to create a stack bar plot with hue style
- get_df_data: func to make extracting data from dataFrame more easily based on df.loc
- plot_positional_hue: wrapper to create a pos-y plot with hue style
- qqplot: func to plot a qq-plot using statsmodels
- save_show: func for save and show plt fig
- get_palette: func, get a seq of hex colors
web
utils for web-crawler
- get_url_page: func for get a html-page
- get_url_page_s: skip error with get_url_page
- get_url_page: func for parsing a html-page with BeautifulSoup
- get_url_page: func for parsing a html-page with BeautifulSoup while getting the page through selenium
- get_between: func for getting a sub-str
- get_between_re: func for getting a sub-str through re
- send_browser_key: func for sending a key to selenium browser
- click_browser: func for making a click in selenium browser
- ThreadsPool: a tiny threads pool for web-crawler task
stats
- pca : func, wrap of sklearn.decomposition.PCA
df
pandas.dataFrame utils for stats
- remove_simi: func for remove similar data in a pandas.Series
- interp: func to make two pandas.Series the same length using numpy.interp
reg
regression
- linear_reg: do linear regression using sklearn.linear_model.LinearRegression
test
some test func(and some of them are just simply using scipy)
- get_interval: func to get interval
- ttest_1samp: scipy.stats.ttest_1samp
- ttest_ind: func to make scipy.stats.ttest_ind with scipy.stats.levene
- ttest_rel: scipy.stats.ttest_rel
- shapiro: scipy.stats.shapiro
- pearsonr: scipy.stats.pearsonr
- chi2_contingency: scipy.stats.chi2_contingency
- f_oneway: scipy.stats.f_oneway
- multicomp_turkeyHSD: do multicomp(turkeyHSD) using statsmodels(pairwise_tukeyhsd)
- multicomp_dunnett: do multicomp(dunnett) using scipy.stats.dunnett
- multicomp_bonferroni: do multicomp(bonferroni) using scikit_posthocs
dl-torch
pytorch utils for deeplearning
bb
basic blocks : tiny network structures
- NonLocalBlock: Non-local Neural Networks (CVPR 2018)
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness, just import flash_attn package
- HydraAttention: Efficient Attention with Many Heads, arXiv:2209.07484v1
data
utils for dataset loading
- denarmalize_img: func, denarmalize a tensor type img.
- DataSetRAM: a class to load dataset to memory with some options.
loss
some loss function
- AsymmetricLossOptimized, just from Alibaba-MIIL/ASL
m
model : deeplearning model constructed with basic blocks
utils
deeplearning training utils
- Mprint: logging tools
- GlobalSettings: global setting tools for deeplearning pipeline
- init_model_parameter: func, initialize model weigths
- adjust_learning_rate: from MoCo
- format_secs: func, format secs from a sum secs to h,m,s
- AverageMeter: from MoCo
- ProgressMeter: from MoCo
- TimeLast: calcu time last
- save_checkpoint: func, save checkpoint to a pytorch style file
- resume: func, load checkpoint from a pytorch style file
- VizLine: func, draw a line by visdom
- re_viz_from_json_record: load visualization data and re-draw them using visdom
examples
file
some file utils things
plot
- stack bar plot with hue style
torch
- seq2seq core from bentrevett/pytorch-seq2seq
web/crawler
- chaoxin ppt multi threads downloader (jpg->pdf)
- wujin search http://www.basechem.org
- chemSub search http://chemsub.online.fr/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mbapy-0.0.13.tar.gz
(37.7 kB
view hashes)