|
510 | 510 | "name": "stderr", |
511 | 511 | "output_type": "stream", |
512 | 512 | "text": [ |
513 | | - "/var/folders/v8/64zc34sn3b95klfm660085h80000gn/T/ipykernel_74614/158703987.py:5: SettingWithCopyWarning: \n", |
| 513 | + "C:\\Users\\maike\\AppData\\Local\\Temp\\ipykernel_33120\\158703987.py:5: SettingWithCopyWarning: \n", |
514 | 514 | "A value is trying to be set on a copy of a slice from a DataFrame.\n", |
515 | 515 | "Try using .loc[row_indexer,col_indexer] = value instead\n", |
516 | 516 | "\n", |
517 | 517 | "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", |
518 | 518 | " real_data[column] = label_encoders[column].fit_transform(real_data[column])\n", |
519 | | - "/var/folders/v8/64zc34sn3b95klfm660085h80000gn/T/ipykernel_74614/158703987.py:5: SettingWithCopyWarning: \n", |
| 519 | + "C:\\Users\\maike\\AppData\\Local\\Temp\\ipykernel_33120\\158703987.py:5: SettingWithCopyWarning: \n", |
520 | 520 | "A value is trying to be set on a copy of a slice from a DataFrame.\n", |
521 | 521 | "Try using .loc[row_indexer,col_indexer] = value instead\n", |
522 | 522 | "\n", |
|
633 | 633 | }, |
634 | 634 | { |
635 | 635 | "cell_type": "code", |
636 | | - "execution_count": 8, |
| 636 | + "execution_count": 11, |
637 | 637 | "metadata": {}, |
638 | 638 | "outputs": [], |
639 | 639 | "source": [ |
|
644 | 644 | "from synthpop import NUM_COLS_DTYPES\n", |
645 | 645 | "from synthpop.processor import NAN_KEY\n", |
646 | 646 | "from synthpop.method import CART_METHOD, METHODS_MAP, NA_METHODS\n", |
| 647 | + "import numpy as np\n", |
647 | 648 | "\n", |
648 | 649 | "class Synthpop:\n", |
649 | 650 | " def __init__(self,\n", |
|
748 | 749 | }, |
749 | 750 | { |
750 | 751 | "cell_type": "code", |
751 | | - "execution_count": 9, |
| 752 | + "execution_count": null, |
752 | 753 | "metadata": {}, |
753 | 754 | "outputs": [], |
754 | 755 | "source": [ |
|
758 | 759 | "from synthpop.method import DEFAULT_METHODS_MAP, INIT_METHODS_MAP, CONT_TO_CAT_METHODS_MAP\n", |
759 | 760 | "from synthpop.method import ALL_METHODS, INIT_METHODS, DEFAULT_METHODS, NA_METHODS\n", |
760 | 761 | "from synthpop.processor import NAN_KEY\n", |
761 | | - "\n", |
| 762 | + "import numpy as np\n", |
762 | 763 | "\n", |
763 | 764 | "INIT_STEP = 'init'\n", |
764 | 765 | "PROCESSOR_STEP = 'processor'\n", |
|
1075 | 1076 | "metadata": {}, |
1076 | 1077 | "outputs": [ |
1077 | 1078 | { |
1078 | | - "name": "stdout", |
1079 | | - "output_type": "stream", |
1080 | | - "text": [ |
1081 | | - "train_sex\n", |
1082 | | - "train_race1\n", |
1083 | | - "train_ugpa\n", |
1084 | | - "train_bar\n" |
| 1079 | + "ename": "NameError", |
| 1080 | + "evalue": "name 'np' is not defined", |
| 1081 | + "output_type": "error", |
| 1082 | + "traceback": [ |
| 1083 | + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
| 1084 | + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", |
| 1085 | + "Cell \u001b[1;32mIn[10], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Initialize Synthpop object with method 'cart'\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m spop \u001b[38;5;241m=\u001b[39m \u001b[43mSynthpop\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcart\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Fit the Synthpop model\u001b[39;00m\n\u001b[0;32m 5\u001b[0m spop\u001b[38;5;241m.\u001b[39mfit(real_data, dtypes\u001b[38;5;241m=\u001b[39mdtypes_dict)\n", |
| 1086 | + "Cell \u001b[1;32mIn[8], line 22\u001b[0m, in \u001b[0;36mSynthpop.__init__\u001b[1;34m(self, method, visit_sequence, proper, cont_na, smoothing, default_method, numtocat, catgroups, seed)\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 11\u001b[0m method\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 12\u001b[0m visit_sequence\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 20\u001b[0m seed\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m 21\u001b[0m \u001b[38;5;66;03m# initialise the validator and processor\u001b[39;00m\n\u001b[1;32m---> 22\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvalidator \u001b[38;5;241m=\u001b[39m \u001b[43mValidator\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 23\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprocessor \u001b[38;5;241m=\u001b[39m Processor(\u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m 25\u001b[0m \u001b[38;5;66;03m# initialise arguments\u001b[39;00m\n", |
| 1087 | + "Cell \u001b[1;32mIn[9], line 23\u001b[0m, in \u001b[0;36mValidator.__init__\u001b[1;34m(self, spop)\u001b[0m\n\u001b[0;32m 20\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, spop):\n\u001b[0;32m 21\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mspop \u001b[38;5;241m=\u001b[39m spop\n\u001b[0;32m 22\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mattributes_types \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmethod\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mlist\u001b[39m),\n\u001b[1;32m---> 23\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvisit_sequence\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[43mnp\u001b[49m\u001b[38;5;241m.\u001b[39mndarray, \u001b[38;5;28mlist\u001b[39m),\n\u001b[0;32m 24\u001b[0m \u001b[38;5;66;03m# 'predictor_matrix': (NONE_TYPE,),\u001b[39;00m\n\u001b[0;32m 25\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mproper\u001b[39m\u001b[38;5;124m'\u001b[39m: (\u001b[38;5;28mbool\u001b[39m,),\n\u001b[0;32m 26\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcont_na\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[38;5;28mdict\u001b[39m),\n\u001b[0;32m 27\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msmoothing\u001b[39m\u001b[38;5;124m'\u001b[39m: (\u001b[38;5;28mbool\u001b[39m, \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mdict\u001b[39m),\n\u001b[0;32m 28\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdefault_method\u001b[39m\u001b[38;5;124m'\u001b[39m: (\u001b[38;5;28mstr\u001b[39m,),\n\u001b[0;32m 29\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnumtocat\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[38;5;28mlist\u001b[39m),\n\u001b[0;32m 30\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcatgroups\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[38;5;28mint\u001b[39m, \u001b[38;5;28mdict\u001b[39m),\n\u001b[0;32m 31\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mseed\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[38;5;28mint\u001b[39m),\n\u001b[0;32m 32\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mk\u001b[39m\u001b[38;5;124m'\u001b[39m: (NONE_TYPE, \u001b[38;5;28mint\u001b[39m)}\n", |
| 1088 | + "\u001b[1;31mNameError\u001b[0m: name 'np' is not defined" |
1085 | 1089 | ] |
1086 | 1090 | } |
1087 | 1091 | ], |
|
1095 | 1099 | }, |
1096 | 1100 | { |
1097 | 1101 | "cell_type": "code", |
1098 | | - "execution_count": 11, |
| 1102 | + "execution_count": null, |
1099 | 1103 | "metadata": {}, |
1100 | 1104 | "outputs": [ |
1101 | 1105 | { |
|
1271 | 1275 | "name": "python", |
1272 | 1276 | "nbconvert_exporter": "python", |
1273 | 1277 | "pygments_lexer": "ipython3", |
1274 | | - "version": "3.11.9" |
| 1278 | + "version": "3.11.0" |
1275 | 1279 | } |
1276 | 1280 | }, |
1277 | 1281 | "nbformat": 4, |
|
0 commit comments