r"""Display a comparison of classifiers Parameters ---------- model : alphapy.Model The model object with plotting specifications. partition : alphapy.Partition Reference to the dataset. f1 : int Number of the first feature to compare. f2 : int
(model, partition, f1=0, f2=1)
| 784 | # |
| 785 | |
| 786 | def plot_boundary(model, partition, f1=0, f2=1): |
| 787 | r"""Display a comparison of classifiers |
| 788 | |
| 789 | Parameters |
| 790 | ---------- |
| 791 | model : alphapy.Model |
| 792 | The model object with plotting specifications. |
| 793 | partition : alphapy.Partition |
| 794 | Reference to the dataset. |
| 795 | f1 : int |
| 796 | Number of the first feature to compare. |
| 797 | f2 : int |
| 798 | Number of the second feature to compare. |
| 799 | |
| 800 | Returns |
| 801 | ------- |
| 802 | None : None |
| 803 | |
| 804 | References |
| 805 | ---------- |
| 806 | Code excerpts from authors: |
| 807 | |
| 808 | * Gael Varoquaux |
| 809 | * Andreas Muller |
| 810 | |
| 811 | http://scikit-learn.org/stable/auto_examples/classification/plot_classifier_comparison.html |
| 812 | |
| 813 | """ |
| 814 | |
| 815 | logger.info("Generating Boundary Plots") |
| 816 | pstring = datasets[partition] |
| 817 | |
| 818 | # For classification only |
| 819 | |
| 820 | if model.specs['model_type'] != ModelType.classification: |
| 821 | logger.info('Boundary Plots are for classification only') |
| 822 | return None |
| 823 | |
| 824 | # Get X, Y for correct partition |
| 825 | |
| 826 | X, y = get_partition_data(model, partition) |
| 827 | |
| 828 | # Subset for the two boundary features |
| 829 | |
| 830 | X = X[[f1, f2]] |
| 831 | |
| 832 | # Initialize plot |
| 833 | |
| 834 | n_classifiers = len(model.algolist) |
| 835 | plt.figure(figsize=(3 * 2, n_classifiers * 2)) |
| 836 | plt.subplots_adjust(bottom=.2, top=.95) |
| 837 | |
| 838 | xx = np.linspace(3, 9, 100) |
| 839 | yy = np.linspace(1, 5, 100).T |
| 840 | xx, yy = np.meshgrid(xx, yy) |
| 841 | Xfull = np.c_[xx.ravel(), yy.ravel()] |
| 842 | |
| 843 | # Plot each classification probability |
nothing calls this directly
no test coverage detected