Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 661 Bytes

README.md

File metadata and controls

18 lines (12 loc) · 661 Bytes

pykliep

A density ratio estimator package for python using the KLIEP algorithm.

The DensityRatioEstimator class implements the Kullback-Leibler Importance Estimation Procedure by Sugiyama et al. Estimator uses likelihood cross validation (LCV) to tune the num_params and sigma parameters.

Usage

from pykliep import DensityRatioEstimator 

kliep = DensityRatioEstimator()
kliep.fit(X_train, X_test) # keyword arguments are X_train and X_test
weights = kliep.predict(X_train)

rf = RandomForestRegressor()
rf.fit(X_train, y_train, sample_weight=weights) # Train using the sample weights!