petsc4py.PETSc.Regressor#
- class petsc4py.PETSc.Regressor#
Bases:
Object
Regression solver.
REGRESSOR is described in the
PETSc manual
.See also
Enumerations
Linear regressor type.
REGRESSOR solver type.
Methods Summary
create
([comm])Create a REGRESSOR solver.
destroy
()Destroy the solver.
fit
(X, y)Fit the regression problem.
Get a vector of the fitted coefficients from a linear regression model.
Get the intercept from a linear regression model.
Returns the
KSP
context used by the linear regressor.Return the type of the linear regressor.
getTAO
()Return the underlying
TAO
object .getType
()Return the type of the solver.
predict
(X, y)Predict the regression problem.
reset
()Destroy internal data structures of the solver.
Configure the solver from the options database.
setLinearFitIntercept
(flag)Set a flag to indicate that the intercept should be calculated.
setLinearType
(lineartype)Set the type of linear regression to be performed.
setLinearUseKSP
(flag)Set a flag to indicate that
KSP
instead ofTAO
solvers should be used.setRegularizerWeight
(weight)Set the weight to be used for the regularizer.
setType
(regressor_type)Set the type of the solver.
setUp
()Set up the internal data structures for using the solver.
view
([viewer])View the solver.
Methods Documentation
- create(comm=None)#
Create a REGRESSOR solver.
Collective.
- Parameters:
comm – MPI communicator, defaults to
Sys.getDefaultComm
.- Return type:
See also
- destroy()#
Destroy the solver.
Collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:180
- Return type:
- fit(X, y)#
Fit the regression problem.
Collective.
- Parameters:
- Return type:
See also
- getLinearCoefficients()#
Get a vector of the fitted coefficients from a linear regression model.
Not collective.
Source code at petsc4py/PETSc/Regressor.pyx:266
- Return type:
- getLinearIntercept()#
Get the intercept from a linear regression model.
Not collective.
Source code at petsc4py/PETSc/Regressor.pyx:280
- Return type:
- getLinearKSP()#
Returns the
KSP
context used by the linear regressor.Not collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:252
- Return type:
- getLinearType()#
Return the type of the linear regressor.
Not collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:304
- Return type:
- getTAO()#
Return the underlying
TAO
object .Not collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:154
- Return type:
- getType()#
Return the type of the solver.
Not collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:212
- Return type:
- predict(X, y)#
Predict the regression problem.
Collective.
- Parameters:
- Return type:
See also
- reset()#
Destroy internal data structures of the solver.
Collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:168
- Return type:
- setFromOptions()#
Configure the solver from the options database.
Collective.
Source code at petsc4py/PETSc/Regressor.pyx:93
- Return type:
- setLinearFitIntercept(flag)#
Set a flag to indicate that the intercept should be calculated.
Logically collective.
See also
- setLinearType(lineartype)#
Set the type of linear regression to be performed.
Logically collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:293
- Parameters:
lineartype (RegressorLinearType)
- Return type:
- setLinearUseKSP(flag)#
Set a flag to indicate that
KSP
instead ofTAO
solvers should be used.Logically collective.
See also
- setRegularizerWeight(weight)#
Set the weight to be used for the regularizer.
Logically collective.
See also
- setType(regressor_type)#
Set the type of the solver.
Logically collective.
See also
- setUp()#
Set up the internal data structures for using the solver.
Collective.
See also
Source code at petsc4py/PETSc/Regressor.pyx:104
- Return type: