Using fit model in CVX programming

Not if any of the arguments are CVX variables or expressions.

If you have a fit model, obtained by whatever means, its use in a CVX program must be in compliance with its rules. Therefore, it is necessary (but not sufficient) that the fit model, considered as a function of any CVX variables, must be jointly convex or concave in those variables, or there is no possibility of using it in CVX.

You might be able to use handle some piecewise functions, as described in the “Mosek Modeling Cookbook” MOSEK Modeling Cookbook — MOSEK Modeling Cookbook 3.3.0 or “FICO MIP formulations and linearizations Quick reference” https://www.fico.com/en/resource-download-file/3217 Some of these constructs require introduction of binary variables, which can be declared in CVX (MIDCP capability), but without availability of higher level constructs such as SOS2 (which you would need to model “manually”).

Also please read