Beispiel #1
0
void COnlineLibLinear::train_example(CStreamingDotFeatures *feature, float64_t label)
{
	CStreamingDenseFeatures<float32_t> *feat =
		dynamic_cast<CStreamingDenseFeatures<float32_t> *>(feature);
	if (feat == NULL)
		SG_ERROR("Expected streaming dense feature <float32_t>\n");

	train_one(feat->get_vector(), label);
}
	float32_t CStreamingDenseFeatures<T>::dot(CStreamingDotFeatures* df)
{
	ASSERT(df);
	ASSERT(df->get_feature_type() == get_feature_type());
	ASSERT(df->get_feature_class() == get_feature_class());
	CStreamingDenseFeatures<T>* sf = (CStreamingDenseFeatures<T>*) df;

	SGVector<T> other_vector=sf->get_vector();

	float32_t result = CMath::dot(current_vector, other_vector.vector, current_length);

	return result;
}