Package: cardea
CardeaThis library is under development. Please contactdai-lab@mit.eduor any of the contributors for more information.License:MITDevelopment Status:Pre-AlphaHomepage:https://github.com/MLBazaar/CardeaDocumentation:https://MLBazaar.github.io/CardeaOverviewCardea is a machine learning library built on top ofschemasthat support electronic health records (EHR). The library uses a number of AutoML tools developed underThe Human Data Interaction ProjectatData to AI Lab at MIT.Our goal is to provide an easy to use library to develop machine learning models from electronic health records. A typical usage of this library will involve interacting with our API to develop prediction models.A series of sequential processes are applied to build a machine learning model. These processes are triggered using our following APIs to perform the following:loading data using the automaticdata assembler, where we capture data from its raw format into an entityset representation.data labelingwhere we create label times that generates (1) the time index that indicates the timespan for which I create my features (2) the encoded labels of the prediction task. this is essential for our feature engineering phase.featurizationfor which we automatically feature engineer our data to generate a feature matrix.lastly, we build, train, and tune our machine learning model using themodelingcomponent.to learn more about how we structure our machine learning process and our data structures, read our documentationhere.QuickstartInstall with pipThe easiest and recommended way to installCardeais usingpip:pipinstallcardeaThis will pull and install the latest stable release fromPyPi.QuickstartIn this short tutorial we will guide you through a series of steps that will help you get Cardea started.First, load the core class to work with:fromcardeaimportCardeacardea=Cardea()We then seamlessly plug in our data. Here in this example, we are loading a pre-processed version of theKaggle dataset: Medical Appointment No Shows.
To use this dataset download the data from here then unzip it in the root directory, or run the command:curl-Ohttps://dai-cardea.s3.amazonaws.com/kaggle.zip&&unzip-dkagglekaggle.zipTo load the data, supply thedatato the loader using the following command:cardea.load_entityset(data='kaggle'):bulb: To load local data, pass the folder path todata.To verify that the data has been loaded, you can find the loaded entityset by viewingcardea.eswhich should output the following:Entityset:kaggleEntities:Address[Rows:81,Columns:2]Appointment_Participant[Rows:6100,Columns:2]Appointment[Rows:110527,Columns:5]CodeableConcept[Rows:4,Columns:2]Coding[Rows:3,Columns:2]Identifier[Rows:227151,Columns:1]Observation[Rows:110527,Columns:3]Patient[Rows:6100,Columns:4]Reference[Rows:6100,Columns:1]Relationships:Appointment_Participant.actor->Reference.identifierAppointment.participant->Appointment_Participant.object_idCodeableConcept.coding->Coding.object_idObservation.code->CodeableConcept.object_idObservation.subject->Reference.identifierPatient.address->Address.object_idThe output shown represents the entityset data structure wherecardea.esis composed of entities and relationships. You can read more about entitysetshere.From there, you can select the prediction problem you aim to solve by specifying the name of the class, which in return gives us thelabel_timesof the problem.label_times=cardea.select_problem('MissedAppointment')label_timessummarizes for each instance in the dataset (1) what is its corresponding label of the instance and (2) what is the time index that indicates the timespan allowed for calculating features that pertain to each instance in the dataset.cutoff_timeinstance_idlabel02015-11-1007:13:565030230noshow12015-12-0308:17:285122866fulfilled22015-12-0710:40:595134197fulfilled32015-12-0710:42:425134220noshow42015-12-0710:43:015134223noshowYou can read more aboutlabel_timeshere.Then, you can perform the AutoML steps and take advantage of Cardea.Cardea extracts features through automated feature engineering by supplying thelabel_timespertaining to the problem you aim to solvefeature_matrix=cardea.generate_features(label_times[:1000]):warning: Featurizing the data might take a while depending on the size of the data. For demonstration, we only featurize the first 1000 records.Once we have the features, we can now split the data into training and testingy=list(feature_matrix.pop('label'))X=feature_matrix.valuesX_train,X_test,y_train,y_test=cardea.train_test_split(X,y,test_size=0.2,shuffle=True)Now that we have our feature matrix properly divided, we can use to train our machine learning pipeline, Modeling, optimizing hyperparameters and finding the most optimal modelcardea.select_pipeline('Random Forest')cardea.fit(X_train,y_train)y_pred=cardea.predict(X_test)Finally, you can evaluate the performance of the modelcardea.evaluate(X,y,test_size=0.2,shuffle=True)which returns the scoring metric depending on the type of problem{'Accuracy':0.75,'F1 Macro':0.5098039215686274,'Precision':0.5183001719479243,'Recall':0.5123528436411872}CitationIf you use Cardea for your research, please consider citing the following paper:Sarah Alnegheimish; Najat Alrashed; Faisal Aleissa; Shahad Althobaiti; Dongyu Liu; Mansour Alsaleh; Kalyan Veeramachaneni.Cardea: An Open Automated Machine Learning Framework for Electronic Health Records.IEEE DSAA 2020.@inproceedings{alnegheimish2020cardea,title={Cardea:AnOpenAutomatedMachineLearningFrameworkforElectronicHealthRecords},author={Alnegheimish,SarahandAlrashed,NajatandAleissa,FaisalandAlthobaiti,ShahadandLiu,DongyuandAlsaleh,MansourandVeeramachaneni,Kalyan},booktitle={2020IEEE7thInternationalConferenceonDataScienceandAdvancedAnalytics(DSAA)},pages={536--545},year={2020},organization={IEEE}}History0.1.2 - 2021-02-19New Modeler componentInvalid default metric name -Issue #82by @ChengFRParameter 'presort' in 'sklearn.ensemble.GradientBoostingClassifier' has been deprecated since sklearn v0.22 -Issue #80by @ChengFRLoading demo data in either FHIR or MIMIC format -Issue #79by @sarahmishFix a customized primitive: Categorizer -Issue #75by @ChengFRUpdate Cardea Class -Issue #73by @sarahmishClean up the modeler -Issue #71by @ChengFRUpdate and clean up the dependencies -Issue #70by @ChengFR0.1.1 - 2020-12-11Benchmark frameworkLink google colab to Cardea and add badge README.md -Issue #67by @sarahmishModeler load pipelines instead of lists of primitives enhancement -Issue #65by @ChengFRBenchmark testing apis enhancement -Issue #64by @ChengFRUpdate documentation theme enhancement -Issue #62by @sarahmishPrimitive setup enhancement -Issue #61by @sarahmish & @ChengFR0.1.0 - 2020-09-15Release on PyPI:https://pypi.org/project/cardea/Analysis notebooks enhancement -Issue #58by @sarahmishMIMIC III data loader enhancement -Issue #57by @sarahmishFreeze package on analysis compatibility -Issue #55by @sarahmish