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.90.2250.44.20.0329.0118.00.9893.570.3612.881white
24.70.3350.141.30.03669.0168.00.992123.470.4610.550white
34.70.4550.181.90.03633.0106.00.987463.210.8314.071white
44.70.7850.03.40.03623.0134.00.989813.530.9213.860white
54.90.3450.341.00.06832.0143.00.991383.240.410.150white
64.90.3450.341.00.06832.0143.00.991383.240.410.150white
74.90.420.02.10.04816.042.00.991543.710.7414.071red
85.00.270.41.20.07642.0124.00.992043.320.4710.160white
95.00.310.06.40.04643.0166.00.9943.30.639.960white
105.00.40.54.30.04629.080.00.99023.490.6613.660red
115.00.440.0418.60.03938.0128.00.99853.370.5710.260white
125.10.110.321.60.02812.090.00.990083.570.5212.260white
135.10.140.250.70.03915.089.00.99193.220.439.260white
145.10.1650.225.70.04742.0146.00.99343.180.559.960white
155.10.330.221.60.02718.089.00.98933.510.3812.571white
165.10.330.221.60.02718.089.00.98933.510.3812.571white
175.10.330.221.60.02718.089.00.98933.510.3812.571white
185.10.390.211.70.02715.072.00.98943.50.4512.560white
195.20.20.273.20.04716.093.00.992353.440.5310.171white
205.20.210.311.70.04817.061.00.989533.240.3712.071white
215.20.220.466.20.06641.0187.00.993623.190.429.7333333333333350white
225.20.310.22.40.02727.0117.00.988863.560.4513.071white
235.20.320.251.80.10313.050.00.99573.380.559.250red
245.20.340.376.20.03142.0133.00.990763.250.4112.560white
255.20.360.021.60.03124.0104.00.98963.440.3512.260white
265.20.3650.0813.50.04137.0142.00.9973.460.399.960white
275.20.480.041.60.05419.0106.00.99273.540.6212.271red
285.20.50.182.00.03623.0129.00.989493.360.7713.471white
295.30.160.391.00.02840.0101.00.991563.570.5910.660white
305.30.160.391.00.02840.0101.00.991563.570.5910.660white
315.30.1650.241.10.05125.0105.00.99253.320.479.150white
325.30.230.560.90.04146.0141.00.991193.160.629.750white
335.30.30.31.20.02925.093.00.987423.310.413.671white
345.30.330.31.20.04825.0119.00.990453.320.6211.360white
355.30.360.276.30.02840.0132.00.991863.370.411.660white
365.30.360.276.30.02840.0132.00.991863.370.411.660white
375.30.40.253.90.03145.0130.00.990723.310.5811.7571white
385.30.470.112.20.04816.089.00.991823.540.8813.671red
395.30.470.112.20.04816.089.00.991823.540.8813.566666666666771red
405.30.7150.191.50.1617.062.00.993953.620.6111.050red
415.40.220.291.20.04569.0152.00.991783.760.6311.071white
425.40.5950.12.80.04226.080.00.99323.360.389.350white
435.40.740.091.70.08916.026.00.994023.670.5611.660red
445.50.120.331.00.03823.0131.00.991643.250.459.850white
455.50.120.331.00.03823.0131.00.991643.250.459.850white
465.50.140.274.60.02922.0104.00.99493.340.449.050white
475.50.140.274.60.02922.0104.00.99493.340.449.050white
485.50.160.311.20.02631.068.00.98983.330.4411.6560white
495.50.160.311.20.02631.068.00.98983.330.4411.633333333333360white
505.50.180.225.50.03710.086.00.991563.460.4412.250white
515.50.240.451.70.04622.0113.00.992243.220.4810.050white
525.50.290.31.10.02220.0110.00.988693.340.3812.871white
535.50.310.293.00.02716.0102.00.990673.230.5611.260white
545.50.320.454.90.02825.0191.00.99223.510.4911.571white
555.50.350.351.10.04514.0167.00.9923.340.689.960white
565.50.3750.381.70.03617.098.00.991423.290.3910.560white
575.60.150.265.550.05151.0139.00.993363.470.511.060white
585.60.150.315.30.0388.079.00.99233.30.3910.560white
595.60.160.271.40.04453.0168.00.99183.280.3710.160white
605.60.1750.290.80.04320.067.00.991123.280.489.960white
615.60.1850.197.10.04836.0110.00.994383.260.419.560white
625.60.1850.197.10.04836.0110.00.994383.260.419.560white
635.60.220.321.20.02429.097.00.988233.20.4613.0571white
645.60.260.181.40.03418.0135.00.991743.320.3510.260white
655.60.260.265.70.03112.080.00.99233.250.3810.850white
665.60.260.511.40.02925.093.00.994283.230.4910.560white
675.60.280.284.20.04452.0158.00.9923.350.4410.771white
685.60.30.16.40.04334.0142.00.993823.140.489.850white
695.60.350.145.00.04648.0198.00.99373.30.7110.350white
705.60.490.134.50.03917.0116.00.99073.420.913.771white
715.60.490.134.50.03917.0116.00.99073.420.913.771white
725.60.660.02.20.0873.011.00.993783.710.6312.871red
735.60.660.02.20.0873.011.00.993783.710.6312.871red
745.70.150.4711.40.03549.0128.00.994563.030.3410.581white
755.70.180.262.20.02321.095.00.98933.070.5412.360white
765.70.180.361.20.0469.071.00.991993.70.6810.971white
775.70.20.32.50.04638.0125.00.992763.340.59.960white
785.70.210.320.90.03838.0121.00.990743.240.4610.660white
795.70.210.374.50.0458.0140.00.993323.290.6210.660white
805.70.220.216.00.04441.0113.00.998623.220.468.960white
815.70.220.216.00.04441.0113.00.998623.220.468.960white
825.70.220.216.00.04441.0113.00.998623.220.468.960white
835.70.220.216.00.04441.0113.00.998623.220.468.960white
845.70.220.216.00.04441.0113.00.998623.220.468.960white
855.70.220.293.50.0427.0146.00.989993.170.3612.160white
865.70.230.289.650.02526.0121.00.99253.280.3811.360white
875.70.250.2612.50.04952.5106.00.996913.080.459.460white
885.70.250.2612.50.04952.5120.00.996913.080.459.460white
895.70.250.2711.50.0424.0120.00.994113.330.3110.860white
905.70.260.2417.80.05923.0124.00.997733.30.510.150white
915.70.260.2417.80.05923.0124.00.997733.30.510.150white
925.70.260.2417.80.05923.0124.00.997733.30.510.150white
935.70.270.321.20.04620.0155.00.99343.80.4110.260white
945.70.280.2417.50.04460.0167.00.99893.310.449.450white
955.70.320.181.40.02926.0104.00.99063.440.3711.060white
965.70.320.384.750.03323.094.00.9913.420.4211.871white
975.70.360.344.20.02621.077.00.99073.410.4511.960white
985.80.140.156.10.04227.0123.00.993623.060.69.960white
995.80.150.321.20.03714.0119.00.991373.190.510.260white
1005.80.170.341.80.04596.0170.00.990353.380.911.881white
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    | 407.47747 |31.31629|13.01168 | 0.00000
 fixed_acidity  |  0.42375  | 0.05431| 7.80221 | 0.00000
volatile_acidity| -0.89796  | 0.43211|-2.07808 | 0.03770
  citric_acid   |  0.09589  | 0.42539| 0.22543 | 0.82165
 residual_sugar |  0.11259  | 0.01761| 6.39249 | 0.00000
   chlorides    | -3.20081  | 2.50217|-1.27922 | 0.20082
    density     |-414.58959 |31.85491|-13.01494| 0.00000


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


===========
call_string
===========
logistic_reg('"public"."_verticapy_tmp_logisticregression_v_mldb_16be84ea979c11efa8720242ac120002_"', '"public"."_verticapy_tmp_view_v_mldb_1710c1c4979c11efa8720242ac120002_"', '"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|3245 
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)
14.40.320.394.30.0331.0127.00.989043.460.3612.881white0.6377341423477670.362265857652233
24.70.670.091.00.025.09.00.987223.30.3413.650white0.5906011179054760.409398882094524
34.80.340.06.50.02833.0163.00.99393.360.619.960white0.9013405205460050.098659479453995
45.00.270.324.50.03258.0178.00.989563.450.3112.671white0.6159933324476080.384006667552392
55.00.270.324.50.03258.0178.00.989563.450.3112.671white0.6159933324476080.384006667552392
65.00.330.184.60.03240.0124.00.991143.180.411.060white0.7656073158998160.234392684100184
75.00.380.011.60.04826.060.00.990843.70.7514.060red0.8189830798240950.181016920175905
85.00.550.148.30.03235.0164.00.99183.530.5112.581white0.7759310127558840.224068987244115
95.00.610.121.30.00965.0100.00.98743.260.3713.550white0.546914403080840.45308559691916
105.10.210.281.40.04748.0148.00.991683.50.4910.450white0.8397172199905650.160282780009435
115.10.230.181.00.05313.099.00.989563.220.3911.550white0.7045343402449970.295465659755003
125.10.250.361.30.03540.078.00.98913.230.6412.171white0.6428097462456770.357190253754323
135.10.470.021.30.03418.044.00.99213.90.6212.860red0.8867838819177110.113216118082289
145.10.5850.01.70.04414.086.00.992643.560.9412.971red0.9148493043862390.0851506956137608
155.20.1850.221.00.0347.0123.00.992183.550.4410.1560white0.857535693886530.14246430611347
165.20.240.453.80.02721.0128.00.9923.550.4911.281white0.805781215226320.19421878477368
175.20.280.291.10.02818.069.00.991683.240.5410.060white0.8387030085947240.161296991405276
185.20.340.01.80.0527.063.00.99163.680.7914.060red0.8440577117333070.155942288266693
195.20.4050.151.450.03810.044.00.991253.520.411.640white0.8304201348264580.169579865173542
205.20.60.077.00.04433.0147.00.99443.330.589.750white0.9221322670098330.0778677329901666
215.20.6450.02.150.0815.028.00.994443.780.6112.560red0.9607085633073950.0392914366926048
225.30.20.313.60.03622.091.00.992783.410.59.860white0.8497527867552710.15024721324473
235.30.240.331.30.03325.097.00.99063.590.3811.081white0.7525408059158060.247459194084194
245.30.3950.071.30.03526.0102.00.9923.50.3510.660white0.8656639638143230.134336036185677
255.30.580.076.90.04334.0149.00.99443.340.579.750white0.9182947791008230.0817052208991769
265.30.760.032.70.04327.093.00.99323.340.389.250white0.9282579447729030.0717420552270967
275.40.2050.1612.550.05131.0115.00.995643.40.3810.860white0.8738275847169140.126172415283086
285.40.450.276.40.03320.0102.00.989443.220.2713.481white0.5520689576545610.447931042345439
295.40.50.135.00.02812.0107.00.990793.480.8813.571white0.7248548087054630.275145191294537
305.60.180.271.70.0331.0103.00.988923.350.3712.960white0.5463196462907080.453680353709292
315.60.180.292.30.045.047.00.991263.070.4510.140white0.7537081771091460.246291822890854
325.60.1850.491.10.0328.0117.00.99183.550.4510.360white0.8070221138093440.192977886190656
335.60.190.261.40.0312.076.00.99053.250.3710.971white0.7077699872352910.292230012764709
345.60.190.270.90.0452.0103.00.990263.50.3911.250white0.7052489705387980.294751029461202
355.60.190.312.70.02711.0100.00.989643.460.413.271white0.5907988495458870.409201150454113
365.60.20.6610.20.04378.0175.00.99452.980.4310.471white0.8269824245434290.173017575456571
375.60.2250.249.80.05459.0140.00.995453.170.3910.260white0.8910216273018030.108978372698197
385.60.230.293.10.02319.089.00.990683.250.5111.260white0.6853436839687650.314656316031235
395.60.2350.291.20.04733.0127.00.9913.340.511.071white0.7696499094577690.230350090542231
405.60.270.370.90.02511.049.00.988453.290.3313.160white0.5340093084429810.465990691557019
415.60.2950.22.20.04918.0134.00.993783.210.6810.050white0.910129372460690.0898706275393097
425.60.310.371.40.07412.096.00.99543.320.589.250red0.9590703266259980.040929673374002
435.60.330.281.20.03133.097.00.991263.490.5810.960white0.7939956332920560.206004366707944
445.60.340.11.30.03120.068.00.99063.360.5111.271white0.7484821092882910.251517890711709
455.60.390.244.70.03427.077.00.99063.280.3612.750white0.6789187987729220.321081201227078
465.60.410.227.10.0544.0154.00.99313.30.410.550white0.830075038868890.16992496113111
475.60.50.092.30.04917.099.00.99373.630.6313.050red0.921681731516050.0783182684839499
485.60.50.092.30.04917.099.00.99373.630.6313.050red0.921681731516050.0783182684839499
495.60.6050.052.40.07319.025.00.992583.560.5512.950red0.8970400657588460.102959934241154
505.60.6950.066.80.0429.084.00.994323.440.4410.250white0.914619412169260.0853805878307404
515.70.1350.34.60.04219.0101.00.99463.310.429.360white0.897239630294150.10276036970585
525.70.220.2216.650.04439.0110.00.998553.240.489.060white0.926780886918370.0732191130816299
535.70.220.281.30.02726.0101.00.989483.350.3812.571white0.6096874040605830.390312595939417
545.70.2550.651.20.07917.0137.00.993073.20.429.450white0.891680595381560.10831940461844
555.70.310.297.30.0533.0143.00.993323.310.511.066666666666760white0.819943913601880.18005608639812
565.70.320.52.60.04917.0155.00.99273.220.6410.060white0.8549207559724990.145079244027501
575.70.3350.341.00.0413.0174.00.9923.270.6610.050white0.8407290567927350.159270943207265
585.70.3850.0412.60.03422.0115.00.99643.280.639.960white0.9034615369315230.096538463068477
595.70.450.421.10.05161.0197.00.99323.020.49.050white0.9072671106136530.0927328893863471
605.80.150.315.90.0367.073.00.991523.20.4311.960white0.6669788716225440.333021128377456
615.80.190.2510.80.04233.0124.00.996463.220.419.260white0.9048072693208210.0951927306791793
625.80.190.494.90.0444.0118.00.99353.340.389.571white0.8401693689664880.159830631033512
635.80.20.161.40.04244.099.00.989123.230.3712.260white0.5706913346284520.429308665371548
645.80.20.271.40.03112.077.00.99053.250.3610.971white0.6923329214392260.307667078560774
655.80.220.251.50.02421.0109.00.992343.370.5810.460white0.8263685624069240.173631437593076
665.80.250.2613.10.05144.0148.00.99723.290.389.350white0.9153969120104730.0846030879895269
675.80.330.216.050.04726.0166.00.99763.090.468.950white0.9071964247190360.0928035752809642
685.80.330.216.050.04726.0166.00.99763.090.468.950white0.9071964247190360.0928035752809642
695.80.3450.1510.80.03326.0120.00.994943.250.4910.060white0.8508911474360080.149108852563992
705.80.360.263.30.03840.0153.00.99113.340.5511.360white0.7335916068883150.266408393111685
715.80.360.263.30.03840.0153.00.99113.340.5511.360white0.7335916068883150.266408393111685
725.80.380.261.10.05820.0140.00.992713.270.439.760white0.8818514884097330.118148511590266
735.90.130.281.90.0520.078.00.99183.430.6410.860white0.7770132488055180.222986751194482
745.90.170.280.70.0275.028.00.989853.130.3210.650white0.6311843574540730.368815642545927
755.90.170.293.10.0332.0123.00.989133.410.3313.771white0.4943071884361670.505692811563833
765.90.20.231.50.03738.093.00.990213.360.4912.060white0.659310729349850.34068927065015
775.90.20.231.50.03738.093.00.990213.360.4912.060white0.659310729349850.34068927065015
785.90.230.312.90.05457.0170.00.99723.280.399.450white0.9128815014327380.0871184985672618
795.90.240.281.30.03236.095.00.988893.080.6412.971white0.537579753355310.46242024664469
805.90.240.32.00.03328.092.00.992253.390.6910.971white0.8124631283281320.187536871671868
815.90.240.32.00.03328.092.00.992253.390.6910.971white0.8124631283281320.187536871671868
825.90.260.2718.20.04852.0168.00.99933.350.449.450white0.9330096408757690.0669903591242311
835.90.260.41.30.04712.0139.00.99453.450.5310.450white0.9262808321630230.0737191678369767
845.90.270.279.00.05143.0136.00.99413.250.5310.760white0.8223567165185610.177643283481439
855.90.280.343.60.0450.0194.00.99123.310.5211.660white0.7120010656678440.287998934332156
865.90.290.321.40.02217.047.00.98993.350.3511.560white0.6381015068768780.361898493123122
875.90.340.312.00.0338.0142.00.988923.40.4112.971white0.5410935986063880.458906401393612
885.90.340.312.00.0338.0142.00.988923.40.4112.971white0.5410935986063880.458906401393612
895.90.360.045.70.04621.087.00.99343.220.5110.250white0.8456122591614240.154387740838576
905.90.4150.131.40.0411.064.00.99223.290.5210.550white0.8466765238426710.153323476157329
915.90.4350.166.40.03121.0134.00.991513.240.4612.260white0.6997346674458020.300265332554198
925.90.650.235.00.03520.0128.00.990163.460.4812.860white0.6554570233545960.344542976645405
936.00.190.2612.40.04850.0147.00.99723.30.368.960white0.9098634127542420.090136587245758
946.00.190.2612.40.04850.0147.00.99723.30.368.960white0.9098634127542420.090136587245758
956.00.20.323.00.03126.0118.00.991343.380.6811.271white0.7088111131027690.291188886897231
966.00.240.326.30.0334.0129.00.99463.520.4110.450white0.8701577812365120.129842218763488
976.00.240.411.30.03642.0118.00.990183.040.6411.7560white0.6555182895443120.344481710455688
986.00.260.151.20.05335.0124.00.993473.080.468.850white0.8924437278244520.107556272175548
996.00.270.41.70.02118.082.00.98913.240.9513.133333333333360white0.5325734328754390.467426567124561
1006.00.280.2417.80.04742.0111.00.998963.10.458.960white0.9250621295361470.0749378704638535
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.