Exemplo n.º 1
0
        /*! @brief Return the relative ordering of two Values.
         @param[in] other The Value to be compared with.
         @returns The relative ordering of the two Values. */
        inline bool
        operator >=
            (const Value &  other)
        {
            bool    valid = false;
            bool    result = greaterThanOrEqual(other, valid);

            return (valid && result);
        } // operator >=
Exemplo n.º 2
0
float NeuralNetwork::computeAccuracy(const BlockSparseMatrix& input,
	const BlockSparseMatrix& reference) const
{
	assert(input.rows() == reference.rows());
	assert(reference.columns() == getOutputCount());

	auto result = runInputs(input);

	float threshold = 0.5f;

	auto resultActivations	  = result.greaterThanOrEqual(threshold);
	auto referenceActivations = reference.greaterThanOrEqual(threshold);

	util::log("NeuralNetwork") << "Result activations " << resultActivations.toString();
	util::log("NeuralNetwork") << "Reference activations " << referenceActivations.toString();

	auto matchingActivations = resultActivations.equals(referenceActivations);

	float matches = matchingActivations.reduceSum();

	return matches / result.size();
}
Exemplo n.º 3
0
 bool ContinuousVariable_Impl::isFeasible(double value) const {
   bool result = true;
   if (m_minimum) { result = result && greaterThanOrEqual(value,*m_minimum); }
   if (m_maximum) { result = result && lessThanOrEqual(value,*m_maximum); }
   return result;
 }