Module Expr Str Import alias identifier ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr orelse Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad AttributeLoad NameLoad attr Str Str Call NameLoad AttributeLoad NameLoad attr Str Str Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr CompareEq NameLoad Num Index Num Assign NameStore Call AttributeLoad NameLoad attr BinOpMult Call NameLoad NameLoad AttributeLoad NameLoad attr If CompareLtE Call NameLoad NameLoad NameLoad body Raise BinOpAdd BinOpAdd Str Call NameLoad BinOpAdd NameLoad Num Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad BinOpSub Call NameLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad Call NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TryExcept body Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index Num handlers ExceptHandler body Pass Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr CompareEq NameLoad Num Index Num Assign NameStore Call AttributeLoad NameLoad attr BinOpMult Call NameLoad NameLoad AttributeLoad NameLoad attr If CompareLtE Call NameLoad NameLoad NameLoad body Raise BinOpAdd BinOpAdd Str Call NameLoad BinOpAdd NameLoad Num Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TryExcept body Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index Num handlers ExceptHandler body Pass Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TryExcept body Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index Num handlers ExceptHandler body Pass Return BinOpDiv NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Raise Call NameLoad Str Return Call AttributeLoad NameLoad attr ListComp IfExp CompareGt NameLoad NameLoad Num Num comprehension NameStore Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A 
Created on Dec 21, 2012

@author: Alexandre
 N/A numpy np PUAdapter N/A object N/A N/A 
    Adapts any probabilistic binary classifier to positive-unlabled learning using the PosOnly method proposed by
    Elkan and Noto:

    Elkan, Charles, and Keith Noto. "Learning classifiers from only positive and unlabeled data."
    Proceeding of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2008.
     __init__ N/A N/A self estimator hold_out_ratio precomputed_kernel N/A 0.1 False N/A N/A 
        estimator -- An estimator of p(s=1|x) that must implement:
                     * predict_proba(X): Takes X, which can be a list of feature vectors or a precomputed
                                         kernel matrix and outputs p(s=1|x) for each example in X
                     * fit(X,y): Takes X, which can be a list of feature vectors or a precomputed
                                 kernel matrix and takes y, which are the labels associated to the
                                 examples in X
        hold_out_ratio -- The ratio of training examples that must be held out of the training set of examples
                          to estimate p(s=1|y=1) after training the estimator
        precomputed_kernel -- Specifies if the X matrix for predict_proba and fit is a precomputed kernel matrix
         N/A N/A self estimator estimator N/A N/A self c 1.0 N/A N/A self hold_out_ratio hold_out_ratio N/A precomputed_kernel N/A N/A N/A self fit N/A self __fit_precomputed_kernel N/A N/A N/A self fit N/A self __fit_no_precomputed_kernel N/A N/A self estimator_fitted False N/A __str__ N/A N/A self N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A Estimator: N/A str N/A self estimator p(s=1|y=1,x) ~=  N/A str N/A self c Fitted:  N/A str N/A self estimator_fitted N/A __fit_precomputed_kernel N/A N/A self X y N/A N/A N/A 
        Fits an estimator of p(s=1|x) and estimates the value of p(s=1|y=1) using a subset of the training examples

        X -- Precomputed kernel matrix
        y -- Labels associated to each example in X (Positive label: 1.0, Negative label: -1.0)
         N/A positives N/A N/A N/A np where N/A y 1.0 N/A 0 N/A hold_out_size N/A N/A np ceil N/A N/A len positives N/A self hold_out_ratio N/A N/A N/A len positives hold_out_size N/A N/A N/A N/A Not enough positive examples to estimate p(s=1|y=1,x). Need at least  N/A str N/A hold_out_size 1 . N/A N/A N/A N/A np random shuffle positives N/A hold_out N/A positives N/A hold_out_size N/A X_test_hold_out N/A X N/A hold_out N/A keep N/A list N/A N/A set N/A N/A np arange N/A len y N/A set hold_out N/A X_test_hold_out N/A X_test_hold_out N/A N/A N/A keep N/A X N/A X N/A N/A N/A keep N/A X N/A X N/A keep N/A y N/A N/A np delete y hold_out N/A N/A N/A N/A self estimator fit X y N/A hold_out_predictions N/A N/A N/A self estimator predict_proba X_test_hold_out N/A N/A N/A hold_out_predictions N/A hold_out_predictions N/A N/A N/A 1 N/A N/A N/A N/A N/A c N/A N/A np mean hold_out_predictions N/A N/A self c c N/A N/A self estimator_fitted True N/A __fit_no_precomputed_kernel N/A N/A self X y N/A N/A N/A 
        Fits an estimator of p(s=1|x) and estimates the value of p(s=1|y=1,x)

        X -- List of feature vectors
        y -- Labels associated to each feature vector in X (Positive label: 1.0, Negative label: -1.0)
         N/A positives N/A N/A N/A np where N/A y 1.0 N/A 0 N/A hold_out_size N/A N/A np ceil N/A N/A len positives N/A self hold_out_ratio N/A N/A N/A len positives hold_out_size N/A N/A N/A N/A Not enough positive examples to estimate p(s=1|y=1,x). Need at least  N/A str N/A hold_out_size 1 . N/A N/A N/A N/A np random shuffle positives N/A hold_out N/A positives N/A hold_out_size N/A X_hold_out N/A X N/A hold_out N/A X N/A N/A np delete X hold_out 0 N/A y N/A N/A np delete y hold_out N/A N/A N/A N/A self estimator fit X y N/A hold_out_predictions N/A N/A N/A self estimator predict_proba X_hold_out N/A N/A N/A hold_out_predictions N/A hold_out_predictions N/A N/A N/A 1 N/A N/A N/A N/A N/A c N/A N/A np mean hold_out_predictions N/A N/A self c c N/A N/A self estimator_fitted True N/A predict_proba N/A N/A self X N/A N/A N/A 
        Predicts p(y=1|x) using the estimator and the value of p(s=1|y=1) estimated in fit(...)

        X -- List of feature vectors or a precomputed kernel matrix
         N/A N/A N/A self estimator_fitted N/A N/A N/A Exception The estimator must be fitted before calling predict_proba(...). N/A probabilistic_predictions N/A N/A N/A self estimator predict_proba X N/A N/A N/A probabilistic_predictions N/A probabilistic_predictions N/A N/A N/A 1 N/A N/A N/A N/A N/A N/A probabilistic_predictions N/A self c N/A predict N/A N/A self X treshold N/A 0.5 N/A N/A 
        Assign labels to feature vectors based on the estimator's predictions

        X -- List of feature vectors or a precomputed kernel matrix
        treshold -- The decision treshold between the positive and the negative class
         N/A N/A N/A self estimator_fitted N/A N/A N/A Exception The estimator must be fitted before calling predict(...). N/A N/A N/A np array N/A N/A N/A p treshold 1.0 -1.0 N/A p N/A N/A self predict_proba X N/A N/A