|
30 | 30 | }, |
31 | 31 | { |
32 | 32 | "cell_type": "code", |
33 | | - "execution_count": 4, |
| 33 | + "execution_count": 1, |
34 | 34 | "metadata": {}, |
35 | 35 | "outputs": [], |
36 | 36 | "source": [ |
|
52 | 52 | }, |
53 | 53 | { |
54 | 54 | "cell_type": "code", |
55 | | - "execution_count": 5, |
| 55 | + "execution_count": 2, |
56 | 56 | "metadata": {}, |
57 | 57 | "outputs": [], |
58 | 58 | "source": [ |
|
61 | 61 | }, |
62 | 62 | { |
63 | 63 | "cell_type": "code", |
64 | | - "execution_count": 6, |
| 64 | + "execution_count": 3, |
65 | 65 | "metadata": {}, |
66 | 66 | "outputs": [], |
67 | 67 | "source": [ |
|
70 | 70 | }, |
71 | 71 | { |
72 | 72 | "cell_type": "code", |
73 | | - "execution_count": 7, |
| 73 | + "execution_count": 4, |
74 | 74 | "metadata": {}, |
75 | 75 | "outputs": [], |
76 | 76 | "source": [ |
|
80 | 80 | }, |
81 | 81 | { |
82 | 82 | "cell_type": "code", |
83 | | - "execution_count": 8, |
| 83 | + "execution_count": 5, |
84 | 84 | "metadata": {}, |
85 | 85 | "outputs": [ |
86 | 86 | { |
|
492 | 492 | "[2126 rows x 22 columns]" |
493 | 493 | ] |
494 | 494 | }, |
495 | | - "execution_count": 8, |
| 495 | + "execution_count": 5, |
496 | 496 | "metadata": {}, |
497 | 497 | "output_type": "execute_result" |
498 | 498 | } |
|
510 | 510 | }, |
511 | 511 | { |
512 | 512 | "cell_type": "code", |
513 | | - "execution_count": 7, |
| 513 | + "execution_count": 6, |
514 | 514 | "metadata": {}, |
515 | 515 | "outputs": [], |
516 | 516 | "source": [ |
|
519 | 519 | }, |
520 | 520 | { |
521 | 521 | "cell_type": "code", |
522 | | - "execution_count": 8, |
| 522 | + "execution_count": 7, |
523 | 523 | "metadata": {}, |
524 | 524 | "outputs": [], |
525 | 525 | "source": [ |
|
538 | 538 | }, |
539 | 539 | { |
540 | 540 | "cell_type": "code", |
541 | | - "execution_count": 9, |
| 541 | + "execution_count": 8, |
542 | 542 | "metadata": {}, |
543 | 543 | "outputs": [], |
544 | 544 | "source": [ |
|
551 | 551 | }, |
552 | 552 | { |
553 | 553 | "cell_type": "code", |
554 | | - "execution_count": 10, |
| 554 | + "execution_count": 9, |
555 | 555 | "metadata": {}, |
556 | 556 | "outputs": [ |
557 | 557 | { |
558 | 558 | "data": { |
559 | | - "text/html": [ |
560 | | - "<style>#sk-container-id-1 {color: black;background-color: white;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LogisticRegression(C=10, max_iter=10000, multi_class='multinomial',\n", |
561 | | - " penalty='l1', solver='saga')</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LogisticRegression</label><div class=\"sk-toggleable__content\"><pre>LogisticRegression(C=10, max_iter=10000, multi_class='multinomial',\n", |
562 | | - " penalty='l1', solver='saga')</pre></div></div></div></div></div>" |
563 | | - ], |
564 | 559 | "text/plain": [ |
565 | 560 | "LogisticRegression(C=10, max_iter=10000, multi_class='multinomial',\n", |
566 | 561 | " penalty='l1', solver='saga')" |
567 | 562 | ] |
568 | 563 | }, |
569 | | - "execution_count": 10, |
| 564 | + "execution_count": 9, |
570 | 565 | "metadata": {}, |
571 | 566 | "output_type": "execute_result" |
572 | 567 | } |
|
577 | 572 | }, |
578 | 573 | { |
579 | 574 | "cell_type": "code", |
580 | | - "execution_count": 11, |
| 575 | + "execution_count": 10, |
581 | 576 | "metadata": {}, |
582 | 577 | "outputs": [ |
583 | 578 | { |
|
586 | 581 | "text": [ |
587 | 582 | " precision recall f1-score support\n", |
588 | 583 | "\n", |
589 | | - " 0 0.91 0.74 0.82 39\n", |
590 | | - " 1 0.91 0.98 0.94 330\n", |
591 | | - " 2 0.71 0.51 0.59 57\n", |
| 584 | + " 0 0.81 0.65 0.72 34\n", |
| 585 | + " 1 0.89 0.98 0.94 325\n", |
| 586 | + " 2 0.74 0.46 0.57 67\n", |
592 | 587 | "\n", |
593 | | - " accuracy 0.89 426\n", |
594 | | - " macro avg 0.84 0.74 0.78 426\n", |
595 | | - "weighted avg 0.88 0.89 0.88 426\n", |
| 588 | + " accuracy 0.87 426\n", |
| 589 | + " macro avg 0.82 0.70 0.74 426\n", |
| 590 | + "weighted avg 0.86 0.87 0.86 426\n", |
596 | 591 | "\n" |
597 | 592 | ] |
598 | 593 | } |
|
612 | 607 | }, |
613 | 608 | { |
614 | 609 | "cell_type": "code", |
615 | | - "execution_count": 12, |
| 610 | + "execution_count": 11, |
616 | 611 | "metadata": {}, |
617 | 612 | "outputs": [], |
618 | 613 | "source": [ |
|
630 | 625 | }, |
631 | 626 | { |
632 | 627 | "cell_type": "code", |
633 | | - "execution_count": 13, |
| 628 | + "execution_count": 14, |
634 | 629 | "metadata": {}, |
635 | 630 | "outputs": [ |
636 | 631 | { |
637 | 632 | "name": "stdout", |
638 | 633 | "output_type": "stream", |
639 | 634 | "text": [ |
640 | | - "Creating project on Unbox! Check out https://unbox.ai/projects to have a look!\n" |
| 635 | + "Created your project. Check out https://unbox.ai/projects!\n" |
641 | 636 | ] |
642 | 637 | } |
643 | 638 | ], |
644 | 639 | "source": [ |
645 | | - "project = client.create_project(name=\"Fetal Health Prediction\", \n", |
| 640 | + "from unboxapi.tasks import TaskType\n", |
| 641 | + "\n", |
| 642 | + "project = client.create_project(name=\"Fetal Health Prediction\",\n", |
| 643 | + " task_type=TaskType.TabularClassification,\n", |
646 | 644 | " description=\"Evaluation of ML approaches to predict health\")" |
647 | 645 | ] |
648 | 646 | }, |
|
655 | 653 | }, |
656 | 654 | { |
657 | 655 | "cell_type": "code", |
658 | | - "execution_count": 19, |
| 656 | + "execution_count": 15, |
659 | 657 | "metadata": {}, |
660 | 658 | "outputs": [ |
661 | 659 | { |
|
667 | 665 | } |
668 | 666 | ], |
669 | 667 | "source": [ |
670 | | - "from unboxapi.tasks import TaskType\n", |
671 | | - "\n", |
672 | 668 | "dataset = project.add_dataframe(\n", |
673 | 669 | " df=test,\n", |
674 | 670 | " class_names=[\"Pathological\", \"Normal\", \"Suspect\"],\n", |
675 | 671 | " label_column_name='fetal_health',\n", |
676 | | - " name=\"Fetal health validation set\",\n", |
677 | | - " description='this is my fetal health validation dataset',\n", |
678 | | - " task_type=TaskType.TabularClassification,\n", |
| 672 | + " commit_message='this is my fetal health validation dataset',\n", |
679 | 673 | " feature_names=test.loc[:, test.columns != 'fetal_health'].columns.values.tolist(),\n", |
680 | 674 | ")" |
681 | 675 | ] |
|
691 | 685 | }, |
692 | 686 | { |
693 | 687 | "cell_type": "code", |
694 | | - "execution_count": 15, |
| 688 | + "execution_count": 16, |
695 | 689 | "metadata": {}, |
696 | 690 | "outputs": [], |
697 | 691 | "source": [ |
|
708 | 702 | }, |
709 | 703 | { |
710 | 704 | "cell_type": "code", |
711 | | - "execution_count": 18, |
| 705 | + "execution_count": 17, |
712 | 706 | "metadata": {}, |
713 | 707 | "outputs": [ |
714 | | - { |
715 | | - "name": "stderr", |
716 | | - "output_type": "stream", |
717 | | - "text": [ |
718 | | - "/Users/gustavocid/miniconda3/envs/unbox-examples/lib/python3.8/site-packages/sklearn/base.py:443: UserWarning: X has feature names, but LogisticRegression was fitted without feature names\n", |
719 | | - " warnings.warn(\n" |
720 | | - ] |
721 | | - }, |
722 | 708 | { |
723 | 709 | "data": { |
724 | 710 | "text/plain": [ |
725 | | - "array([[1.30716901e-06, 9.88941660e-01, 1.10570332e-02],\n", |
726 | | - " [7.73506281e-03, 6.72233264e-01, 3.20031674e-01],\n", |
727 | | - " [1.05907808e-04, 9.79362816e-01, 2.05312764e-02]])" |
| 711 | + "array([[2.05737599e-02, 3.78148952e-01, 6.01277288e-01],\n", |
| 712 | + " [2.12130596e-06, 9.99412193e-01, 5.85685717e-04],\n", |
| 713 | + " [3.56683608e-03, 8.50312336e-01, 1.46120828e-01]])" |
728 | 714 | ] |
729 | 715 | }, |
730 | | - "execution_count": 18, |
| 716 | + "execution_count": 17, |
731 | 717 | "metadata": {}, |
732 | 718 | "output_type": "execute_result" |
733 | 719 | } |
|
745 | 731 | }, |
746 | 732 | { |
747 | 733 | "cell_type": "code", |
748 | | - "execution_count": 21, |
| 734 | + "execution_count": 18, |
749 | 735 | "metadata": {}, |
750 | 736 | "outputs": [ |
751 | 737 | { |
|
755 | 741 | "Bundling model and artifacts...\n", |
756 | 742 | "Uploading model to Unbox! Check out https://unbox.ai/models to have a look!\n" |
757 | 743 | ] |
| 744 | + }, |
| 745 | + { |
| 746 | + "name": "stderr", |
| 747 | + "output_type": "stream", |
| 748 | + "text": [ |
| 749 | + "/Users/gustavocid/miniconda3/envs/unbox-examples/lib/python3.8/site-packages/joblib/numpy_pickle.py:103: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.\n", |
| 750 | + " pickler.file_handle.write(chunk.tostring('C'))\n" |
| 751 | + ] |
758 | 752 | } |
759 | 753 | ], |
760 | 754 | "source": [ |
|
764 | 758 | " function=predict_proba, \n", |
765 | 759 | " model=sklearn_model,\n", |
766 | 760 | " model_type=ModelType.sklearn,\n", |
767 | | - " task_type=TaskType.TabularClassification,\n", |
768 | 761 | " class_names=[\"Pathological\", \"Normal\", \"Suspect\"],\n", |
769 | 762 | " name='Fetal Classifier - N3',\n", |
770 | | - " description='this is my first tabular classification model',\n", |
| 763 | + " commit_message='this is my first tabular classification model',\n", |
771 | 764 | " feature_names=test.loc[:, test.columns != 'fetal_health'].columns.values.tolist(),\n", |
772 | 765 | " train_sample_df=train[:100],\n", |
773 | 766 | " train_sample_label_column_name='fetal_health',\n", |
774 | 767 | ")" |
775 | 768 | ] |
| 769 | + }, |
| 770 | + { |
| 771 | + "cell_type": "code", |
| 772 | + "execution_count": null, |
| 773 | + "metadata": {}, |
| 774 | + "outputs": [], |
| 775 | + "source": [] |
776 | 776 | } |
777 | 777 | ], |
778 | 778 | "metadata": { |
|
0 commit comments