mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
commit
6084fdd4af
@ -20,7 +20,8 @@
|
|||||||
#include <Common/FieldVisitors.h>
|
#include <Common/FieldVisitors.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB {
|
namespace DB
|
||||||
|
{
|
||||||
|
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
@ -92,6 +93,7 @@ struct LinearRegressionData
|
|||||||
readBinary(weights, buf);
|
readBinary(weights, buf);
|
||||||
readBinary(iter_num, buf);
|
readBinary(iter_num, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Float64 predict(const std::vector<Float64>& predict_feature) const
|
Float64 predict(const std::vector<Float64>& predict_feature) const
|
||||||
{
|
{
|
||||||
Float64 res{0.0};
|
Float64 res{0.0};
|
||||||
@ -162,7 +164,8 @@ public:
|
|||||||
auto &column = dynamic_cast<ColumnVector<Float64> &>(to);
|
auto &column = dynamic_cast<ColumnVector<Float64> &>(to);
|
||||||
|
|
||||||
std::vector<Float64> predict_features(arguments.size() - 1);
|
std::vector<Float64> predict_features(arguments.size() - 1);
|
||||||
for (size_t i = 1; i < arguments.size(); ++i) {
|
for (size_t i = 1; i < arguments.size(); ++i)
|
||||||
|
{
|
||||||
const auto& element = (*block.getByPosition(arguments[i]).column)[row_num];
|
const auto& element = (*block.getByPosition(arguments[i]).column)[row_num];
|
||||||
if (element.getType() != Field::Types::Float64)
|
if (element.getType() != Field::Types::Float64)
|
||||||
throw Exception("Prediction arguments must be values of type Float",
|
throw Exception("Prediction arguments must be values of type Float",
|
||||||
@ -189,4 +192,4 @@ private:
|
|||||||
|
|
||||||
struct NameLinearRegression { static constexpr auto name = "LinearRegression"; };
|
struct NameLinearRegression { static constexpr auto name = "LinearRegression"; };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user