ntucllab / libact

Pool-based active learning in Python
http://libact.readthedocs.org/
BSD 2-Clause "Simplified" License
779 stars 174 forks source link

extend quire for kernels other than rbf #52

Closed tungen closed 8 years ago

tungen commented 8 years ago

@yangarbiter @iamyuanchung please see the changes made to quire thanks.

yangarbiter commented 8 years ago

@tungen It seems that there is some problem with your documentation of the kernel parameter. It seems to be taking in a shape (n_samples, n_samples) ndarray instead of a sklearn.metrics.pairwise.*_kernel object.

I would suggest consider sklearn's interface in SVC. http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html http://scikit-learn.org/stable/auto_examples/svm/plot_custom_kernel.html#example-svm-plot-custom-kernel-py

you would add three parameters degree, gamma, coef0 for the parameter popular kernels. the kernel parameter takes in a string ('rbf', 'sigmoid', 'linear', 'sigmoid') or a callable (function). As for the precomputed option, since we have both labeled data and unlabeled data, It might confuse the users on how to generate such matrix. (and in our case, the dataset object is combined in the query strategy)

By the way, you should also add test for callable option in unittest.

tungen commented 8 years ago

@yangarbiter please help review the new commit, thanks.

yangarbiter commented 8 years ago

@tungen kernel : string, optional (default='rbf') should be on line 27 kernel : {'linear', 'poly', 'rbf', callable}, optional (default='rbf') and this line If none is given, 'rbf' will be used. should be removed.

your should remove debug code print('use callable') on line 87

tungen commented 8 years ago

@yangarbiter done, please check.

yangarbiter commented 8 years ago

Looks good to me.