Package: prda
prdaPrda contains packages for data processing, analysis and visualization.Prda ultimate goal is tofill the “last mile” between analysts and packages. During my research practice, I have felt how “learning a package before utilizing” can be time-consuming and exhausting. The resulted inefficiency leads to the creation ofprda.Usagepip install prdaSee details in:https://pypi.org/project/prda/You are welcome to cloneprdafor personal use andpull requestof your modification is super!! encouraged.To utilize prda, you only need to be familiar withpandasas most inputs ispd.DataFrame.Currently with the help ofChatGPT, you can just tailor the input of demonstration code below to your data. And you don't need to be familiar with pandas or even python.Examples of UseageFor Visulizationimportprdaimportpandasaspdimportnumpyasnpdf=pd.DataFrame(data=np.array([np.arange(100)foriinrange(5)]).T,columns=['a','b','c','d','e'])prda.graphic.scatter_3d_html(df,x='a',y='b',z='c',color_hue='d',size_hue='e',title='demo_3d_scatter',filepath='demo_3d_scatter.html')the above code will provide an interactive html figure that look like this:demo_3d_scatter.htmlimportprdaimportpandasaspdimportnumpyasnpdatalen=500indices=np.arange(datalen)col_a=np.arange(0,10,10/datalen)col_b=np.random.randint(3,8,datalen)data=np.array([indices,col_a,col_b]).Tdf=pd.DataFrame(data=data,columns=['idx','a','b'])# drawimportrandompoint_markers={'a':[(indices[i],col_a[i])foriinrandom.sample(list(indices),20)]}prda.graphic.lineplot_html(df,x='idx',y=['a','b'],markpoints=point_markers,filepath='demo_lineplot.html')idxab00.00.006.011.00.023.022.00.044.0............498498.09.966.0499499.09.985.0And code with the above DataFrame will draw anther plot look like this:demo_lineplot.htmlFor Data PreparationCode for filtering continuous variables in data with unique-value threshold of 5:fromprdaimportprepprep.select_continuous_variables(data,unique_threshold=5)For Machine LearningCode for evaluating hyperparameters combinations for a given algorithm using user-specified cross-validation method:fromprda.mlimportevaluationsparam_grid={'k':[4,5,6,7]}evaluations.evaluate_param_combinations(X,y,knn_algorithm,param_grid=param_grid,cv=10,visualize_results=True)For IOA common usage during my research practice is to make well structured folders to save experimential results. With the following function, you only need to think about how you want your files to be structured. Allrelated folderswill be created automatically:fromprdaimportiostreamiostream.create_dirs(['results/experiment1/f1_score.csv','results/experiment1/accuracy.csv','results/experiment2/','results/experiment10/accuracy/','results/experiment10/f1_score/r1.txt',])The above one-line code will create all the folders for you which will have the corresponding structure below, after which you can then store your results without worrying about file structures whatsoever.results/
├── experiment1/
│   ├── f1_score.csv
│   └── accuracy.csv
├── experiment2/
└── experiment10/
    ├── accuracy/
    └── f1_score/
        └── r1.txtTheprda's methods are quite self-explanatory, as a result, we think providing the above demonstration is suffice at the moment. Although the currentprdais far from completion, let along perfection. It is under improvement regularly.Updates2023.5.3 Major UpdatesAdd several easy-to-use functions, includingprep::pca, select_continuous_variables, handle_missing_data, apply_linear_func(row-wisely), andml::match_clusters, evaluate_param_combinations(optimal parameters searching, with base class::sklearn.base.BaseEstimator), etc.2023.11.10 Major UpdatesIncluding a variant of kNN which allows you toallocate customized k(K sequence) for each sample inml::neighbors::VariableKNN. The algorithm behaves as asklearn.classifierwhich means you can employ it directly viafit(·) and predict(·).Add functions, e.g.iostream::create_dirs.