lift_chart

In [ ]:
lift_chart(y_true: str, 
           y_score: str, 
           input_relation: (str, vDataFrame),
           pos_label: (int, float, str) = 1, 
           nbins: int = 30,
           ax=None,
           **style_kwds,)

Draws a Lift Chart.

Parameters

Name Type Optional Description
y_true
str
Response column.
y_score
str
Prediction Probability.
input_relation
str / vDataFrame
The relation used for scoring. This relation can be a view, table, or customized relation. For example, you could write: "(SELECT ... FROM ...) x" as long as an alias is given at the end of the relation.
pos_label
int / float / str
To compute the Lift Chart, one of the response column class has to be the positive one. The parameter 'pos_label' represents this class.
nbins
int
Curve number of bins.
ax
Matplotlib axes object
The axes to plot on.
**style_kwds
any
Any optional parameter to pass to the Matplotlib functions.

Returns

tablesample : An object containing the result. For more information, see utilities.tablesample.

Example

In [15]:
from verticapy import vDataFrame
vDataFrame("example_classification")
Out[15]:
123
y_score
Float
123
y_true
Int
123
y_pred
Int
10.26199263649447100
20.27176694921201100
30.28171556512481600
40.28770460382082500
50.29350374558954700
60.29475473826400300
70.29956294998781710
80.30291632758509100
90.30407271840812700
100.30557534591911110
110.31083566904061900
120.31083566904061910
130.31467749853206810
140.31477253779470100
150.31750485088406700
160.32104751313806500
170.32489831897123600
180.32731363487109100
190.32829095386794900
200.32953009702602600
210.33066748150804800
220.33169482269100700
230.33489128962507700
240.33922497543052100
250.34064941171806900
260.34091423176713810
270.3417832186944800
280.34245682384610900
290.34260753857422700
300.34338024998316910
310.34338024998316910
320.34561150957992100
330.34570335374319900
340.34634145992485510
350.34656637772198600
360.3472057446561800
370.34732028699124600
380.34736187971757800
390.34789564692799800
400.35004136859187200
410.35071366860872600
420.35109732823426910
430.35201683051264400
440.35205422026265600
450.35214685519674900
460.35223950125486600
470.35317513776240400
480.353939591619710
490.35399633359628110
500.35438162426483500
510.35438162426483500
520.35534256573520300
530.35713218534487400
540.35745549633516600
550.35767970835400900
560.35873803392421500
570.35921007559093200
580.35956601676426500
590.35964157471663400
600.3606028610532500
610.3606028610532500
620.3610107520836400
630.36225548197537500
640.36317857203857300
650.36360041860322700
660.36469384477953900
670.36490799275620200
680.36528884868614600
690.36710003571199800
700.36726258876552400
710.36742721303533500
720.36804829476348800
730.36922573004505800
740.36979771665863300
750.37055385826795500
760.37055385826795510
770.37075382592579300
780.3714004011799410
790.3720796383258600
800.3727222853597310
810.3727907403899600
820.3733725448129800
830.37380960466500900
840.37397337319599210
850.37397343724878400
860.37459538158701910
870.37658833829903100
880.37665348322195800
890.37728892220561600
900.37821722973346300
910.37882574407064300
920.37882574407064300
930.37882574407064310
940.37882574407064310
950.3791113212458100
960.38018743774818900
970.3803398381150100
980.38056806607898300
990.38073299525004600
1000.38087661750590600
Rows: 1-100 | Columns: 3
In [16]:
from verticapy.learn.model_selection import lift_chart
lift_chart("y_true", "y_score", "example_classification")
Out[16]:
decision_boundary
positive_prediction_ratio
lift
10.00.02.1227621483376
20.03333333333333330.02557544757033252.1227621483376
30.06666666666666670.05626598465473151.93244554193491
40.10.06649616368286451.79000483859819
50.1333333333333330.07672634271099741.8195104128608
60.1666666666666670.08695652173913041.69820971867008
70.20.1074168797953961.81334258095279
80.2333333333333330.1329923273657291.8656388458629
90.2666666666666670.1483375959079281.89415699390124
100.30.1662404092071611.92529590198061
110.3333333333333330.1918158567774941.75273938853563
120.3666666666666670.2327365728900261.74289944810876
130.40.2736572890025581.68248555460832
140.4333333333333330.3478260869565221.68172224567328
150.4666666666666670.4322250639386191.62451382521836
160.50.503836317135551.57805337065097
170.5333333333333330.5780051150895141.4914328876403
180.5666666666666670.7237851662404091.25154518329071
190.60.9079283887468031.10956647262799
200.6333333333333330.9718670076726341.04308140047623
210.6666666666666670.9897698209718671.01212601816014
220.70.9974424552429671.00450220972901
230.7333333333333331.01.00100502512563
240.7666666666666671.01.0
250.81.01.0
260.8333333333333331.01.0
270.8666666666666671.01.0
280.91.01.0
290.9333333333333331.01.0
300.9666666666666671.01.0
311.01.01.0
Rows: 1-31 | Columns: 3