Skip to content

Latest commit

 

History

History
71 lines (56 loc) · 3.77 KB

lai.rst

File metadata and controls

71 lines (56 loc) · 3.77 KB

Lai

The class which implements the Lai's approach [1].

Parameters
model : object, optional (default=sklearn.linear_model.LogisticRegression)
  The classification model which will be used for predict uplift.
use_weights : boolean, optional (default=False)
  Use or not weights?

Methods

fit(self, X, y, t) <lai_fit> Build a the model from the training set (X, y, t).
predict(self, X, t=None) <lai_predict> Predict an uplift for X.

fit(self, X, y, t)

Build a the model from the training set (X, y, t).

Parameters
X: numpy ndarray with shape = [n_samples, n_features]
  Matrix of features.
y: numpy array with shape = [n_samples,]
  Array of target of feature.
t: numpy array with shape = [n_samples,]
  Array of treatments.
Returns self : object

predict(self, X, t=None)

Predict an uplift for X.

Parameters
X: numpy ndarray with shape = [n_samples, n_features]
  Matrix of features.
t: numpy array with shape = [n_samples,] or None
  Array of treatments.
Returns
self : object
  The predicted values.

References

  1. A Literature Survey and Experimental Evaluation of the State-of-the-Art in Uplift Modeling: A Stepping Stone Toward the Development of Prescriptive Analytics by Floris Devriendt, Darie Moldovan, and Wouter Verbeke
from pyuplift.transformation import Lai
...
model = Lai()
model.fit(X[train_indexes, :], y[train_indexes], t[train_indexes])
uplift = model.predict(X[test_indexes, :])
print(uplift)