Commit 6b0b1741 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Make a proper copy function for SVMWrapper

Minor changes to LossFunctionConvexHull as a result (score for inds *= n_class * n_samp)
parent 2efa7e3d
......@@ -64,6 +64,29 @@ SVMWrapper::SVMWrapper(const double C, const int n_class, const int n_dim, const
SVMWrapper(C, n_class, n_dim, prop.size(), prop.data())
{}
SVMWrapper::SVMWrapper(const SVMWrapper& o):
_model(nullptr),
_y(o._y),
_y_est(o._y_est),
_coefs(o._coefs),
_intercept(o._intercept),
_w_remap(o._w_remap),
_b_remap(o._b_remap),
_map_prop_vals(o._map_prop_vals),
_C(o._C),
_n_dim(o._n_dim),
_n_samp(o._n_samp),
_n_class(o._n_class),
_n_misclassified(o._n_misclassified)
{
setup_parameter_obj(_C);
setup_x_space();
_prob.l = _n_samp;
_prob.y = _y.data();
_prob.x = _x.data();
}
SVMWrapper::~SVMWrapper()
{
svm_destroy_param(&_param);
......
......@@ -106,14 +106,14 @@ public:
*
* @param o The object to be copied
*/
SVMWrapper(const SVMWrapper& o) = default;
SVMWrapper(const SVMWrapper& o);
/**
* @brief The move constructor
*
* @param o The object to be moved
*/
SVMWrapper(SVMWrapper&& o) = default;
SVMWrapper(SVMWrapper&& o) = delete;
/**
* @brief The destructor for the SVMWrapper
......
......@@ -261,7 +261,7 @@ double LossFunctionConvexHull::operator()(const std::vector<int>& inds)
{
n_convex_overlap += static_cast<double>(lp.get_n_overlap(inds));
}
return n_convex_overlap;
return n_convex_overlap * _n_samp * _n_class;
}
double LossFunctionConvexHull::operator()(const std::vector<model_node_ptr>& feats)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment