44 #ifndef ROL_LINEARREGRESSION_H
45 #define ROL_LINEARREGRESSION_H
68 const Ptr<RegressionError<Real>>
error_;
69 const Ptr<SampleGenerator<Real>>
data_;
71 Ptr<RandVarFunctional<Real>>
em_;
72 Ptr<StochasticObjective<Real>>
obj_;
74 Ptr<RiskVector<Real>>
c_;
78 Ptr<BoundConstraint<Real>>
bnd_;
79 Ptr<RiskBoundConstraint<Real>>
rbnd_;
88 int dim =
data_->getMyPoint(0).size();
89 cdata_ = makePtr<std::vector<Real>>(dim,0);
90 c_ = makePtr<RiskVector<Real>>(makePtr<StdVector<Real>>(
cdata_));
95 em_ = ErrorMeasureFactory<Real>(parlist);
102 lower_ = makePtr<std::vector<Real>>(lower);
106 upper_ = makePtr<std::vector<Real>>(upper);
119 bnd_ = makePtr<StdBoundConstraint<Real>>(*
lower_,
true);
122 bnd_ = makePtr<StdBoundConstraint<Real>>(*
upper_,
false);
127 if (
bnd_ != nullPtr) {
128 rbnd_ = makePtr<RiskBoundConstraint<Real>>(
bnd_);
129 return makePtr<OptimizationProblem<Real>>(
obj_,
c_,
rbnd_);
131 return makePtr<OptimizationProblem<Real>>(
obj_,
c_);
138 void print(std::ostream &out = std::cout,
const std::string delim =
" ")
const {
141 for (
int i = 0; i < dim; ++i) {
142 out << delim << (*cdata_)[i];
144 out << std::endl << std::endl;
Contains definitions for std::vector bound constraints.
void setUpperBound(const std::vector< Real > &upper)
Provides the interface to evaluate linear regression error.
Ptr< RiskVector< Real > > c_
Ptr< BoundConstraint< Real > > bnd_
Ptr< RiskBoundConstraint< Real > > rbnd_
void print(std::ostream &out=std::cout, const std::string delim=" ") const
Provides the interface to construct linear regression problem.
Ptr< std::vector< Real > > upper_
void setLowerBound(const std::vector< Real > &lower)
Ptr< std::vector< Real > > cdata_
void setErrorMeasure(ROL::ParameterList &parlist, bool reset=false)
Ptr< std::vector< Real > > lower_
const Ptr< OptimizationProblem< Real > > getOptimizationProblem(void)
const Ptr< RegressionError< Real > > error_
LinearRegression(const Ptr< SampleGenerator< Real >> &data)
const Ptr< SampleGenerator< Real > > data_
const Ptr< std::vector< Real > > getCoefficients(void) const
Ptr< StochasticObjective< Real > > obj_
Ptr< RandVarFunctional< Real > > em_