|
49 | 49 | }, |
50 | 50 | { |
51 | 51 | "cell_type": "code", |
52 | | - "execution_count": 2, |
| 52 | + "execution_count": 1, |
53 | 53 | "id": "33179b0c", |
54 | 54 | "metadata": {}, |
55 | 55 | "outputs": [], |
|
72 | 72 | }, |
73 | 73 | { |
74 | 74 | "cell_type": "code", |
75 | | - "execution_count": 3, |
| 75 | + "execution_count": 2, |
76 | 76 | "id": "83470097", |
77 | 77 | "metadata": {}, |
78 | 78 | "outputs": [], |
|
82 | 82 | }, |
83 | 83 | { |
84 | 84 | "cell_type": "code", |
85 | | - "execution_count": 12, |
| 85 | + "execution_count": 3, |
86 | 86 | "id": "40472b51", |
87 | 87 | "metadata": {}, |
88 | 88 | "outputs": [], |
|
92 | 92 | }, |
93 | 93 | { |
94 | 94 | "cell_type": "code", |
95 | | - "execution_count": 14, |
| 95 | + "execution_count": 4, |
96 | 96 | "id": "679e0b36", |
97 | 97 | "metadata": {}, |
98 | 98 | "outputs": [ |
|
308 | 308 | "[10000 rows x 10 columns]" |
309 | 309 | ] |
310 | 310 | }, |
311 | | - "execution_count": 14, |
| 311 | + "execution_count": 4, |
312 | 312 | "metadata": {}, |
313 | 313 | "output_type": "execute_result" |
314 | 314 | } |
|
329 | 329 | }, |
330 | 330 | { |
331 | 331 | "cell_type": "code", |
332 | | - "execution_count": 15, |
| 332 | + "execution_count": 5, |
333 | 333 | "id": "708ade4c", |
334 | 334 | "metadata": {}, |
335 | 335 | "outputs": [], |
|
347 | 347 | }, |
348 | 348 | { |
349 | 349 | "cell_type": "code", |
350 | | - "execution_count": 16, |
| 350 | + "execution_count": 6, |
351 | 351 | "id": "e0a1b4b0", |
352 | 352 | "metadata": {}, |
353 | 353 | "outputs": [], |
|
367 | 367 | }, |
368 | 368 | { |
369 | 369 | "cell_type": "code", |
370 | | - "execution_count": 17, |
| 370 | + "execution_count": 7, |
371 | 371 | "id": "248556af", |
372 | 372 | "metadata": {}, |
373 | 373 | "outputs": [ |
|
632 | 632 | "[10000 rows x 13 columns]" |
633 | 633 | ] |
634 | 634 | }, |
635 | | - "execution_count": 17, |
| 635 | + "execution_count": 7, |
636 | 636 | "metadata": {}, |
637 | 637 | "output_type": "execute_result" |
638 | 638 | } |
|
654 | 654 | }, |
655 | 655 | { |
656 | 656 | "cell_type": "code", |
657 | | - "execution_count": 18, |
| 657 | + "execution_count": 8, |
658 | 658 | "id": "b76d541a", |
659 | 659 | "metadata": {}, |
660 | 660 | "outputs": [], |
|
674 | 674 | }, |
675 | 675 | { |
676 | 676 | "cell_type": "code", |
677 | | - "execution_count": 19, |
| 677 | + "execution_count": 9, |
678 | 678 | "id": "ee882b61", |
679 | 679 | "metadata": { |
680 | 680 | "scrolled": true |
|
686 | 686 | "LogisticRegression(random_state=1300)" |
687 | 687 | ] |
688 | 688 | }, |
689 | | - "execution_count": 19, |
| 689 | + "execution_count": 9, |
690 | 690 | "metadata": {}, |
691 | 691 | "output_type": "execute_result" |
692 | 692 | } |
|
698 | 698 | }, |
699 | 699 | { |
700 | 700 | "cell_type": "code", |
701 | | - "execution_count": 20, |
| 701 | + "execution_count": 10, |
702 | 702 | "id": "a4f603d9", |
703 | 703 | "metadata": { |
704 | 704 | "scrolled": true |
|
756 | 756 | }, |
757 | 757 | { |
758 | 758 | "cell_type": "code", |
759 | | - "execution_count": 21, |
| 759 | + "execution_count": 11, |
760 | 760 | "id": "82a38cd9", |
761 | 761 | "metadata": {}, |
762 | 762 | "outputs": [], |
|
776 | 776 | }, |
777 | 777 | { |
778 | 778 | "cell_type": "code", |
779 | | - "execution_count": 22, |
| 779 | + "execution_count": 12, |
780 | 780 | "id": "5562a940", |
781 | 781 | "metadata": {}, |
782 | 782 | "outputs": [ |
783 | 783 | { |
784 | 784 | "name": "stdout", |
785 | 785 | "output_type": "stream", |
786 | 786 | "text": [ |
787 | | - "Created your project. Navigate to http://localhost:8000/projects/1 to see it in the UI.\n" |
| 787 | + "Created your project. Navigate to http://staging.unbox.ai/projects/50 to see it in the UI.\n" |
788 | 788 | ] |
789 | 789 | } |
790 | 790 | ], |
|
806 | 806 | }, |
807 | 807 | { |
808 | 808 | "cell_type": "code", |
809 | | - "execution_count": 29, |
| 809 | + "execution_count": 15, |
810 | 810 | "id": "7355e02d", |
811 | 811 | "metadata": {}, |
812 | | - "outputs": [ |
813 | | - { |
814 | | - "name": "stderr", |
815 | | - "output_type": "stream", |
816 | | - "text": [ |
817 | | - "/var/folders/9z/j3bd32nd47j_l0thnbj6vbnw0000gn/T/ipykernel_17091/2793504704.py:6: SettingWithCopyWarning: \n", |
818 | | - "A value is trying to be set on a copy of a slice from a DataFrame.\n", |
819 | | - "Try using .loc[row_indexer,col_indexer] = value instead\n", |
820 | | - "\n", |
821 | | - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", |
822 | | - " x_val['churn'] = y_val.values\n", |
823 | | - "/var/folders/9z/j3bd32nd47j_l0thnbj6vbnw0000gn/T/ipykernel_17091/2793504704.py:7: SettingWithCopyWarning: \n", |
824 | | - "A value is trying to be set on a copy of a slice from a DataFrame.\n", |
825 | | - "Try using .loc[row_indexer,col_indexer] = value instead\n", |
826 | | - "\n", |
827 | | - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", |
828 | | - " x_train['churn'] = y_train.values\n" |
829 | | - ] |
830 | | - } |
831 | | - ], |
| 812 | + "outputs": [], |
832 | 813 | "source": [ |
833 | 814 | "# Some variables that will be used for the dataset upload\n", |
834 | 815 | "class_names = [\"Retained\", \"Exited\"]\n", |
835 | 816 | "feature_names = list(x_val.columns)\n", |
836 | 817 | "\n", |
837 | | - "# Add the ground truths to the ordinal dataset for Unbox\n", |
838 | | - "x_val['churn'] = y_val.values\n", |
839 | | - "x_train['churn'] = y_train.values" |
| 818 | + "# Add the ground truths to the original dataset for Unbox\n", |
| 819 | + "validation_set = x_val.copy()\n", |
| 820 | + "validation_set['churn'] = y_val.values\n", |
| 821 | + "training_set = x_train.copy()\n", |
| 822 | + "training_set['churn'] = y_train.values" |
840 | 823 | ] |
841 | 824 | }, |
842 | 825 | { |
843 | 826 | "cell_type": "code", |
844 | | - "execution_count": 24, |
| 827 | + "execution_count": 16, |
845 | 828 | "id": "197e51c6", |
846 | 829 | "metadata": {}, |
847 | 830 | "outputs": [ |
|
851 | 834 | "text": [ |
852 | 835 | "Adding your dataset to Unbox! Check out the project page to have a look.\n" |
853 | 836 | ] |
| 837 | + }, |
| 838 | + { |
| 839 | + "name": "stderr", |
| 840 | + "output_type": "stream", |
| 841 | + "text": [ |
| 842 | + "100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 91.9k/91.9k [00:02<00:00, 33.2kB/s]\n" |
| 843 | + ] |
854 | 844 | } |
855 | 845 | ], |
856 | 846 | "source": [ |
857 | 847 | "dataset = project.add_dataframe(\n", |
858 | | - " df=x_val,\n", |
| 848 | + " df=validation_set,\n", |
859 | 849 | " class_names=class_names,\n", |
860 | 850 | " label_column_name='churn',\n", |
861 | 851 | " commit_message='first commit!',\n", |
|
882 | 872 | }, |
883 | 873 | { |
884 | 874 | "cell_type": "code", |
885 | | - "execution_count": 25, |
| 875 | + "execution_count": 17, |
886 | 876 | "id": "d233987d", |
887 | 877 | "metadata": {}, |
888 | 878 | "outputs": [], |
|
905 | 895 | }, |
906 | 896 | { |
907 | 897 | "cell_type": "code", |
908 | | - "execution_count": 26, |
| 898 | + "execution_count": 18, |
909 | 899 | "id": "674147b8", |
910 | 900 | "metadata": {}, |
911 | 901 | "outputs": [ |
|
917 | 907 | " [0.81455616, 0.18544384]])" |
918 | 908 | ] |
919 | 909 | }, |
920 | | - "execution_count": 26, |
| 910 | + "execution_count": 18, |
921 | 911 | "metadata": {}, |
922 | 912 | "output_type": "execute_result" |
923 | 913 | } |
|
936 | 926 | }, |
937 | 927 | { |
938 | 928 | "cell_type": "code", |
939 | | - "execution_count": 27, |
| 929 | + "execution_count": 19, |
940 | 930 | "id": "ace580e8", |
941 | 931 | "metadata": {}, |
942 | 932 | "outputs": [ |
943 | 933 | { |
944 | 934 | "name": "stdout", |
945 | 935 | "output_type": "stream", |
946 | 936 | "text": [ |
947 | | - "Bundling model and artifacts...\n", |
| 937 | + "Bundling model and artifacts...\n" |
| 938 | + ] |
| 939 | + }, |
| 940 | + { |
| 941 | + "name": "stderr", |
| 942 | + "output_type": "stream", |
| 943 | + "text": [ |
| 944 | + "/Users/gustavocid/Desktop/unbox-repos/unboxapi-python-client/unboxapi/api.py:125: ResourceWarning: unclosed <ssl.SSLSocket fd=83, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.8.253.206', 53878), raddr=('108.156.83.110', 443)>\n", |
| 945 | + " return self._api_request(\"GET\", endpoint, headers=self._headers, params=params)\n", |
| 946 | + "ResourceWarning: Enable tracemalloc to get the object allocation traceback\n", |
| 947 | + "100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 53.7k/53.7k [00:02<00:00, 22.0kB/s]\n" |
| 948 | + ] |
| 949 | + }, |
| 950 | + { |
| 951 | + "name": "stdout", |
| 952 | + "output_type": "stream", |
| 953 | + "text": [ |
948 | 954 | "Adding your model to Unbox! Check out the project page to have a look.\n" |
949 | 955 | ] |
| 956 | + }, |
| 957 | + { |
| 958 | + "name": "stderr", |
| 959 | + "output_type": "stream", |
| 960 | + "text": [ |
| 961 | + "/Users/gustavocid/Desktop/unbox-repos/unboxapi-python-client/unboxapi/api.py:129: ResourceWarning: unclosed <ssl.SSLSocket fd=83, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.8.253.206', 53880), raddr=('108.156.83.110', 443)>\n", |
| 962 | + " return self._api_request(\n", |
| 963 | + "ResourceWarning: Enable tracemalloc to get the object allocation traceback\n" |
| 964 | + ] |
950 | 965 | } |
951 | 966 | ], |
952 | 967 | "source": [ |
|
960 | 975 | " name='Churn Classifier',\n", |
961 | 976 | " commit_message='this is my churn classification model',\n", |
962 | 977 | " feature_names=feature_names,\n", |
963 | | - " train_sample_df=x_train[:3000],\n", |
| 978 | + " train_sample_df=training_set[:3000],\n", |
964 | 979 | " train_sample_label_column_name='churn',\n", |
965 | 980 | " categorical_feature_names=[\"Gender\", \"Geography\"],\n", |
966 | 981 | " col_names=feature_names,\n", |
|
0 commit comments