Skip to content

Commit 1ef5dc2

Browse files
committed
Update CART_LawSchoolAdmissionBar.ipynb
1 parent e4fec80 commit 1ef5dc2

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

notebooks/CART_LawSchoolAdmissionBar.ipynb

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,10 @@
331331
"\n",
332332
"A subset of the [Law School Admission Bar*](https://www.kaggle.com/datasets/danofer/law-school-admissions-bar-passage) dataset is used as a demo. Synthetic data will be generated for the following columns: \n",
333333
"\n",
334-
"- sex: student gender, i.e. 1 (male), 2 (female)\n",
335-
"- race1: race, i.e. asian, black, hispanic, white, other\n",
336-
"- ugpa: The student's undergraduate GPA, continous variable;\n",
337-
"- bar: Ground truth label indicating whether or not the student passed the bar, i.e. passed 1st time, passed 2nd time, failed, non-graduated\n",
334+
"[table]\n",
338335
"\n",
339336
"The CART method is used to generate the synthetic data. CART generally produces higher quality synthetic datasets, but might not run on datasets with categorical variables with 20+ categories. Use Gaussian Copula in those cases.\n",
340337
"\n",
341-
"_info box:_ The CART (Classification and Regression Trees) method generates synthetic data by learning patterns from real data through decision trees that splits data into homogeneous groups based on feature values one variable at a time. It uses these groups to generate plausible synthetic values for that variable.\n",
342-
"\n",
343338
"*The original paper can be found [here](https://files.eric.ed.gov/fulltext/ED469370.pdf)."
344339
]
345340
},
@@ -443,7 +438,7 @@
443438
},
444439
{
445440
"cell_type": "code",
446-
"execution_count": 6,
441+
"execution_count": 14,
447442
"metadata": {},
448443
"outputs": [
449444
{
@@ -459,6 +454,7 @@
459454
}
460455
],
461456
"source": [
457+
"# missing data\n",
462458
"print(df.isnull().sum())"
463459
]
464460
},
@@ -531,28 +527,29 @@
531527
"source": [
532528
"**UI text #3**\n",
533529
"\n",
534-
"You specified to {remove/impute} missing data. Based on the type of missing data, we recommend to either impute of remove. See the info box for more information.\n",
530+
"For Missing At Random (MAR) and Missing Not At Random (MNAR) data, we recommend to impute the missing data. For Missing Completely At Random (MCAR), we recommend to remove the missing data. See the info box for more information.\n",
535531
"\n",
536532
"_info box:_\n",
537533
"\n",
538534
"MCAR, MAR, and MNAR are terms used to describe different mechanisms of missing data:\n",
539535
"\n",
540536
"1. **MCAR (Missing Completely At Random)**:\n",
541-
"- The probability of data being missing is completely independent of both observed and unobserved data.\n",
537+
"- The probability of data being missing is completely independent of both observed and unobserved data. \n",
542538
"- There is no systematic pattern to the missingness.\n",
543539
"- Example: A survey respondent accidentally skips a question due to a printing error.\n",
540+
"- Recommendation: remove missing data.\n",
544541
"\n",
545542
"2. **MAR (Missing At Random)**:\n",
546543
"- The probability of data being missing is related to the observed data but not the missing data itself.\n",
547544
"- The missingness can be predicted by other variables in the dataset.\n",
548545
"- Example: Students' test scores are missing, but the missingness is related to their attendance records.\n",
546+
"- Recommendation: impute missing data.\n",
549547
"\n",
550548
"3. **MNAR (Missing Not At Random)**:\n",
551-
"- The probability of data being missing is related to the missing data itself.\n",
549+
"- The probability of data being missing is related to the missing data itself. \n",
552550
"- There is a systematic pattern to the missingness that is related to the unobserved data.\n",
553551
"- Example: Patients with more severe symptoms are less likely to report their symptoms, leading to missing data that is related to the severity of the symptoms.\n",
554-
"\n",
555-
"For MAR and MNAR, synthetic data generation using imputation is recommended. For MNAR, synthetic data generation with removing the missing data is recommended."
552+
"- Recommendation: impute missing data."
556553
]
557554
},
558555
{
@@ -595,12 +592,10 @@
595592
"\n",
596593
"1. Validates the input data;\n",
597594
"2. Stores the original column order;\n",
598-
"3. Calls the _preprocess method to handle encoding and scaling:\n",
595+
"3. Encoding and scaling:\n",
599596
"* Encodes categorical columns using LabelEncoder or OneHotEncoder;\n",
600597
"* Scales numerical columns using StandardScaler;\n",
601-
"* Converts boolean columns to integers.\n",
602-
"\n",
603-
"The processed data is then returned."
598+
"* Converts boolean columns to integers."
604599
]
605600
},
606601
{

0 commit comments

Comments
 (0)