from sklearn preprocessing import standardscaler from sklearn pipeline import pipeline from sklearn discriminant_analysis import lineardiscriminantanalysis nowwe need to load the pima diabetes dataset as did in previous examplespath " :\pima-indians-diabetes csvheadernames ['preg''plas''pres''skin''test''mass''pedi''age''class'data read_csv(pathnames=headernamesarray data values nextwe will create pipeline with the help of the following codeestimators [estimators append(('standardize'standardscaler())estimators append(('lda'lineardiscriminantanalysis())model pipeline(estimatorsat lastwe are going to evaluate this pipeline and output its accuracy as followskfold kfold(n_splits= random_state= results cross_val_score(modelxycv=kfoldprint(results mean()output the above output is the summary of accuracy of the setup on the dataset modelling ml pipeline and feature extraction data leakage can also happen at feature extraction step of ml model that is why feature extraction procedures should also be restricted to stop data leakage in our training dataset as in the case of data preparationby using ml pipelineswe can prevent this data leakage also featureuniona tool provided by ml pipelines can be used for this purpose example the following is an example in python that demonstrates feature extraction and model evaluation workflow for this purposewe are using pima indian diabetes dataset from sklearn first features will be extracted with pca (principal component analysisthen features will be extracted with statistical analysis after feature extractionresult of multiple feature selection and extraction procedures will be combined by using