Skip to content
Snippets Groups Projects
Select Git revision
  • debian/0.17.0-4
  • master default protected
  • 0.19.X
  • discrete
  • 0.18.X
  • ignore_lambda_to_diff_errors
  • 0.17.X
  • authors-update
  • 0.16.X
  • 0.15.X
  • 0.14.X
  • debian
  • 0.13.X
  • 0.12.X
  • 0.11.X
  • 0.10.X
  • 0.9.X
  • 0.6.X
  • 0.7.X
  • 0.8.X
  • 0.19.1
  • 0.19.0
  • 0.19b2
  • 0.19b1
  • 0.19-branching
  • 0.18.2
  • 0.18.1
  • 0.18
  • 0.18rc2
  • 0.18rc1
  • 0.18rc
  • 0.17.1-1
  • 0.17.1
  • debian/0.17.0-3
  • debian/0.17.0-1
  • 0.17
  • debian/0.17.0_b1+git14-g4e6829c-1
  • debian/0.17.0_b1-1
  • 0.17b1
39 results

bench_multilabel_metrics.py

Blame
    • Raghav RV's avatar
      664d78eb
      MAINT Remove support for the deprecated sequence of sequences · 664d78eb
      Raghav RV authored
      MAINT Remove sequence of sequence support from datasets
      MAINT Remove return_indicator param
      MAINT Remove multilabel-seq test in OVR
      MAINT Remove multilable-seq test in check_cv
      MAINT Remove multilabel seq test in label_binarizer
      TST type_of_target returns "unknown" for multilabel-sequence types
      TST _check_targets should raise a ValueError
      DOC show multilabel indicator as an example; remove return_indicator param
      DOC use consistent lower case y for target
      664d78eb
      History
      MAINT Remove support for the deprecated sequence of sequences
      Raghav RV authored
      MAINT Remove sequence of sequence support from datasets
      MAINT Remove return_indicator param
      MAINT Remove multilabel-seq test in OVR
      MAINT Remove multilable-seq test in check_cv
      MAINT Remove multilabel seq test in label_binarizer
      TST type_of_target returns "unknown" for multilabel-sequence types
      TST _check_targets should raise a ValueError
      DOC show multilabel indicator as an example; remove return_indicator param
      DOC use consistent lower case y for target
    plot_weighted_samples.py 1000 B
    """
    =====================
    SVM: Weighted samples
    =====================
    
    Plot decision function of a weighted dataset, where the size of points
    is proportional to its weight.
    """
    print(__doc__)
    
    import numpy as np
    import pylab as pl
    from sklearn import svm
    
    # we create 20 points
    np.random.seed(0)
    X = np.r_[np.random.randn(10, 2) + [1, 1], np.random.randn(10, 2)]
    Y = [1] * 10 + [-1] * 10
    sample_weight = 100 * np.abs(np.random.randn(20))
    # and assign a bigger weight to the last 10 samples
    sample_weight[:10] *= 10
    
    # # fit the model
    clf = svm.SVC()
    clf.fit(X, Y, sample_weight=sample_weight)
    
    # plot the decision function
    xx, yy = np.meshgrid(np.linspace(-4, 5, 500), np.linspace(-4, 5, 500))
    
    Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])
    Z = Z.reshape(xx.shape)
    
    # plot the line, the points, and the nearest vectors to the plane
    pl.contourf(xx, yy, Z, alpha=0.75, cmap=pl.cm.bone)
    pl.scatter(X[:, 0], X[:, 1], c=Y, s=sample_weight, alpha=0.9, cmap=pl.cm.bone)
    
    pl.axis('off')
    pl.show()