Loading...

verticapy.machine_learning.vertica.svm.LinearSVC.predict_proba

LinearSVC.predict_proba(vdf: Annotated[str | vDataFrame, ''], X: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, name: str | None = None, pos_label: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, inplace: bool = True) → vDataFrame

Returns the model’s probabilities using the input relation.

Parameters

vdf: SQLRelation

Object used to run the prediction. You can also specify a customized relation, but you must enclose it with an alias. For example, (SELECT 1) x is valid, whereas (SELECT 1) and “SELECT 1” are invalid.

X: SQLColumns, optional

List of the columns used to deploy the models. If empty, the model predictors are used.

name: str, optional

Name of the added vDataColumn. If empty, a name is generated.

pos_label: PythonScalar, optional

Class label. For binary classification, this can be either 1 or 0.

inplace: bool, optional

If set to True, the prediction is added to the vDataFrame.

Returns

vDataFrame

the input object.

Examples

For this example, we will use the winequality dataset.

import verticapy.datasets as vpd

data = vpd.load_winequality()
123
fixed_acidity
Numeric(8)
123
volatile_acidity
Numeric(9)
123
citric_acid
Numeric(8)
123
residual_sugar
Numeric(9)
123
chlorides
Float(22)
123
free_sulfur_dioxide
Numeric(9)
123
total_sulfur_dioxide
Numeric(9)
123
density
Float(22)
123
pH
Numeric(8)
123
sulphates
Numeric(8)
123
alcohol
Float(22)
123
quality
Integer
123
good
Integer
Abc
color
Varchar(20)
13.80.310.0211.10.03620.0114.00.992483.750.4412.460white
23.90.2250.44.20.0329.0118.00.9893.570.3612.881white
34.20.170.361.80.02993.0161.00.989993.650.8912.071white
44.20.2150.235.10.04164.0157.00.996883.420.448.030white
54.40.320.394.30.0331.0127.00.989043.460.3612.881white
64.40.460.12.80.02431.0111.00.988163.480.3413.160white
74.40.540.095.10.03852.097.00.990223.410.412.271white
84.50.190.210.950.03389.0159.00.993323.340.428.050white
94.60.4450.01.40.05311.0178.00.994263.790.5510.250white
104.60.520.152.10.0548.065.00.99343.90.5613.140red
114.70.1450.291.00.04235.090.00.99083.760.4911.360white
124.70.3350.141.30.03669.0168.00.992123.470.4610.550white
134.70.4550.181.90.03633.0106.00.987463.210.8314.071white
144.70.60.172.30.05817.0106.00.99323.850.612.960red
154.70.670.091.00.025.09.00.987223.30.3413.650white
164.70.7850.03.40.03623.0134.00.989813.530.9213.860white
174.80.130.321.20.04240.098.00.98983.420.6411.871white
184.80.170.282.90.0322.0111.00.99023.380.3411.371white
194.80.210.2110.20.03717.0112.00.993243.660.4812.271white
204.80.2250.381.20.07447.0130.00.991323.310.410.360white
214.80.260.2310.60.03423.0111.00.992743.460.2811.571white
224.80.290.231.10.04438.0180.00.989243.280.3411.960white
234.80.330.06.50.02834.0163.00.99373.350.619.950white
244.80.340.06.50.02833.0163.00.99393.360.619.960white
254.80.650.121.10.0134.010.00.992463.320.3613.540white
264.90.2350.2711.750.0334.0118.00.99543.070.59.460white
274.90.330.311.20.01639.0150.00.987133.330.5914.081white
284.90.3350.141.30.03669.0168.00.992123.470.4610.466666666666750white
294.90.3350.141.30.03669.0168.00.992123.470.4610.466666666666750white
304.90.3450.341.00.06832.0143.00.991383.240.410.150white
314.90.3450.341.00.06832.0143.00.991383.240.410.150white
324.90.420.02.10.04816.042.00.991543.710.7414.071red
334.90.470.171.90.03560.0148.00.989643.270.3511.560white
345.00.170.561.50.02624.0115.00.99063.480.3910.871white
355.00.20.41.90.01520.098.00.98973.370.5512.0560white
365.00.2350.2711.750.0334.0118.00.99543.070.59.460white
375.00.240.195.00.04317.0101.00.994383.670.5710.050white
385.00.240.212.20.03931.0100.00.990983.690.6211.760white
395.00.240.341.10.03449.0158.00.987743.320.3213.171white
405.00.2550.222.70.04346.0153.00.992383.750.7611.360white
415.00.270.324.50.03258.0178.00.989563.450.3112.671white
425.00.270.324.50.03258.0178.00.989563.450.3112.671white
435.00.270.41.20.07642.0124.00.992043.320.4710.160white
445.00.290.545.70.03554.0155.00.989763.270.3412.981white
455.00.30.333.70.0354.0173.00.98873.360.313.071white
465.00.310.06.40.04643.0166.00.9943.30.639.960white
475.00.330.161.50.04910.097.00.99173.480.4410.760white
485.00.330.161.50.04910.097.00.99173.480.4410.760white
495.00.330.161.50.04910.097.00.99173.480.4410.760white
505.00.330.184.60.03240.0124.00.991143.180.411.060white
515.00.330.2311.80.0323.0158.00.993223.410.6411.860white
525.00.350.257.80.03124.0116.00.992413.390.411.360white
535.00.350.257.80.03124.0116.00.992413.390.411.360white
545.00.380.011.60.04826.060.00.990843.70.7514.060red
555.00.40.54.30.04629.080.00.99023.490.6613.660red
565.00.420.242.00.0619.050.00.99173.720.7414.081red
575.00.440.0418.60.03938.0128.00.99853.370.5710.260white
585.00.4550.181.90.03633.0106.00.987463.210.8314.071white
595.00.550.148.30.03235.0164.00.99183.530.5112.581white
605.00.610.121.30.00965.0100.00.98743.260.3713.550white
615.00.740.01.20.04116.046.00.992584.010.5912.560red
625.01.020.041.40.04541.085.00.99383.750.4810.540red
635.01.040.241.60.0532.096.00.99343.740.6211.550red
645.10.110.321.60.02812.090.00.990083.570.5212.260white
655.10.140.250.70.03915.089.00.99193.220.439.260white
665.10.1650.225.70.04742.0146.00.99343.180.559.960white
675.10.210.281.40.04748.0148.00.991683.50.4910.450white
685.10.230.181.00.05313.099.00.989563.220.3911.550white
695.10.250.361.30.03540.078.00.98913.230.6412.171white
705.10.260.331.10.02746.0113.00.989463.350.4311.471white
715.10.260.346.40.03426.099.00.994493.230.419.260white
725.10.290.288.30.02627.0107.00.993083.360.3711.060white
735.10.290.288.30.02627.0107.00.993083.360.3711.060white
745.10.30.32.30.04840.0150.00.989443.290.4612.260white
755.10.3050.131.750.03617.073.00.993.40.5112.333333333333350white
765.10.310.30.90.03728.0152.00.9923.540.5610.160white
775.10.330.221.60.02718.089.00.98933.510.3812.571white
785.10.330.221.60.02718.089.00.98933.510.3812.571white
795.10.330.221.60.02718.089.00.98933.510.3812.571white
805.10.330.276.70.02244.0129.00.992213.360.3911.071white
815.10.350.266.80.03436.0120.00.991883.380.411.560white
825.10.350.266.80.03436.0120.00.991883.380.411.560white
835.10.350.266.80.03436.0120.00.991883.380.411.560white
845.10.390.211.70.02715.072.00.98943.50.4512.560white
855.10.420.01.80.04418.088.00.991573.680.7313.671red
865.10.420.011.50.01725.0102.00.98943.380.3612.371white
875.10.470.021.30.03418.044.00.99213.90.6212.860red
885.10.510.182.10.04216.0101.00.99243.460.8712.971red
895.10.520.062.70.05230.079.00.99323.320.439.350white
905.10.5850.01.70.04414.086.00.992643.560.9412.971red
915.20.1550.331.60.02813.059.00.989753.30.8411.981white
925.20.1550.331.60.02813.059.00.989753.30.8411.981white
935.20.160.340.80.02926.077.00.991553.250.5110.160white
945.20.170.270.70.0311.068.00.992183.30.419.850white
955.20.1850.221.00.0347.0123.00.992183.550.4410.1560white
965.20.20.273.20.04716.093.00.992353.440.5310.171white
975.20.210.311.70.04817.061.00.989533.240.3712.071white
985.20.220.466.20.06641.0187.00.993623.190.429.7333333333333350white
995.20.240.157.10.04332.0134.00.993783.240.489.960white
1005.20.240.453.80.02721.0128.00.9923.550.4911.281white
Rows: 1-100 | Columns: 14
train, test = data.train_test_split(test_size = 0.5)

Let’s import the model:

from verticapy.machine_learning.vertica import LogisticRegression

Then we can create the model:

model = LogisticRegression(
    tol = 1e-6,
    max_iter = 100,
    solver = 'Newton',
    fit_intercept = True,
)

We can now fit the model:

model.fit(
    train,
    [
        "fixed_acidity",
        "volatile_acidity",
        "citric_acid",
        "residual_sugar",
        "chlorides",
        "density",
    ],
    "good",
    test,
)



=======
details
=======
   predictor    |coefficient|std_err | z_value |p_value 
----------------+-----------+--------+---------+--------
   Intercept    | 451.60811 |31.27358|14.44056 | 0.00000
 fixed_acidity  |  0.52465  | 0.05453| 9.62052 | 0.00000
volatile_acidity| -0.92441  | 0.42345|-2.18304 | 0.02903
  citric_acid   | -0.22482  | 0.41870|-0.53694 | 0.59131
 residual_sugar |  0.13837  | 0.01736| 7.96844 | 0.00000
   chlorides    | -2.19295  | 2.47196|-0.88713 | 0.37501
    density     |-459.71264 |31.82129|-14.44670| 0.00000


==============
regularization
==============
type| lambda 
----+--------
none| 1.00000


===========
call_string
===========
logistic_reg('"public"."_verticapy_tmp_logisticregression_v_demo_eb2a789a55a411ef880f0242ac120002_"', '"public"."_verticapy_tmp_view_v_demo_eb3e0f2c55a411ef880f0242ac120002_"', '"good"', '"fixed_acidity", "volatile_acidity", "citric_acid", "residual_sugar", "chlorides", "density"'
USING PARAMETERS optimizer='newton', epsilon=1e-06, max_iterations=100, regularization='none', lambda=1, alpha=0.5, fit_intercept=true)

===============
Additional Info
===============
       Name       |Value
------------------+-----
 iteration_count  |  5  
rejected_row_count|  0  
accepted_row_count|3251 
model.predict_proba(
    test,
    [
        "fixed_acidity",
        "volatile_acidity",
        "citric_acid",
        "residual_sugar",
        "chlorides",
        "density",
    ],
    "prediction",
)
123
fixed_acidity
Numeric(8)
123
volatile_acidity
Numeric(9)
123
citric_acid
Numeric(8)
123
residual_sugar
Numeric(9)
123
chlorides
Float(22)
123
free_sulfur_dioxide
Numeric(9)
123
total_sulfur_dioxide
Numeric(9)
123
density
Float(22)
123
pH
Numeric(8)
123
sulphates
Numeric(8)
123
alcohol
Float(22)
123
quality
Integer
123
good
Integer
Abc
color
Varchar(20)
123
prediction_0
Float(22)
123
prediction_1
Float(22)
13.90.2250.44.20.0329.0118.00.9893.570.3612.881white0.6865673400404320.313432659959568
24.20.2150.235.10.04164.0157.00.996883.420.448.030white0.9837197352550270.0162802647449727
34.40.320.394.30.0331.0127.00.989043.460.3612.881white0.6483781550020190.351621844997981
44.40.460.12.80.02431.0111.00.988163.480.3413.160white0.6144337199177560.385566280082244
54.40.540.095.10.03852.097.00.990223.410.412.271white0.7680174236746830.231982576325317
64.50.190.210.950.03389.0159.00.993323.340.428.050white0.9446167545318050.0553832454681949
74.70.4550.181.90.03633.0106.00.987463.210.8314.071white0.5376800881487970.462319911851203
84.80.170.282.90.0322.0111.00.99023.380.3411.371white0.7242521921755650.275747807824435
94.80.2250.381.20.07447.0130.00.991323.310.410.360white0.8682500509778660.131749949022134
104.90.330.311.20.01639.0150.00.987133.330.5914.081white0.4653177208580070.534682279141993
114.90.3350.141.30.03669.0168.00.992123.470.4610.466666666666750white0.8958031520356470.104196847964353
124.90.3350.141.30.03669.0168.00.992123.470.4610.466666666666750white0.8958031520356470.104196847964353
134.90.3450.341.00.06832.0143.00.991383.240.410.150white0.8783764076191960.121623592380804
144.90.420.02.10.04816.042.00.991543.710.7414.071red0.8638362176542010.136163782345799
154.90.470.171.90.03560.0148.00.989643.270.3511.560white0.7422461095010090.257753890498991
165.00.170.561.50.02624.0115.00.99063.480.3910.871white0.7845706707092320.215429329290768
175.00.2350.2711.750.0334.0118.00.99543.070.59.460white0.8893866829126290.110613317087371
185.00.240.212.20.03931.0100.00.990983.690.6211.760white0.7997713746677630.200228625332237
195.00.240.341.10.03449.0158.00.987743.320.3213.171white0.5164604925141760.483539507485824
205.00.2550.222.70.04346.0153.00.992383.750.7611.360white0.8791244245213240.120875575478676
215.00.270.324.50.03258.0178.00.989563.450.3112.671white0.6108613323498450.389138667650155
225.00.270.41.20.07642.0124.00.992043.320.4710.160white0.8967957415568180.103204258443182
235.00.290.545.70.03554.0155.00.989763.270.3412.981white0.6109623760778650.389037623922135
245.00.330.161.50.04910.097.00.99173.480.4410.760white0.8706370679657810.129362932034219
255.00.420.242.00.0619.050.00.99173.720.7414.081red0.8768272876043250.123172712395675
265.00.440.0418.60.03938.0128.00.99853.370.5710.260white0.9381557567429060.0618442432570942
275.00.4550.181.90.03633.0106.00.987463.210.8314.071white0.4984030999237790.501596900076221
285.00.550.148.30.03235.0164.00.99183.530.5112.581white0.763732034648080.236267965351919
295.10.1650.225.70.04742.0146.00.99343.180.559.960white0.8711395062503650.128860493749635
305.10.250.361.30.03540.078.00.98913.230.6412.171white0.6517792972537750.348220702746225
315.10.260.346.40.03426.099.00.994493.230.419.260white0.9169482945754990.0830517054245014
325.10.30.32.30.04840.0150.00.989443.290.4612.260white0.6695258195045340.330474180495466
335.10.310.30.90.03728.0152.00.9923.540.5610.160white0.8871290576883480.112870942311652
345.10.330.221.60.02718.089.00.98933.510.3812.571white0.6686832142414570.331316785758543
355.10.330.221.60.02718.089.00.98933.510.3812.571white0.6686832142414570.331316785758543
365.10.350.266.80.03436.0120.00.991883.380.411.560white0.7705820617836770.229417938216323
375.10.350.266.80.03436.0120.00.991883.380.411.560white0.7705820617836770.229417938216323
385.10.350.266.80.03436.0120.00.991883.380.411.560white0.7705820617836770.229417938216323
395.10.420.011.50.01725.0102.00.98943.380.3612.371white0.6848387789077840.315161221092216
405.10.520.062.70.05230.079.00.99323.320.439.350white0.9267222898126950.0732777101873048
415.10.5850.01.70.04414.086.00.992643.560.9412.971red0.9203698105859240.079630189414076
425.20.1550.331.60.02813.059.00.989753.30.8411.981white0.673001793833140.32699820616686
435.20.1550.331.60.02813.059.00.989753.30.8411.981white0.673001793833140.32699820616686
445.20.1850.221.00.0347.0123.00.992183.550.4410.1560white0.8731725032597240.126827496740276
455.20.20.273.20.04716.093.00.992353.440.5310.171white0.853888315653220.14611168434678
465.20.210.311.70.04817.061.00.989533.240.3712.071white0.6675277050501790.332472294949821
475.20.240.157.10.04332.0134.00.993783.240.489.960white0.8681158185882820.131884181411718
485.20.240.453.80.02721.0128.00.9923.550.4911.281white0.8256479605543730.174352039445627
495.20.250.231.40.04720.077.00.990013.320.6211.450white0.7263128853825130.273687114617487
505.20.280.291.10.02818.069.00.991683.240.5410.060white0.8562863104512140.143713689548786
515.20.2850.295.150.03564.0138.00.98953.190.3412.481white0.5602512401516170.439748759848383
525.20.310.22.40.02727.0117.00.988863.560.4513.071white0.5778165687414490.422183431258551
535.20.310.365.10.03146.0145.00.98973.140.3112.471white0.5917291844479720.408270815552028
545.20.320.251.80.10313.050.00.99573.380.559.250red0.9765331950316060.0234668049683941
555.20.340.01.80.0527.063.00.99163.680.7914.060red0.844179144751390.15582085524861
565.20.340.376.20.03142.0133.00.990763.250.4112.560white0.6761614807345430.323838519265457
575.20.360.021.60.03124.0104.00.98963.440.3512.260white0.6855130552268910.314486944773109
585.20.370.331.20.02813.081.00.99023.370.3811.760white0.765443548446520.23455645155348
595.20.4050.151.450.03810.044.00.991253.520.411.640white0.8381709370046450.161829062995355
605.20.440.041.40.03643.0119.00.98943.360.3312.181white0.6909084826383990.309091517361601
615.20.480.041.60.05419.0106.00.99273.540.6212.271red0.9145262515517120.0854737484482875
625.20.490.262.30.0923.074.00.99533.710.6212.260red0.9735640945728090.0264359054271905
635.30.160.391.00.02840.0101.00.991563.570.5910.660white0.8323733059078010.167626694092199
645.30.160.391.00.02840.0101.00.991563.570.5910.660white0.8323733059078010.167626694092199
655.30.20.313.60.03622.091.00.992783.410.59.860white0.8629679877213560.137032012278644
665.30.240.331.30.03325.097.00.99063.590.3811.081white0.7669439089797490.233056091020251
675.30.260.235.150.03448.0160.00.99523.820.5110.571white0.9411043589625680.0588956410374323
685.30.2750.247.40.03828.0114.00.993133.380.5111.060white0.8224791410090460.177520858990954
695.30.30.164.20.02937.0100.00.99053.30.3611.881white0.679693464097450.32030653590255
705.30.320.126.60.04322.0141.00.99373.360.610.460white0.87342112709210.1265788729079
715.30.320.239.650.02626.0119.00.991683.180.5312.260white0.6383831859267270.361616814073273
725.30.330.31.20.04825.0119.00.990453.320.6211.360white0.7764957533144820.223504246685518
735.30.360.276.30.02840.0132.00.991863.370.411.660white0.7622394391931580.237760560806842
745.30.3950.071.30.03526.0102.00.9923.50.3510.660white0.8725780882002220.127421911799778
755.30.7150.191.50.1617.062.00.993953.620.6111.050red0.9674476857976590.0325523142023412
765.40.150.322.50.03710.051.00.988783.040.5812.660white0.5148145915595640.485185408440436
775.40.180.244.80.04130.0113.00.994453.420.49.460white0.9142065317536610.0857934682463389
785.40.2050.1612.550.05131.0115.00.995643.40.3810.860white0.8662101552340670.133789844765933
795.40.220.356.50.02926.087.00.990923.290.4412.571white0.632623798371980.36737620162802
805.40.230.361.50.0374.0121.00.989763.240.9912.171white0.6716723786372850.328327621362715
815.40.240.182.30.0522.0145.00.992073.240.4610.350white0.8428561508388130.157143849161187
825.40.2550.331.20.05129.0122.00.990483.370.6611.360white0.7596351621530.240364837847
835.40.290.473.00.05247.0145.00.9933.290.7510.060white0.8934152931827110.106584706817289
845.40.330.314.00.0327.0108.00.990313.30.4312.271white0.6690463491329060.330953650867094
855.40.4150.191.60.03927.088.00.992653.540.4110.071white0.8987146504232520.101285349576748
865.40.420.272.00.09223.055.00.994713.780.6412.371red0.961339799913140.0386602000868604
875.40.450.276.40.03320.0102.00.989443.220.2713.481white0.5200770597515450.479922940248455
885.40.460.152.10.02629.0130.00.989533.390.7713.481white0.6645489612071440.335451038792856
895.40.460.152.10.02629.0130.00.989533.390.7713.481white0.6645489612071440.335451038792856
905.40.530.162.70.03634.0128.00.988563.20.5313.281white0.5605945097071780.439405490292822
915.40.580.081.90.05920.031.00.994843.50.6410.260red0.9651065478888170.0348934521111829
925.40.590.077.00.04536.0147.00.99443.340.579.760white0.9159286550091270.0840713449908726
935.40.5950.12.80.04226.080.00.99323.360.389.350white0.9185315040839550.0814684959160452
945.40.740.01.20.04116.046.00.992584.010.5912.560red0.9218890252807290.0781109747192706
955.40.740.091.70.08916.026.00.994023.670.5611.660red0.9603265178437970.0396734821562032
965.40.8350.081.20.04613.093.00.99243.570.8513.071red0.9243039235231030.0756960764768968
975.50.120.331.00.03823.0131.00.991643.250.459.850white0.8184458503832940.181554149616706
985.50.120.331.00.03823.0131.00.991643.250.459.850white0.8184458503832940.181554149616706
995.50.140.274.60.02922.0104.00.99493.340.449.050white0.9235541339484140.0764458660515858
1005.50.160.224.50.0330.0102.00.99383.240.369.460white0.8817637952419280.118236204758072
Rows: 1-100 | Columns: 16

Important

For this example, a specific model is utilized, and it may not correspond exactly to the model you are working with. To see a comprehensive example specific to your class of interest, please refer to that particular class.