mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-12-22 15:06:47 +01:00
Fix crashes.
This commit is contained in:
parent
d4109a2d5b
commit
c8b93a107b
@ -580,7 +580,7 @@ Ref<MLPPVector> MLPPCost::dual_form_svm_deriv(const Ref<MLPPVector> &alpha, cons
|
|||||||
Ref<MLPPVector> alphaQDeriv = alg.mat_vec_multnv(Q, alpha);
|
Ref<MLPPVector> alphaQDeriv = alg.mat_vec_multnv(Q, alpha);
|
||||||
Ref<MLPPVector> one = alg.onevecnv(alpha->size());
|
Ref<MLPPVector> one = alg.onevecnv(alpha->size());
|
||||||
|
|
||||||
return alg.subtractionnm(alphaQDeriv, one);
|
return alg.subtractionnv(alphaQDeriv, one);
|
||||||
}
|
}
|
||||||
|
|
||||||
MLPPCost::VectorCostFunctionPointer MLPPCost::get_cost_function_ptr_normal_vector(const MLPPCost::CostTypes cost) {
|
MLPPCost::VectorCostFunctionPointer MLPPCost::get_cost_function_ptr_normal_vector(const MLPPCost::CostTypes cost) {
|
||||||
|
@ -166,7 +166,7 @@ void MLPPDualSVC::save(const String &file_name) {
|
|||||||
//util.saveParameters(file_name, _alpha, _bias);
|
//util.saveParameters(file_name, _alpha, _bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
MLPPDualSVC::MLPPDualSVC(const Ref<MLPPMatrix> &p_input_set, const Ref<MLPPMatrix> &p_output_set, real_t p_C, KernelMethod p_kernel) {
|
MLPPDualSVC::MLPPDualSVC(const Ref<MLPPMatrix> &p_input_set, const Ref<MLPPVector> &p_output_set, real_t p_C, KernelMethod p_kernel) {
|
||||||
_input_set = p_input_set;
|
_input_set = p_input_set;
|
||||||
_output_set = p_output_set;
|
_output_set = p_output_set;
|
||||||
_n = p_input_set->size().y;
|
_n = p_input_set->size().y;
|
||||||
@ -174,14 +174,16 @@ MLPPDualSVC::MLPPDualSVC(const Ref<MLPPMatrix> &p_input_set, const Ref<MLPPMatri
|
|||||||
_C = p_C;
|
_C = p_C;
|
||||||
_kernel = p_kernel;
|
_kernel = p_kernel;
|
||||||
|
|
||||||
|
_z.instance();
|
||||||
_y_hat.instance();
|
_y_hat.instance();
|
||||||
|
_alpha.instance();
|
||||||
|
|
||||||
_y_hat->resize(_n);
|
_y_hat->resize(_n);
|
||||||
|
|
||||||
MLPPUtilities utils;
|
MLPPUtilities utils;
|
||||||
|
|
||||||
_bias = utils.bias_initializationr();
|
_bias = utils.bias_initializationr();
|
||||||
|
|
||||||
_alpha.instance();
|
|
||||||
_alpha->resize(_n);
|
_alpha->resize(_n);
|
||||||
|
|
||||||
utils.weight_initializationv(_alpha); // One alpha for all training examples, as per the lagrangian multipliers.
|
utils.weight_initializationv(_alpha); // One alpha for all training examples, as per the lagrangian multipliers.
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
real_t score();
|
real_t score();
|
||||||
void save(const String &file_name);
|
void save(const String &file_name);
|
||||||
|
|
||||||
MLPPDualSVC(const Ref<MLPPMatrix> &p_input_set, const Ref<MLPPMatrix> &p_output_set, real_t p_C, KernelMethod p_kernel = KERNEL_METHOD_LINEAR);
|
MLPPDualSVC(const Ref<MLPPMatrix> &p_input_set, const Ref<MLPPVector> &p_output_set, real_t p_C, KernelMethod p_kernel = KERNEL_METHOD_LINEAR);
|
||||||
|
|
||||||
MLPPDualSVC();
|
MLPPDualSVC();
|
||||||
~MLPPDualSVC();
|
~MLPPDualSVC();
|
||||||
|
Loading…
Reference in New Issue
Block a user