9 #pragma GCC diagnostic push
10 #pragma GCC diagnostic ignored "-Wdeprecated"
11 #include <shogun/base/some.h>
12 #include <shogun/base/init.h>
13 #include <shogun/machine/Machine.h>
14 #include <shogun/lib/common.h>
15 #include <shogun/labels/RegressionLabels.h>
16 #include <shogun/labels/MulticlassLabels.h>
17 #include <shogun/features/Features.h>
18 #include <shogun/machine/LinearMachine.h>
19 #include <shogun/regression/LeastAngleRegression.h>
20 #include <shogun/regression/LinearRidgeRegression.h>
22 #include <shogun/regression/svr/LibLinearRegression.h>
24 #include <shogun/ensemble/MeanRule.h>
25 #include <shogun/ensemble/MajorityVote.h>
26 #include <shogun/machine/LinearMulticlassMachine.h>
27 #pragma GCC diagnostic pop
35 #include "../params.h"
36 #include "../eval/scorer.h"
37 #include "../util/utils.h"
38 #include "nlohmann/json.hpp"
39 #include "../util/serialization.h"
44 using std::dynamic_pointer_cast;
45 using std::shared_ptr;
46 using std::make_shared;
49 using sh::EProblemType;
50 using sh::EProbHeuristicType;
51 using sh::CBinaryLabels;
52 using sh::CMulticlassLabels;
84 ML(
string ml=
"LinearRidgeRegression",
bool norm=
true,
85 bool classification =
false,
int n_classes = 2);
87 void init(
bool assign_p_est=
true);
94 vector<float> get_weights(
bool norm_adjust=
true)
const;
97 shared_ptr<CLabels> fit(
const MatrixXf& X,
const VectorXf& y,
99 const vector<char>& dtypes=vector<char>());
102 VectorXf fit_vector(
const MatrixXf& X,
const VectorXf& y,
104 const vector<char>& dtypes=vector<char>());
107 shared_ptr<CLabels> predict(
const MatrixXf& X,
111 VectorXf predict_vector(
const MatrixXf& X);
114 ArrayXXf predict_proba(
const MatrixXf& X);
117 VectorXf labels_to_vector(
const shared_ptr<CLabels>& labels);
120 shared_ptr<CLabels> retrieve_labels(
121 CDenseFeatures<float64_t>* features,
127 void set_dtypes(
const vector<char>& dtypes);
129 float get_bias(
bool norm_adjust=
true)
const;
130 void set_bias(
float b);
132 shared_ptr<CLabels> fit_tune(MatrixXf& X, VectorXf& y,
134 const vector<char>& dtypes=vector<char>(),
135 bool set_default=
false);
152 void to_json(json& j,
const shared_ptr<ML>& ml);
153 void from_json(
const json& j, shared_ptr<ML>& ml);
class that specifies the machine learning algorithm to pair with Feat.
int max_train_time
max seconds allowed for training
Normalizer N
normalization
shared_ptr< sh::CMachine > p_est
pointer to the ML object
sh::EProblemType prob_type
type of learning problem; binary, multiclass or regression
string ml_str
user specified ML type (string)
bool normalize
control whether ML normalizes its input before training
std::map< string, ML_TYPE > ml_hash
ML_TYPE ml_type
user specified ML type
map< ML_TYPE, float > C_DEFAULT
void from_json(const nl::json &, Feat &)
void to_json(nl::json &, const Feat &)
holds the hyperparameters for Feat.
normalizes a matrix to unit variance, 0 mean centered.