Write a super-efficient OLS regression function in Java
- Tình trạng: Closed
- Giải thưởng: $25
- Các bài thi đã nhận: 1
- Người chiến thắng: NikolayBokhan
Tóm tắt cuộc thi
Write an efficient Java function to perform Multiple Ordinary Least Squares regression. The function should be in the form:
double[] getLineParams(double[][] independentVars, double[] dependentVar);
The length of dependentVar and each of independetVars[] is the number of datapoints in the sample. The length of the return array is the number of independent variables (the length of independentVars), plus 1; it should describe the line that minimizes the sum of squared errors, with the nth element describing the linear contribution of the nth independent variable (which may be negative). The last element of the return array should contain the constant (offset) part of the line equation.
So, assuming there were three independent variables, the objective would be to minimize totalError in the following test code:
double totalError=0;
for (int i=0;i<n;i++) {
double error=dependentVar[i] -
returnArray[0] * independentVars[0][i] +
returnArray[1] * independentVars[1][i] +
returnArray[2] * independentVars[2][i] +
returnArray[4];
totalError+=error*error;
}
Solutions should be implemented as a single class. Any version of Java may be used. Solutions should use only core Java, Math functions, etc. In particular no linear algebra libraries may be used. The function/class is not permitted to spawn any threads.
The winning entry will be the function that gives the correct results as efficiently as possible. The efficiency will be measures in terms of total execution time over a very large sample of pseudo-random datasets, which will vary wildly in width (the number of independent variables) and in length (the number of datapoints).
Các kĩ năng yêu cầu
Phản hồi của người thuê
“Fast high quality solution delivered. Expert knowledge. Professional service. Great communication. Adaptable. First rate!”
jwashtell, United Kingdom.
Bảng thông báo công khai
Làm thế nào để bắt đầu với cuộc thi
-
Đăng cuộc thi của bạn Nhanh chóng và dễ dàng
-
Nhận được vô số Bài dự thi Từ khắp nơi trên thế giới
-
Trao giải cho bài thi xuất sắc nhất Download File - Đơn giản!