mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Renamed the two parameters in the probabilistic_decision_function from a and b
to alpha and beta. This is to avoid any possibility of a probabilistic_decision_function being accidentally passed into templated code that is looking for the bias (the b element) term of a decision_function. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403203
This commit is contained in:
parent
6dca2475a6
commit
0c1117df40
@ -140,18 +140,18 @@ namespace dlib
|
|||||||
typedef typename K::sample_type sample_type;
|
typedef typename K::sample_type sample_type;
|
||||||
typedef typename K::mem_manager_type mem_manager_type;
|
typedef typename K::mem_manager_type mem_manager_type;
|
||||||
|
|
||||||
scalar_type a;
|
scalar_type alpha;
|
||||||
scalar_type b;
|
scalar_type beta;
|
||||||
decision_function<K> decision_funct;
|
decision_function<K> decision_funct;
|
||||||
|
|
||||||
probabilistic_decision_function (
|
probabilistic_decision_function (
|
||||||
) : a(0), b(0), decision_funct(decision_function<K>()) {}
|
) : alpha(0), beta(0), decision_funct(decision_function<K>()) {}
|
||||||
|
|
||||||
probabilistic_decision_function (
|
probabilistic_decision_function (
|
||||||
const probabilistic_decision_function& d
|
const probabilistic_decision_function& d
|
||||||
) :
|
) :
|
||||||
a(d.a),
|
alpha(d.alpha),
|
||||||
b(d.b),
|
beta(d.beta),
|
||||||
decision_funct(d.decision_funct)
|
decision_funct(d.decision_funct)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -160,8 +160,8 @@ namespace dlib
|
|||||||
const scalar_type b_,
|
const scalar_type b_,
|
||||||
const decision_function<K>& decision_funct_
|
const decision_function<K>& decision_funct_
|
||||||
) :
|
) :
|
||||||
a(a_),
|
alpha(a_),
|
||||||
b(b_),
|
beta(b_),
|
||||||
decision_funct(decision_funct_)
|
decision_funct(decision_funct_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ namespace dlib
|
|||||||
{
|
{
|
||||||
if (this != &d)
|
if (this != &d)
|
||||||
{
|
{
|
||||||
a = d.a;
|
alpha = d.alpha;
|
||||||
b = d.b;
|
beta = d.beta;
|
||||||
decision_funct = d.decision_funct;
|
decision_funct = d.decision_funct;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@ -183,7 +183,7 @@ namespace dlib
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalar_type f = decision_funct(x);
|
scalar_type f = decision_funct(x);
|
||||||
return 1/(1 + std::exp(a*f + b));
|
return 1/(1 + std::exp(alpha*f + beta));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ namespace dlib
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
serialize(item.a, out);
|
serialize(item.alpha, out);
|
||||||
serialize(item.b, out);
|
serialize(item.beta, out);
|
||||||
serialize(item.decision_funct, out);
|
serialize(item.decision_funct, out);
|
||||||
}
|
}
|
||||||
catch (serialization_error& e)
|
catch (serialization_error& e)
|
||||||
@ -218,8 +218,8 @@ namespace dlib
|
|||||||
typedef typename K::scalar_type scalar_type;
|
typedef typename K::scalar_type scalar_type;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
deserialize(item.a, in);
|
deserialize(item.alpha, in);
|
||||||
deserialize(item.b, in);
|
deserialize(item.beta, in);
|
||||||
deserialize(item.decision_funct, in);
|
deserialize(item.decision_funct, in);
|
||||||
}
|
}
|
||||||
catch (serialization_error& e)
|
catch (serialization_error& e)
|
||||||
|
@ -143,16 +143,16 @@ namespace dlib
|
|||||||
typedef typename K::sample_type sample_type;
|
typedef typename K::sample_type sample_type;
|
||||||
typedef typename K::mem_manager_type mem_manager_type;
|
typedef typename K::mem_manager_type mem_manager_type;
|
||||||
|
|
||||||
scalar_type a;
|
scalar_type alpha;
|
||||||
scalar_type b;
|
scalar_type beta;
|
||||||
decision_function<K> decision_funct;
|
decision_function<K> decision_funct;
|
||||||
|
|
||||||
probabilistic_decision_function (
|
probabilistic_decision_function (
|
||||||
);
|
);
|
||||||
/*!
|
/*!
|
||||||
ensures
|
ensures
|
||||||
- #a == 0
|
- #alpha == 0
|
||||||
- #b == 0
|
- #beta == 0
|
||||||
- #decision_function has its initial value
|
- #decision_function has its initial value
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
@ -165,13 +165,13 @@ namespace dlib
|
|||||||
!*/
|
!*/
|
||||||
|
|
||||||
probabilistic_decision_function (
|
probabilistic_decision_function (
|
||||||
const scalar_type a_,
|
const scalar_type a,
|
||||||
const scalar_type b_,
|
const scalar_type b,
|
||||||
const decision_function<K>& decision_funct_
|
const decision_function<K>& decision_funct_
|
||||||
) : a(a_), b(b_), decision_funct(decision_funct_) {}
|
) : alpha(a), beta(b), decision_funct(decision_funct_) {}
|
||||||
/*!
|
/*!
|
||||||
ensures
|
ensures
|
||||||
- populates the probabilistic decision function with the given a, b,
|
- populates the probabilistic decision function with the given alpha, beta,
|
||||||
and decision_function.
|
and decision_function.
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ namespace dlib
|
|||||||
// Now basically normalize the output so that it is a properly
|
// Now basically normalize the output so that it is a properly
|
||||||
// conditioned probability of x being in the +1 class given
|
// conditioned probability of x being in the +1 class given
|
||||||
// the output of the SVM.
|
// the output of the SVM.
|
||||||
return 1/(1 + std::exp(a*f + b));
|
return 1/(1 + std::exp(alpha*f + beta));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user